mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-23 19:43:20 +00:00
33 lines
1.4 KiB
Text
33 lines
1.4 KiB
Text
error: calls to `push` immediately after creation
|
|
--> tests/ui/pathbuf_init_then_push.rs:6:5
|
|
|
|
|
LL | / let mut path_buf = PathBuf::new();
|
|
LL | | path_buf.push("foo");
|
|
| |_________________________^ help: consider using the `.join()`: `let mut path_buf = PathBuf::from("foo");`
|
|
|
|
|
= note: `-D clippy::pathbuf-init-then-push` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::pathbuf_init_then_push)]`
|
|
|
|
error: calls to `push` immediately after creation
|
|
--> tests/ui/pathbuf_init_then_push.rs:9:5
|
|
|
|
|
LL | / path_buf = PathBuf::from("foo");
|
|
LL | | path_buf.push("bar");
|
|
| |_________________________^ help: consider using the `.join()`: `path_buf = PathBuf::from("foo").join("bar");`
|
|
|
|
error: calls to `push` immediately after creation
|
|
--> tests/ui/pathbuf_init_then_push.rs:13:5
|
|
|
|
|
LL | / path_buf = PathBuf::from("foo");
|
|
LL | | path_buf.push(bar);
|
|
| |_______________________^ help: consider using the `.join()`: `path_buf = PathBuf::from("foo").join(bar);`
|
|
|
|
error: calls to `push` immediately after creation
|
|
--> tests/ui/pathbuf_init_then_push.rs:16:5
|
|
|
|
|
LL | / let mut path_buf = PathBuf::from("foo").join("bar");
|
|
LL | | path_buf.push("buz");
|
|
| |_________________________^ help: consider using the `.join()`: `let mut path_buf = PathBuf::from("foo").join("bar").join("buz");`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|