Skip to content

Commit cfa8939

Browse files
committed
Make clippy happy
Signed-off-by: Sumera Priyadarsini <[email protected]>
1 parent adb9f97 commit cfa8939

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/error.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ pub struct Error {
158158
/// Current character
159159
character: Option<char>,
160160
/// Type of error
161-
error: ErrorType,
161+
err_type: ErrorType,
162162
}
163163

164164
impl Error {
165-
pub(crate) fn new(index: usize, character: Option<char>, error: ErrorType) -> Self {
165+
pub(crate) fn new(index: usize, character: Option<char>, err_type: ErrorType) -> Self {
166166
Self {
167167
index,
168168
character,
169-
error,
169+
err_type,
170170
}
171171
}
172172
pub(crate) fn new_c(index: usize, character: char, error: ErrorType) -> Self {
@@ -179,7 +179,7 @@ impl Error {
179179
Self {
180180
index: 0,
181181
character: None,
182-
error: t,
182+
err_type: t,
183183
}
184184
}
185185

@@ -198,7 +198,7 @@ impl Error {
198198
/// Returns the type of error that occurred.
199199
#[must_use]
200200
pub fn error(&self) -> &ErrorType {
201-
&self.error
201+
&self.err_type
202202
}
203203

204204
// These make it a bit easier to fit into a serde_json context
@@ -209,7 +209,7 @@ impl Error {
209209
#[must_use]
210210
pub fn is_io(&self) -> bool {
211211
// We have to include InternalError _somewhere_
212-
match &self.error {
212+
match &self.err_type {
213213
ErrorType::Io(_) | ErrorType::InputTooLarge => true,
214214
ErrorType::InternalError(e) if !matches!(e, crate::InternalError::TapeError) => true,
215215
_ => false,
@@ -219,7 +219,7 @@ impl Error {
219219
/// Indicates if the error that occurred was an early EOF
220220
#[must_use]
221221
pub fn is_eof(&self) -> bool {
222-
matches!(self.error, ErrorType::Eof)
222+
matches!(self.err_type, ErrorType::Eof)
223223
}
224224

225225
/// Indicates if the error that occurred was due to a data shape error
@@ -234,7 +234,7 @@ impl Error {
234234
pub fn is_syntax(&self) -> bool {
235235
// Lazy? maybe but if it aint something else...
236236
matches!(
237-
self.error,
237+
self.err_type,
238238
ErrorType::InternalError(crate::InternalError::TapeError) | //This seems to get thrown on some syntax errors
239239
ErrorType::BadKeyType |
240240
ErrorType::ExpectedArrayComma |
@@ -268,9 +268,9 @@ impl std::error::Error for Error {}
268268
impl fmt::Display for Error {
269269
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
270270
if let Some(c) = self.character {
271-
write!(f, "{:?} at character {} ('{c}')", self.error, self.index)
271+
write!(f, "{:?} at character {} ('{c}')", self.err_type, self.index)
272272
} else {
273-
write!(f, "{:?} at character {}", self.error, self.index)
273+
write!(f, "{:?} at character {}", self.err_type, self.index)
274274
}
275275
}
276276
}

src/impls/avx2/deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub(crate) unsafe fn parse_str<'invoke, 'de>(
157157

158158
if o == 0 {
159159
return Err(Deserializer::error_c(src_i, 'u', InvalidUnicodeCodepoint));
160-
};
160+
}
161161
// We moved o steps forward at the destination and 6 on the source
162162
src_i += s;
163163
dst_i += o;

src/impls/sse42/deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub(crate) unsafe fn parse_str<'invoke, 'de>(
148148
};
149149
if o == 0 {
150150
return Err(Deserializer::error_c(src_i, 'u', InvalidUnicodeCodepoint));
151-
};
151+
}
152152
// We moved o steps forward at the destination and 6 on the source
153153
src_i += s;
154154
dst_i += o;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ impl<'de> Deserializer<'de> {
916916
// expensive carryless multiply in the previous step with this work
917917
let mut structurals: u64 = 0;
918918

919-
let lenminus64: usize = if len < 64 { 0 } else { len - 64 };
919+
let lenminus64: usize = len.saturating_sub(64);
920920
let mut idx: usize = 0;
921921
let mut error_mask: u64 = 0; // for unescaped characters within strings (ASCII code points < 0x20)
922922

0 commit comments

Comments
 (0)