rust/tests/ui/rc_buffer_arc.fixed

28 lines
596 B
Rust
Raw Normal View History

//@run-rustfix
#![warn(clippy::rc_buffer)]
#![allow(dead_code, unused_imports)]
use std::ffi::OsString;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
struct S {
// triggers lint
bad1: Arc<str>,
bad2: Arc<std::path::Path>,
bad3: Arc<[u8]>,
bad4: Arc<std::ffi::OsStr>,
// does not trigger lint
good1: Arc<Mutex<String>>,
}
// triggers lint
fn func_bad1(_: Arc<str>) {}
fn func_bad2(_: Arc<std::path::Path>) {}
fn func_bad3(_: Arc<[u8]>) {}
fn func_bad4(_: Arc<std::ffi::OsStr>) {}
// does not trigger lint
fn func_good1(_: Arc<Mutex<String>>) {}
fn main() {}