pub enum Suggestion {
ReplaceWith(Vec<char>),
InsertAfter(Vec<char>),
Remove,
}
Expand description
A suggested edit that could resolve a Lint
.
Variants§
ReplaceWith(Vec<char>)
Replace the offending text with a specific character sequence.
InsertAfter(Vec<char>)
Insert the provided characters after the offending text.
Remove
Remove the offending text.
Implementations§
Source§impl Suggestion
impl Suggestion
Sourcepub const fn is_replace_with(&self) -> bool
pub const fn is_replace_with(&self) -> bool
Returns true
if self
is of variant ReplaceWith
.
Sourcepub fn as_replace_with(&self) -> Option<&Vec<char>>
pub fn as_replace_with(&self) -> Option<&Vec<char>>
Returns Some
if self
is a reference of variant ReplaceWith
, and None
otherwise.
Sourcepub fn as_mut_replace_with(&mut self) -> Option<&mut Vec<char>>
pub fn as_mut_replace_with(&mut self) -> Option<&mut Vec<char>>
Returns Some
if self
is a mutable reference of variant ReplaceWith
, and None
otherwise.
Sourcepub fn expect_replace_with(self) -> Vec<char>where
Self: Debug,
pub fn expect_replace_with(self) -> Vec<char>where
Self: Debug,
Unwraps the value, yielding the content of ReplaceWith
.
§Panics
Panics if the value is not ReplaceWith
, with a panic message including the content of self
.
Sourcepub fn replace_with(self) -> Option<Vec<char>>
pub fn replace_with(self) -> Option<Vec<char>>
Returns Some
if self
is of variant ReplaceWith
, and None
otherwise.
Sourcepub const fn is_insert_after(&self) -> bool
pub const fn is_insert_after(&self) -> bool
Returns true
if self
is of variant InsertAfter
.
Sourcepub fn as_insert_after(&self) -> Option<&Vec<char>>
pub fn as_insert_after(&self) -> Option<&Vec<char>>
Returns Some
if self
is a reference of variant InsertAfter
, and None
otherwise.
Sourcepub fn as_mut_insert_after(&mut self) -> Option<&mut Vec<char>>
pub fn as_mut_insert_after(&mut self) -> Option<&mut Vec<char>>
Returns Some
if self
is a mutable reference of variant InsertAfter
, and None
otherwise.
Sourcepub fn expect_insert_after(self) -> Vec<char>where
Self: Debug,
pub fn expect_insert_after(self) -> Vec<char>where
Self: Debug,
Unwraps the value, yielding the content of InsertAfter
.
§Panics
Panics if the value is not InsertAfter
, with a panic message including the content of self
.
Sourcepub fn insert_after(self) -> Option<Vec<char>>
pub fn insert_after(self) -> Option<Vec<char>>
Returns Some
if self
is of variant InsertAfter
, and None
otherwise.
Source§impl Suggestion
impl Suggestion
Sourcepub fn replace_with_match_case_str(
value: &'static str,
template: &[char],
) -> Self
pub fn replace_with_match_case_str( value: &'static str, template: &[char], ) -> Self
Variant of Self::replace_with_match_case
that accepts a static string.
Sourcepub fn replace_with_match_case(value: Vec<char>, template: &[char]) -> Self
pub fn replace_with_match_case(value: Vec<char>, template: &[char]) -> Self
Construct an instance of Self::ReplaceWith
, but make the content match the case of the
provided template.
For example, if we want to replace “You’re” with “You are”, we can provide “you are” and “You’re”.
Trait Implementations§
Source§impl Clone for Suggestion
impl Clone for Suggestion
Source§fn clone(&self) -> Suggestion
fn clone(&self) -> Suggestion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Suggestion
impl Debug for Suggestion
Source§impl<'de> Deserialize<'de> for Suggestion
impl<'de> Deserialize<'de> for Suggestion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Suggestion
impl Display for Suggestion
Source§impl Hash for Suggestion
impl Hash for Suggestion
Source§impl PartialEq for Suggestion
impl PartialEq for Suggestion
Source§impl Serialize for Suggestion
impl Serialize for Suggestion
impl Eq for Suggestion
impl StructuralPartialEq for Suggestion
Auto Trait Implementations§
impl Freeze for Suggestion
impl RefUnwindSafe for Suggestion
impl Send for Suggestion
impl Sync for Suggestion
impl Unpin for Suggestion
impl UnwindSafe for Suggestion
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more