This commit is contained in:
Nikolay Kim 2021-08-14 19:52:36 +06:00
parent 73c172400c
commit e57b712f7b
11 changed files with 19 additions and 19 deletions

View file

@ -122,7 +122,7 @@ impl<T: ResourcePath> Path<T> {
for item in self.segments.iter() {
if key == item.0 {
return match item.1 {
PathItem::Static(ref s) => Some(&s),
PathItem::Static(s) => Some(s),
PathItem::Segment(ref s) => Some(s),
PathItem::IdxSegment(s, e) => {
Some(&self.path.path()[(s as usize)..(e as usize)])
@ -192,7 +192,7 @@ impl<'a, T: ResourcePath> Iterator for PathIter<'a, T> {
}
};
self.idx += 1;
return Some((&self.params.segments[idx].0, res));
return Some((self.params.segments[idx].0, res));
}
None
}
@ -212,8 +212,8 @@ 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::Segment(ref s) => &s,
PathItem::Static(s) => s,
PathItem::Segment(ref s) => s,
PathItem::IdxSegment(s, e) => &self.path.path()[(s as usize)..(e as usize)],
}
}

View file

@ -260,7 +260,7 @@ impl ResourceDef {
}
let p = pattern.split_at(start_idx);
pattern = p.1;
re.push_str(&escape(&p.0));
re.push_str(&escape(p.0));
elems.push(PathElement::Str(p.0.to_string()));
// find closing }

View file

@ -447,7 +447,7 @@ impl Tree {
if let Some(captures) = pattern.captures(seg) {
let mut is_match = true;
for name in names.iter() {
if let Some(m) = captures.name(&name) {
if let Some(m) = captures.name(name) {
let item = if quoted {
PathItem::Segment(m.as_str().to_string())
} else {