mirror of https://github.com/fafhrd91/actix-net
Clippy
This commit is contained in:
parent
ac4fddc219
commit
645eabc8d9
|
@ -125,7 +125,7 @@ impl<T: ResourcePath> Path<T> {
|
||||||
for (seg_name, val) in self.segments.iter() {
|
for (seg_name, val) in self.segments.iter() {
|
||||||
if name == seg_name {
|
if name == seg_name {
|
||||||
return match val {
|
return match val {
|
||||||
PathItem::Static(ref s) => Some(&s),
|
PathItem::Static(ref s) => Some(s),
|
||||||
PathItem::Segment(s, e) => {
|
PathItem::Segment(s, e) => {
|
||||||
Some(&self.path.path()[(*s as usize)..(*e as usize)])
|
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() {
|
if self.idx < self.params.segment_count() {
|
||||||
let idx = self.idx;
|
let idx = self.idx;
|
||||||
let res = match self.params.segments[idx].1 {
|
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)],
|
PathItem::Segment(s, e) => &self.params.path.path()[(s as usize)..(e as usize)],
|
||||||
};
|
};
|
||||||
self.idx += 1;
|
self.idx += 1;
|
||||||
|
@ -207,7 +207,7 @@ impl<T: ResourcePath> Index<usize> for Path<T> {
|
||||||
|
|
||||||
fn index(&self, idx: usize) -> &str {
|
fn index(&self, idx: usize) -> &str {
|
||||||
match self.segments[idx].1 {
|
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)],
|
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();
|
let mut pattern_data = Vec::new();
|
||||||
|
|
||||||
for pattern in &patterns {
|
for pattern in &patterns {
|
||||||
match ResourceDef::parse(&pattern, false, true) {
|
match ResourceDef::parse(pattern, false, true) {
|
||||||
(PatternType::Dynamic(re, names), _) => {
|
(PatternType::Dynamic(re, names), _) => {
|
||||||
re_set.push(re.as_str().to_owned());
|
re_set.push(re.as_str().to_owned());
|
||||||
pattern_data.push((re, names));
|
pattern_data.push((re, names));
|
||||||
|
@ -790,7 +790,7 @@ impl ResourceDef {
|
||||||
profile_section!(pattern_dynamic_extract_captures);
|
profile_section!(pattern_dynamic_extract_captures);
|
||||||
|
|
||||||
for (no, name) in names.iter().enumerate() {
|
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);
|
segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16);
|
||||||
} else {
|
} else {
|
||||||
log::error!(
|
log::error!(
|
||||||
|
@ -820,7 +820,7 @@ impl ResourceDef {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (no, name) in names.iter().enumerate() {
|
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);
|
segments[no] = PathItem::Segment(m.start() as u16, m.end() as u16);
|
||||||
} else {
|
} else {
|
||||||
log::error!("Dynamic path match but not all segments found: {}", name);
|
log::error!("Dynamic path match but not all segments found: {}", name);
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub trait Address: Unpin + 'static {
|
||||||
|
|
||||||
impl Address for String {
|
impl Address for String {
|
||||||
fn hostname(&self) -> &str {
|
fn hostname(&self) -> &str {
|
||||||
&self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ impl<T: Address> Service<Connect<T>> for Resolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::Custom(resolver) => {
|
Self::Custom(resolver) => {
|
||||||
let resolver = Rc::clone(&resolver);
|
let resolver = Rc::clone(resolver);
|
||||||
ResolverFuture::LookupCustom(Box::pin(async move {
|
ResolverFuture::LookupCustom(Box::pin(async move {
|
||||||
let addrs = resolver
|
let addrs = resolver
|
||||||
.lookup(req.hostname(), req.port())
|
.lookup(req.hostname(), req.port())
|
||||||
|
|
Loading…
Reference in New Issue