pub struct UnwrapToQuestionMutation {
pub include_expect: bool,
pub target_fn: Option<SymbolId>,
}Expand description
Convert .unwrap() and .expect() to ? operator
Fields§
§include_expect: boolAlso convert .expect() calls
target_fn: Option<SymbolId>Target function SymbolId. If None, applies to all functions.
Implementations§
Source§impl UnwrapToQuestionMutation
impl UnwrapToQuestionMutation
pub fn new() -> Self
Sourcepub fn unwrap_only(self) -> Self
pub fn unwrap_only(self) -> Self
Don’t convert .expect() calls (keep the error message)
Sourcepub fn in_function(self, id: SymbolId) -> Self
pub fn in_function(self, id: SymbolId) -> Self
Only apply in a specific function
Sourcepub fn transform_block(&self, block: &mut PureBlock) -> usize
pub fn transform_block(&self, block: &mut PureBlock) -> usize
Transform a block
Trait Implementations§
Source§impl Clone for UnwrapToQuestionMutation
impl Clone for UnwrapToQuestionMutation
Source§fn clone(&self) -> UnwrapToQuestionMutation
fn clone(&self) -> UnwrapToQuestionMutation
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 UnwrapToQuestionMutation
impl Debug for UnwrapToQuestionMutation
Source§impl Default for UnwrapToQuestionMutation
impl Default for UnwrapToQuestionMutation
Source§fn default() -> UnwrapToQuestionMutation
fn default() -> UnwrapToQuestionMutation
Returns the “default value” for a type. Read more
Source§impl Mutation for UnwrapToQuestionMutation
impl Mutation for UnwrapToQuestionMutation
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 UnwrapToQuestionMutation
impl RefUnwindSafe for UnwrapToQuestionMutation
impl Send for UnwrapToQuestionMutation
impl Sync for UnwrapToQuestionMutation
impl Unpin for UnwrapToQuestionMutation
impl UnsafeUnpin for UnwrapToQuestionMutation
impl UnwindSafe for UnwrapToQuestionMutation
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