mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 14:40:32 +00:00
34d9e88a47
* `join_absolute_paths` Address PR review * Move `clippy::join_absolute_paths` to `clippy::suspicious` * `join_absolute_paths`: Address PR review Co-Authored-By: ofeeg <mhanna0000@gmail.com>
30 lines
787 B
Rust
30 lines
787 B
Rust
//@no-rustfix
|
|
|
|
#![allow(clippy::needless_raw_string_hashes)]
|
|
#![warn(clippy::join_absolute_paths)]
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
fn main() {
|
|
let path = Path::new("/bin");
|
|
path.join("/sh");
|
|
//~^ ERROR: argument to `Path::join` starts with a path separator
|
|
|
|
let path = Path::new("C:\\Users");
|
|
path.join("\\user");
|
|
//~^ ERROR: argument to `Path::join` starts with a path separator
|
|
|
|
let path = PathBuf::from("/bin");
|
|
path.join("/sh");
|
|
//~^ ERROR: argument to `Path::join` starts with a path separator
|
|
|
|
let path = PathBuf::from("/bin");
|
|
path.join(r#"/sh"#);
|
|
//~^ ERROR: argument to `Path::join` starts with a path separator
|
|
|
|
let path: &[&str] = &["/bin"];
|
|
path.join("/sh");
|
|
|
|
let path = Path::new("/bin");
|
|
path.join("sh");
|
|
}
|