File tree 2 files changed +23
-4
lines changed 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,16 @@ fn main() {
7
7
// should be linted
8
8
let path = Path :: new ( "/bin" ) ;
9
9
path. join ( "/sh" ) ;
10
- println ! ( "{}" , path. display( ) ) ;
11
10
12
11
//should be linted
13
12
let path = Path :: new ( "C:\\ Users" ) ;
14
13
path. join ( "\\ user" ) ;
15
- println ! ( "{}" , path. display( ) ) ;
16
14
17
15
// should not be linted
18
16
let path: & [ & str ] = & [ "/bin" ] ;
19
17
path. join ( "/sh" ) ;
20
- println ! ( "{:?}" , path) ;
21
18
22
19
//should not be linted
23
20
let path = Path :: new ( "/bin" ) ;
24
21
path. join ( "sh" ) ;
25
- println ! ( "{}" , path. display( ) ) ;
26
22
}
Original file line number Diff line number Diff line change
1
+ error: argument to `Path::join` starts with a path separator
2
+ --> $DIR/join_absolute_paths.rs:8:15
3
+ |
4
+ LL | path.join("/sh");
5
+ | ^^^^^
6
+ |
7
+ = note: joining a path starting with separator will replace the path instead
8
+ = help: if this is unintentional, try removing the starting separator
9
+ = help: if this is intentional, try creating a new Path instead
10
+ = note: `-D clippy::join-absolute-paths` implied by `-D warnings`
11
+
12
+ error: argument to `Path::join` starts with a path separator
13
+ --> $DIR/join_absolute_paths.rs:12:15
14
+ |
15
+ LL | path.join("//user");
16
+ | ^^^^^^^^
17
+ |
18
+ = note: joining a path starting with separator will replace the path instead
19
+ = help: if this is unintentional, try removing the starting separator
20
+ = help: if this is intentional, try creating a new Path instead
21
+
22
+ error: aborting due to 2 previous errors
23
+
You can’t perform that action at this time.
0 commit comments