mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
cb77f12600
Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
22 lines
484 B
Rust
22 lines
484 B
Rust
#![warn(clippy::pathbuf_init_then_push)]
|
|
|
|
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
let mut path_buf = PathBuf::from("foo");
|
|
|
|
path_buf = PathBuf::from("foo").join("bar");
|
|
|
|
let bar = "bar";
|
|
path_buf = PathBuf::from("foo").join(bar);
|
|
|
|
let mut path_buf = PathBuf::from("foo").join("bar").join("buz");
|
|
|
|
let mut x = PathBuf::new();
|
|
println!("{}", x.display());
|
|
x.push("Duck");
|
|
|
|
let mut path_buf = PathBuf::new();
|
|
#[cfg(cats)]
|
|
path_buf.push("foo");
|
|
}
|