mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-29 07:48:39 +01:00
Fix clippy lints
This commit is contained in:
parent
21475f94ff
commit
36f24990c8
5 changed files with 11 additions and 11 deletions
|
@ -365,7 +365,7 @@ fn check_future_send(item_fn: &ItemFn) -> TokenStream {
|
||||||
match &item_fn.sig.output {
|
match &item_fn.sig.output {
|
||||||
syn::ReturnType::Default => {
|
syn::ReturnType::Default => {
|
||||||
return syn::Error::new_spanned(
|
return syn::Error::new_spanned(
|
||||||
&item_fn.sig.fn_token,
|
item_fn.sig.fn_token,
|
||||||
"Handlers must be `async fn`s",
|
"Handlers must be `async fn`s",
|
||||||
)
|
)
|
||||||
.into_compile_error();
|
.into_compile_error();
|
||||||
|
|
|
@ -162,19 +162,19 @@ impl BenchmarkBuilder {
|
||||||
cmd.arg("--host");
|
cmd.arg("--host");
|
||||||
cmd.arg(format!("http://{}{}", addr, self.path.unwrap_or("")));
|
cmd.arg(format!("http://{}{}", addr, self.path.unwrap_or("")));
|
||||||
|
|
||||||
cmd.args(&["--connections", "10"]);
|
cmd.args(["--connections", "10"]);
|
||||||
cmd.args(&["--threads", "10"]);
|
cmd.args(["--threads", "10"]);
|
||||||
|
|
||||||
if on_ci() {
|
if on_ci() {
|
||||||
// don't slow down CI by running the benchmarks for too long
|
// don't slow down CI by running the benchmarks for too long
|
||||||
// but do run them for a bit
|
// but do run them for a bit
|
||||||
cmd.args(&["--duration", "1s"]);
|
cmd.args(["--duration", "1s"]);
|
||||||
} else {
|
} else {
|
||||||
cmd.args(&["--duration", "10s"]);
|
cmd.args(["--duration", "10s"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(method) = self.method {
|
if let Some(method) = self.method {
|
||||||
cmd.args(&["--method", method]);
|
cmd.args(["--method", method]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (key, value) in self.headers.into_iter().flatten() {
|
for (key, value) in self.headers.into_iter().flatten() {
|
||||||
|
@ -183,7 +183,7 @@ impl BenchmarkBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(body) = self.body {
|
if let Some(body) = self.body {
|
||||||
cmd.args(&["--body", body]);
|
cmd.args(["--body", body]);
|
||||||
}
|
}
|
||||||
|
|
||||||
eprintln!("Running {:?} benchmark", self.name);
|
eprintln!("Running {:?} benchmark", self.name);
|
||||||
|
@ -209,7 +209,7 @@ impl BenchmarkBuilder {
|
||||||
fn install_rewrk() {
|
fn install_rewrk() {
|
||||||
println!("installing rewrk");
|
println!("installing rewrk");
|
||||||
let mut cmd = Command::new("cargo");
|
let mut cmd = Command::new("cargo");
|
||||||
cmd.args(&[
|
cmd.args([
|
||||||
"install",
|
"install",
|
||||||
"rewrk",
|
"rewrk",
|
||||||
"--git",
|
"--git",
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub struct MatchedPath(pub(crate) Arc<str>);
|
||||||
impl MatchedPath {
|
impl MatchedPath {
|
||||||
/// Returns a `str` representation of the path.
|
/// Returns a `str` representation of the path.
|
||||||
pub fn as_str(&self) -> &str {
|
pub fn as_str(&self) -> &str {
|
||||||
&*self.0
|
&self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ fn sign(key: &[u8]) -> HeaderValue {
|
||||||
let mut sha1 = Sha1::default();
|
let mut sha1 = Sha1::default();
|
||||||
sha1.update(key);
|
sha1.update(key);
|
||||||
sha1.update(&b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"[..]);
|
sha1.update(&b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"[..]);
|
||||||
let b64 = Bytes::from(base64::encode(&sha1.finalize()));
|
let b64 = Bytes::from(base64::encode(sha1.finalize()));
|
||||||
HeaderValue::from_maybe_shared(b64).expect("base64 is a valid value")
|
HeaderValue::from_maybe_shared(b64).expect("base64 is a valid value")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl PercentDecodedStr {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn as_str(&self) -> &str {
|
pub(crate) fn as_str(&self) -> &str {
|
||||||
&*self.0
|
&self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn into_inner(self) -> Arc<str> {
|
pub(crate) fn into_inner(self) -> Arc<str> {
|
||||||
|
|
Loading…
Reference in a new issue