mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-19 01:24:05 +00:00
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");
|
|
}
|