mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-23 07:39:25 +01:00
Use .to_owned() instead of .to_string() to turn &str into String (#548)
This commit is contained in:
parent
ab9f1ef993
commit
69fee5864d
6 changed files with 8 additions and 5 deletions
|
@ -109,6 +109,7 @@
|
|||
clippy::option_option,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::str_to_string,
|
||||
rust_2018_idioms,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
clippy::option_option,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::str_to_string,
|
||||
rust_2018_idioms,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<B: Send + 'static> Resource<B> {
|
|||
/// All routes will be nested at `/{resource_name}`.
|
||||
pub fn named(resource_name: &str) -> Self {
|
||||
Self {
|
||||
name: resource_name.to_string(),
|
||||
name: resource_name.to_owned(),
|
||||
router: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ where
|
|||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
||||
let query = req.uri().query().map(|query| query.to_string());
|
||||
let query = req.uri().query().map(|query| query.to_owned());
|
||||
Ok(Self(query))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,6 +360,7 @@
|
|||
clippy::option_option,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::str_to_string,
|
||||
rust_2018_idioms,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
|
|
|
@ -203,7 +203,7 @@ where
|
|||
for (id, nested_path) in node.route_id_to_path {
|
||||
let route = routes.remove(&id).unwrap();
|
||||
let full_path = if &*nested_path == "/" {
|
||||
path.to_string()
|
||||
path.to_owned()
|
||||
} else {
|
||||
format!("{}{}", path, nested_path)
|
||||
};
|
||||
|
@ -427,7 +427,7 @@ where
|
|||
.params
|
||||
.iter()
|
||||
.filter(|(key, _)| !key.starts_with(NEST_TAIL_PARAM))
|
||||
.map(|(key, value)| (key.to_string(), value.to_string()))
|
||||
.map(|(key, value)| (key.to_owned(), value.to_owned()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
insert_url_params(&mut req, params);
|
||||
|
@ -477,7 +477,7 @@ where
|
|||
req.extensions_mut().insert(original_uri);
|
||||
}
|
||||
|
||||
let path = req.uri().path().to_string();
|
||||
let path = req.uri().path().to_owned();
|
||||
|
||||
match self.node.at(&path) {
|
||||
Ok(match_) => self.call_route(match_, req),
|
||||
|
|
Loading…
Reference in a new issue