Skip to content

Commit b487e6a

Browse files
clippy: fix warnings
1 parent 5028da8 commit b487e6a

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ criterion = "0.5"
3535
[[bench]]
3636
name = "bench"
3737
harness = false
38+
39+
[lints.clippy]
40+
result_large_err = "allow"

src/ecma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use regex_syntax::ast::{self, *};
55

66
// covert ecma regex to rust regex if possible
77
// see https://262.ecma-international.org/11.0/#sec-regexp-regular-expression-objects
8-
pub(crate) fn convert(pattern: &str) -> Result<Cow<str>, Box<dyn std::error::Error>> {
8+
pub(crate) fn convert(pattern: &str) -> Result<Cow<'_, str>, Box<dyn std::error::Error>> {
99
let mut pattern = Cow::Borrowed(pattern);
1010

1111
let mut ast = loop {

src/output.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'s> ValidationError<'s, '_> {
3535
}
3636

3737
/// The `Basic` structure, a flat list of output units.
38-
pub fn basic_output(&self) -> OutputUnit {
38+
pub fn basic_output(&self) -> OutputUnit<'_, '_, '_> {
3939
let mut outputs = vec![];
4040

4141
let mut in_ref = InRef::default();
@@ -86,7 +86,7 @@ impl<'s> ValidationError<'s, '_> {
8686
}
8787

8888
/// The `Detailed` structure, based on the schema.
89-
pub fn detailed_output(&self) -> OutputUnit {
89+
pub fn detailed_output(&self) -> OutputUnit<'_, '_, '_> {
9090
let mut root = None;
9191
let mut stack: Vec<OutputUnit> = vec![];
9292

src/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::CompileError;
1818
pub(crate) struct JsonPointer(pub(crate) String);
1919

2020
impl JsonPointer {
21-
pub(crate) fn escape(token: &str) -> Cow<str> {
21+
pub(crate) fn escape(token: &str) -> Cow<'_, str> {
2222
const SPECIAL: [char; 2] = ['~', '/'];
2323
if token.contains(SPECIAL) {
2424
token.replace('~', "~0").replace('/', "~1").into()
@@ -27,7 +27,7 @@ impl JsonPointer {
2727
}
2828
}
2929

30-
pub(crate) fn unescape(mut tok: &str) -> Result<Cow<str>, ()> {
30+
pub(crate) fn unescape(mut tok: &str) -> Result<Cow<'_, str>, ()> {
3131
let Some(mut tilde) = tok.find('~') else {
3232
return Ok(Cow::Borrowed(tok));
3333
};
@@ -332,7 +332,7 @@ where
332332
.join(sep)
333333
}
334334

335-
pub(crate) fn escape(token: &str) -> Cow<str> {
335+
pub(crate) fn escape(token: &str) -> Cow<'_, str> {
336336
JsonPointer::escape(token)
337337
}
338338

src/validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ impl Scope<'_> {
996996
}
997997
}
998998

999-
fn check_cycle(&self) -> Option<&Scope> {
999+
fn check_cycle(&self) -> Option<&Scope<'_>> {
10001000
let mut scope = self.parent;
10011001
while let Some(scp) = scope {
10021002
if scp.vid != self.vid {

tests/examples.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn example_custom_content_encoding() -> Result<(), Box<dyn Error>> {
169169
}
170170
}
171171
fn decode_hex(s: &str) -> Result<Vec<u8>, Box<dyn Error>> {
172-
if s.len() % 2 != 0 {
172+
if !s.len().is_multiple_of(2) {
173173
Err("decode_hex: odd length")?;
174174
}
175175
let mut bytes = s.bytes();

0 commit comments

Comments
 (0)