Skip to content

Commit 5c10696

Browse files
committed
clippy
1 parent 6deb16c commit 5c10696

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl<T> PathTree<T> {
209209

210210
/// Returns the [`Path`] by the given path.
211211
#[must_use]
212-
pub fn find<'a, 'b>(&'a self, path: &'b str) -> Option<(&T, Path<'a, 'b>)> {
212+
pub fn find<'a, 'b>(&'a self, path: &'b str) -> Option<(&'a T, Path<'a, 'b>)> {
213213
let bytes = path.as_bytes();
214214
self.node.find(bytes).and_then(|(id, ranges)| {
215215
self.routes.get(*id).map(|(value, pieces)| {
@@ -281,7 +281,7 @@ pub struct Path<'a, 'b> {
281281
pub raws: SmallVec<[&'b str; 4]>,
282282
}
283283

284-
impl<'a, 'b> Path<'a, 'b> {
284+
impl Path<'_, '_> {
285285
/// Gets current path pattern.
286286
///
287287
/// # Panics

src/node.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ impl<T: fmt::Debug> Node<T> {
205205

206206
// last
207207
if self.nodes0.is_none() && self.nodes1.is_none() {
208-
return self.value.as_ref().map(|id| {
208+
return self.value.as_ref().inspect(|_| {
209209
ranges.push(start..start);
210-
id
211210
});
212211
}
213212
} else {
@@ -231,10 +230,11 @@ impl<T: fmt::Debug> Node<T> {
231230
.enumerate()
232231
.filter_map(|(n, b)| (s[0] == *b).then_some(n))
233232
.find_map(|n| {
234-
node._find(start + n, &bytes[n..], ranges).map(|id| {
235-
ranges.push(start..start + n);
236-
id
237-
})
233+
node._find(start + n, &bytes[n..], ranges).inspect(
234+
|_| {
235+
ranges.push(start..start + n);
236+
},
237+
)
238238
})
239239
}
240240
Key::Parameter(_) => unreachable!(),
@@ -318,9 +318,8 @@ impl<T: fmt::Debug> Node<T> {
318318
}
319319

320320
if self.nodes0.is_none() && self.nodes1.is_none() {
321-
return self.value.as_ref().map(|id| {
321+
return self.value.as_ref().inspect(|_| {
322322
ranges.push(start..start);
323-
id
324323
});
325324
}
326325
} else {
@@ -346,10 +345,9 @@ impl<T: fmt::Debug> Node<T> {
346345
.enumerate()
347346
.filter_map(|(n, b)| (s[0] == *b).then_some(n))
348347
.find_map(|n| {
349-
node._find(start + n, &bytes[n..], ranges).map(
350-
|id| {
348+
node._find(start + n, &bytes[n..], ranges).inspect(
349+
|_| {
351350
ranges.push(start..start + n);
352-
id
353351
},
354352
)
355353
});
@@ -385,7 +383,7 @@ impl<T: fmt::Debug> Node<T> {
385383

386384
pub fn find(&self, bytes: &[u8]) -> Option<(&T, SmallVec<[Range<usize>; 8]>)> {
387385
let mut ranges = SmallVec::<[Range<usize>; 8]>::new_const(); // opt!
388-
return self._find(0, bytes, &mut ranges).map(|t| (t, ranges));
386+
self._find(0, bytes, &mut ranges).map(|t| (t, ranges))
389387
}
390388
}
391389

src/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a> Parser<'a> {
142142
}
143143
}
144144

145-
impl<'a> Iterator for Parser<'a> {
145+
impl Iterator for Parser<'_> {
146146
type Item = Piece;
147147

148148
fn next(&mut self) -> Option<Self::Item> {

0 commit comments

Comments
 (0)