pub struct UseAtomicMutation {
pub target_struct: Option<String>,
}Expand description
Suggests replacing Mutex
Detection: Fields protected by Mutex that could use AtomicUsize, AtomicBool, etc.
§Example
ⓘ
// Before
struct Counter {
count: Mutex<usize>,
is_ready: Mutex<bool>,
}
// After (suggested)
struct Counter {
count: AtomicUsize,
is_ready: AtomicBool,
}Fields§
§target_struct: Option<String>Only apply to specific struct
Implementations§
Trait Implementations§
Source§impl Clone for UseAtomicMutation
impl Clone for UseAtomicMutation
Source§fn clone(&self) -> UseAtomicMutation
fn clone(&self) -> UseAtomicMutation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UseAtomicMutation
impl Debug for UseAtomicMutation
Source§impl Default for UseAtomicMutation
impl Default for UseAtomicMutation
Source§fn default() -> UseAtomicMutation
fn default() -> UseAtomicMutation
Returns the “default value” for a type. Read more
Source§impl Detect for UseAtomicMutation
impl Detect for UseAtomicMutation
Source§fn category(&self) -> DetectCategory
fn category(&self) -> DetectCategory
Get the category for detected opportunities
Source§fn detect_name(&self) -> &'static str
fn detect_name(&self) -> &'static str
Get the mutation/pattern name
Source§fn detect_description(&self) -> &str
fn detect_description(&self) -> &str
Get description
Source§impl Mutation for UseAtomicMutation
impl Mutation for UseAtomicMutation
Source§fn mutation_type(&self) -> &'static str
fn mutation_type(&self) -> &'static str
Get the mutation type name
Source§fn validate(&self, _file: &PureFile) -> ValidationResult
fn validate(&self, _file: &PureFile) -> ValidationResult
Validate the mutation before applying Read more
Source§fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
Check if this mutation can proceed with the given strategy
Auto Trait Implementations§
impl Freeze for UseAtomicMutation
impl RefUnwindSafe for UseAtomicMutation
impl Send for UseAtomicMutation
impl Sync for UseAtomicMutation
impl Unpin for UseAtomicMutation
impl UnsafeUnpin for UseAtomicMutation
impl UnwindSafe for UseAtomicMutation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more