mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 01:21:10 +00:00
refactor: address clippy warnings
This commit is contained in:
parent
bb65628de5
commit
c1a6388614
6 changed files with 8 additions and 11 deletions
|
@ -706,7 +706,7 @@ where
|
|||
|
||||
req.head_mut().peer_addr = *this.peer_addr;
|
||||
|
||||
req.conn_data = this.conn_data.clone();
|
||||
req.conn_data.clone_from(this.conn_data);
|
||||
|
||||
match this.codec.message_type() {
|
||||
// request has no payload
|
||||
|
|
|
@ -126,7 +126,7 @@ where
|
|||
head.headers = parts.headers.into();
|
||||
head.peer_addr = this.peer_addr;
|
||||
|
||||
req.conn_data = this.conn_data.clone();
|
||||
req.conn_data.clone_from(&this.conn_data);
|
||||
|
||||
let fut = this.flow.service.call(req);
|
||||
let config = this.config.clone();
|
||||
|
|
|
@ -313,7 +313,8 @@ where
|
|||
let entry = field_limits
|
||||
.entry(field.name().to_owned())
|
||||
.or_insert_with(|| T::limit(field.name()));
|
||||
limits.field_limit_remaining = entry.to_owned();
|
||||
|
||||
limits.field_limit_remaining.clone_from(entry);
|
||||
|
||||
T::handle_field(&req, field, &mut limits, &mut state).await?;
|
||||
|
||||
|
|
|
@ -154,15 +154,11 @@ impl<T: ResourcePath> Path<T> {
|
|||
None
|
||||
}
|
||||
|
||||
/// Get matched parameter by name.
|
||||
/// Returns matched parameter by name.
|
||||
///
|
||||
/// If keyed parameter is not available empty string is used as default value.
|
||||
pub fn query(&self, key: &str) -> &str {
|
||||
if let Some(s) = self.get(key) {
|
||||
s
|
||||
} else {
|
||||
""
|
||||
}
|
||||
self.get(key).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Return iterator to items in parameter container.
|
||||
|
|
|
@ -148,7 +148,7 @@ impl AppConfig {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn set_host(&mut self, host: &str) {
|
||||
self.host = host.to_owned();
|
||||
host.clone_into(&mut self.host);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -771,7 +771,7 @@ mod tests {
|
|||
data3: web::Data<f64>| {
|
||||
assert_eq!(**data1, 10);
|
||||
assert_eq!(**data2, '*');
|
||||
let error = std::f64::EPSILON;
|
||||
let error = f64::EPSILON;
|
||||
assert!((**data3 - 1.0).abs() < error);
|
||||
HttpResponse::Ok()
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue