Remove unused code

This commit is contained in:
Nikolay Kim 2022-02-03 16:35:25 +06:00
parent 6b35f10c2f
commit 961591d77f
3 changed files with 15 additions and 19 deletions

View file

@ -500,6 +500,18 @@ mod tests {
tree.insert(&ResourceDef::new("/name/"), 2);
assert_eq!(tree.find(&mut Path::new("/name")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/")), Some(2));
let mut tree = Tree::new(&ResourceDef::new(""), 1);
tree.insert(&ResourceDef::new("/test/index.html"), 2);
assert_eq!(tree.find_checked(&mut Path::new(""), &|_, _| true), Some(1));
assert_eq!(
tree.find_checked(&mut Path::new("index.html"), &|_, _| true),
None
);
assert_eq!(
tree.find_checked(&mut Path::new("test/index.html"), &|_, _| true),
Some(2)
);
}
#[test]

View file

@ -247,23 +247,7 @@ impl Tree {
return Some(v);
}
}
Item::Subtree(ref tree) => {
let result = tree.find_inner_wrapped(
"",
resource,
check,
1,
&mut segments,
insensitive,
base_skip,
);
if let Some((val, skip)) = result {
let path = resource.resource_path();
path.segments = segments;
path.skip += skip as u16;
return Some(val);
}
}
_ => continue,
}
}
} else {

View file

@ -446,11 +446,11 @@ where
}
// stop io tasks and call upgrade service
State::Upgrade(ref mut req) => {
log::trace!("switching to upgrade service");
let io = this.inner.io.take();
let req = req.take().unwrap();
log::trace!("switching to upgrade service for {:?}", req);
// Handle UPGRADE request
crate::rt::spawn(this.inner.config.upgrade.as_ref().unwrap().call((
req,