about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/pathbuf_init_then_push.fixed
blob: 2a90b8ce28141ee6604e8436210d0a0bf9ede280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![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");
}