File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,16 @@ fn main() {
77 // should be linted
88 let path = Path :: new ( "/bin" ) ;
99 path. join ( "/sh" ) ;
10- println ! ( "{}" , path. display( ) ) ;
1110
1211 //should be linted
1312 let path = Path :: new ( "C:\\ Users" ) ;
1413 path. join ( "\\ user" ) ;
15- println ! ( "{}" , path. display( ) ) ;
1614
1715 // should not be linted
1816 let path: & [ & str ] = & [ "/bin" ] ;
1917 path. join ( "/sh" ) ;
20- println ! ( "{:?}" , path) ;
2118
2219 //should not be linted
2320 let path = Path :: new ( "/bin" ) ;
2421 path. join ( "sh" ) ;
25- println ! ( "{}" , path. display( ) ) ;
2622}
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