File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ fn main() {
10
10
let bar = "bar";
11
11
path_buf = PathBuf::from("foo").join(bar);
12
12
13
+ let mut path_buf = PathBuf::from("foo").join("bar").join("buz");
14
+
13
15
let mut x = PathBuf::new();
14
16
println!("{}", x.display());
15
17
x.push("Duck");
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ fn main() {
13
13
path_buf = PathBuf :: from ( "foo" ) ;
14
14
path_buf. push ( bar) ;
15
15
16
+ let mut path_buf = PathBuf :: from ( "foo" ) . join ( "bar" ) ;
17
+ path_buf. push ( "buz" ) ;
18
+
16
19
let mut x = PathBuf :: new ( ) ;
17
20
println ! ( "{}" , x. display( ) ) ;
18
21
x. push ( "Duck" ) ;
Original file line number Diff line number Diff line change @@ -22,5 +22,12 @@ LL | / path_buf = PathBuf::from("foo");
22
22
LL | | path_buf.push(bar);
23
23
| |_______________________^ help: consider using the `.join()`: `path_buf = PathBuf::from("foo").join(bar);`
24
24
25
- error: aborting due to 3 previous errors
25
+ error: calls to `push` immediately after creation
26
+ --> tests/ui/pathbuf_init_then_push.rs:16:5
27
+ |
28
+ LL | / let mut path_buf = PathBuf::from("foo").join("bar");
29
+ LL | | path_buf.push("buz");
30
+ | |_________________________^ help: consider using the `.join()`: `let mut path_buf = PathBuf::from("foo").join("bar").join("buz");`
31
+
32
+ error: aborting due to 4 previous errors
26
33
You can’t perform that action at this time.
0 commit comments