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() {
1010 let bar = "bar";
1111 path_buf = PathBuf::from("foo").join(bar);
1212
13+ let mut path_buf = PathBuf::from("foo").join("bar").join("buz");
14+
1315 let mut x = PathBuf::new();
1416 println!("{}", x.display());
1517 x.push("Duck");
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ fn main() {
1313 path_buf = PathBuf :: from ( "foo" ) ;
1414 path_buf. push ( bar) ;
1515
16+ let mut path_buf = PathBuf :: from ( "foo" ) . join ( "bar" ) ;
17+ path_buf. push ( "buz" ) ;
18+
1619 let mut x = PathBuf :: new ( ) ;
1720 println ! ( "{}" , x. display( ) ) ;
1821 x. push ( "Duck" ) ;
Original file line number Diff line number Diff line change @@ -22,5 +22,12 @@ LL | / path_buf = PathBuf::from("foo");
2222LL | | path_buf.push(bar);
2323 | |_______________________^ help: consider using the `.join()`: `path_buf = PathBuf::from("foo").join(bar);`
2424
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
2633
You can’t perform that action at this time.
0 commit comments