mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-30 08:24:28 +02:00
clippy
This commit is contained in:
@ -125,7 +125,7 @@ impl<T: ResourcePath> Path<T> {
|
||||
for (seg_name, val) in self.segments.iter() {
|
||||
if name == seg_name {
|
||||
return match val {
|
||||
PathItem::Static(ref s) => Some(&s),
|
||||
PathItem::Static(ref s) => Some(s),
|
||||
PathItem::Segment(s, e) => {
|
||||
Some(&self.path.path()[(*s as usize)..(*e as usize)])
|
||||
}
|
||||
@ -183,7 +183,7 @@ impl<'a, T: ResourcePath> Iterator for PathIter<'a, T> {
|
||||
if self.idx < self.params.segment_count() {
|
||||
let idx = self.idx;
|
||||
let res = match self.params.segments[idx].1 {
|
||||
PathItem::Static(ref s) => &s,
|
||||
PathItem::Static(ref s) => s,
|
||||
PathItem::Segment(s, e) => &self.params.path.path()[(s as usize)..(e as usize)],
|
||||
};
|
||||
self.idx += 1;
|
||||
@ -207,7 +207,7 @@ impl<T: ResourcePath> Index<usize> for Path<T> {
|
||||
|
||||
fn index(&self, idx: usize) -> &str {
|
||||
match self.segments[idx].1 {
|
||||
PathItem::Static(ref s) => &s,
|
||||
PathItem::Static(ref s) => s,
|
||||
PathItem::Segment(s, e) => &self.path.path()[(s as usize)..(e as usize)],
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ impl ResourceDef {
|
||||
let mut pattern_data = Vec::new();
|
||||
|
||||
for pattern in &patterns {
|
||||
match ResourceDef::parse(&pattern, false, true) {
|
||||
match ResourceDef::parse(pattern, false, true) {
|
||||
(PatternType::Dynamic(re, names), _) => {
|
||||
re_set.push(re.as_str().to_owned());
|
||||
pattern_data.push((re, names));
|
||||
@ -790,7 +790,7 @@ impl ResourceDef {
|
||||
profile_section!(pattern_dynamic_extract_captures);
|
||||
|
||||
for (no, name) in names.iter().enumerate() {
|
||||
if let Some(m) = captures.name(&name) {
|
||||
if let Some(m) = captures.name(name) {
|
||||
segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16);
|
||||
} else {
|
||||
log::error!(
|
||||
@ -820,7 +820,7 @@ impl ResourceDef {
|
||||
};
|
||||
|
||||
for (no, name) in names.iter().enumerate() {
|
||||
if let Some(m) = captures.name(&name) {
|
||||
if let Some(m) = captures.name(name) {
|
||||
segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16);
|
||||
} else {
|
||||
log::error!("Dynamic path match but not all segments found: {}", name);
|
||||
|
Reference in New Issue
Block a user