Apply more suggestions.
This commit is contained in:
@@ -219,7 +219,7 @@ where
|
||||
panic!("Attempted to extend past the end of the WrappedInput.")
|
||||
}
|
||||
if new_start == self.start && new_end == self.end {
|
||||
return self.clone();
|
||||
return *self;
|
||||
}
|
||||
|
||||
let skipped_text = &self.full_source[self.start..new_start];
|
||||
@@ -337,7 +337,7 @@ impl<'s> InputTakeAtPosition for OrgSource<'s> {
|
||||
P: Fn(Self::Item) -> bool,
|
||||
{
|
||||
match Into::<&str>::into(self).position(predicate) {
|
||||
Some(0) => Err(nom::Err::Error(E::from_error_kind(self.clone(), e))),
|
||||
Some(0) => Err(nom::Err::Error(E::from_error_kind(*self, e))),
|
||||
Some(idx) => Ok(self.take_split(idx)),
|
||||
None => Err(nom::Err::Incomplete(nom::Needed::new(1))),
|
||||
}
|
||||
@@ -366,11 +366,11 @@ impl<'s> InputTakeAtPosition for OrgSource<'s> {
|
||||
{
|
||||
let window = Into::<&str>::into(self);
|
||||
match window.position(predicate) {
|
||||
Some(0) => Err(nom::Err::Error(E::from_error_kind(self.clone(), e))),
|
||||
Some(0) => Err(nom::Err::Error(E::from_error_kind(*self, e))),
|
||||
Some(n) => Ok(self.take_split(n)),
|
||||
None => {
|
||||
if window.input_len() == 0 {
|
||||
Err(nom::Err::Error(E::from_error_kind(self.clone(), e)))
|
||||
Err(nom::Err::Error(E::from_error_kind(*self, e)))
|
||||
} else {
|
||||
Ok(self.take_split(self.input_len()))
|
||||
}
|
||||
@@ -398,7 +398,7 @@ pub(crate) fn convert_error<'a, I: Into<CustomError<&'a str>>>(
|
||||
impl<'s> From<CustomError<OrgSource<'s>>> for CustomError<&'s str> {
|
||||
fn from(value: CustomError<OrgSource<'s>>) -> Self {
|
||||
match value {
|
||||
CustomError::MyError(err) => CustomError::MyError(err.into()),
|
||||
CustomError::MyError(err) => CustomError::MyError(err),
|
||||
CustomError::Nom(input, error_kind) => CustomError::Nom(input.into(), error_kind),
|
||||
CustomError::IO(err) => CustomError::IO(err),
|
||||
CustomError::BoxedError(err) => CustomError::BoxedError(err),
|
||||
|
||||
Reference in New Issue
Block a user