Skip to content

Commit c4eead5

Browse files
committed
wip
1 parent 482ae2a commit c4eead5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

tests/ui/pathbuf_init_then_push.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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");

tests/ui/pathbuf_init_then_push.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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");

tests/ui/pathbuf_init_then_push.stderr

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@ LL | / path_buf = PathBuf::from("foo");
2222
LL | | 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

0 commit comments

Comments
 (0)