rust/tests/ui/rc_buffer_arc.fixed
Ada Alakbarova 3714236a69
fix: make the suggestion apply only to the inner type
Now we don't touch, and thus don't break, whatever path `Rc`/`Arc` was
specified with
2025-10-11 10:44:49 +02:00

38 lines
759 B
Rust

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