Address review comments Fix adjacent code Required now that the lint is pedantic Add inline formatting tests Add note re formatting changes Address `unnecessary_map_or` warnings Address additional review comments Typo Update Clippy version
23 lines
743 B
Rust
23 lines
743 B
Rust
#![feature(os_str_display)]
|
|
#![warn(clippy::unnecessary_debug_formatting)]
|
|
|
|
use std::ffi::{OsStr, OsString};
|
|
|
|
fn main() {
|
|
let os_str = OsStr::new("abc");
|
|
let os_string = os_str.to_os_string();
|
|
|
|
// negative tests
|
|
println!("{}", os_str.display());
|
|
println!("{}", os_string.display());
|
|
|
|
// positive tests
|
|
println!("{:?}", os_str); //~ unnecessary_debug_formatting
|
|
println!("{:?}", os_string); //~ unnecessary_debug_formatting
|
|
|
|
println!("{os_str:?}"); //~ unnecessary_debug_formatting
|
|
println!("{os_string:?}"); //~ unnecessary_debug_formatting
|
|
|
|
let _: String = format!("{:?}", os_str); //~ unnecessary_debug_formatting
|
|
let _: String = format!("{:?}", os_string); //~ unnecessary_debug_formatting
|
|
}
|