Skip to content

Commit f79f6ae

Browse files
committed
join_absolute_paths: Address PR review
1 parent b9433a6 commit f79f6ae

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

clippy_lints/src/methods/join_absolute_paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx Expr<'tcx>, join_a
1717
&& let ExprKind::Lit(spanned) = expr_or_init(cx, join_arg).kind
1818
&& let LitKind::Str(symbol, _) = spanned.node
1919
&& let sym_str = symbol.as_str()
20-
&& (sym_str.starts_with('/') || sym_str.starts_with('\\'))
20+
&& sym_str.starts_with(&['/', '\\'])
2121
{
2222
span_lint_and_then(
2323
cx,
@@ -42,7 +42,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx Expr<'tcx>, join_a
4242
)
4343
.span_suggestion(
4444
expr_span,
45-
"if this is intentional, try creating a new Path instead",
45+
"if this is intentional, try using `Path::new` instead",
4646
format!("PathBuf::from({arg_str})"),
4747
Applicability::Unspecified,
4848
);

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3694,7 +3694,7 @@ declare_clippy_lint! {
36943694
/// Note the behavior is platform dependent. A leading `\\` will be accepted
36953695
/// on unix systems as part of the file name
36963696
///
3697-
/// See [`Path::join()`](https://doc.rust-lang.org/std/path/struct.Path.html#method.join)
3697+
/// See [`Path::join`](https://doc.rust-lang.org/std/path/struct.Path.html#method.join)
36983698
///
36993699
/// ### Example
37003700
/// ```rust

tests/ui/join_absolute_paths.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ help: if this is unintentional, try removing the starting separator
1111
|
1212
LL | path.join("sh");
1313
| ~~~~
14-
help: if this is intentional, try creating a new Path instead
14+
help: if this is intentional, try using `Path::new` instead
1515
|
1616
LL | PathBuf::from("/sh");
1717
| ~~~~~~~~~~~~~~~~~~~~
@@ -27,7 +27,7 @@ help: if this is unintentional, try removing the starting separator
2727
|
2828
LL | path.join("\user");
2929
| ~~~~~~~
30-
help: if this is intentional, try creating a new Path instead
30+
help: if this is intentional, try using `Path::new` instead
3131
|
3232
LL | PathBuf::from("\\user");
3333
| ~~~~~~~~~~~~~~~~~~~~~~~
@@ -43,7 +43,7 @@ help: if this is unintentional, try removing the starting separator
4343
|
4444
LL | path.join("sh");
4545
| ~~~~
46-
help: if this is intentional, try creating a new Path instead
46+
help: if this is intentional, try using `Path::new` instead
4747
|
4848
LL | PathBuf::from("/sh");
4949
| ~~~~~~~~~~~~~~~~~~~~
@@ -59,7 +59,7 @@ help: if this is unintentional, try removing the starting separator
5959
|
6060
LL | path.join(r#"sh"#);
6161
| ~~~~~~~
62-
help: if this is intentional, try creating a new Path instead
62+
help: if this is intentional, try using `Path::new` instead
6363
|
6464
LL | PathBuf::from(r#"/sh"#);
6565
| ~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)