Skip to content

Commit b9433a6

Browse files
committed
Move clippy::join_absolute_paths to clippy::suspicious
1 parent 957cb2d commit b9433a6

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

clippy_lints/src/methods/join_absolute_paths.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx Expr<'tcx>, join_a
3434
};
3535

3636
diag.note("joining a path starting with separator will replace the path instead")
37-
.span_suggestion(
38-
spanned.span,
39-
"if this is unintentional, try removing the starting separator",
40-
no_separator,
41-
Applicability::Unspecified
42-
)
43-
.span_suggestion(
44-
expr_span,
45-
"if this is intentional, try creating a new Path instead",
46-
format!("PathBuf::from({arg_str})"),
47-
Applicability::Unspecified
48-
);
37+
.span_suggestion(
38+
spanned.span,
39+
"if this is unintentional, try removing the starting separator",
40+
no_separator,
41+
Applicability::Unspecified,
42+
)
43+
.span_suggestion(
44+
expr_span,
45+
"if this is intentional, try creating a new Path instead",
46+
format!("PathBuf::from({arg_str})"),
47+
Applicability::Unspecified,
48+
);
4949
},
5050
);
5151
}

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3719,7 +3719,7 @@ declare_clippy_lint! {
37193719
/// ```
37203720
#[clippy::version = "1.75.0"]
37213721
pub JOIN_ABSOLUTE_PATHS,
3722-
correctness,
3722+
suspicious,
37233723
"calls to `Path::join` which will overwrite the original path"
37243724
}
37253725

tests/ui/join_absolute_paths.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | path.join("/sh");
66
|
77
= note: joining a path starting with separator will replace the path instead
88
= note: `-D clippy::join-absolute-paths` implied by `-D warnings`
9+
= help: to override `-D warnings` add `#[allow(clippy::join_absolute_paths)]`
910
help: if this is unintentional, try removing the starting separator
1011
|
1112
LL | path.join("sh");

0 commit comments

Comments
 (0)