mirror of
https://github.com/actix/examples
synced 2025-02-22 09:13:17 +01:00
chore: address clippy warnings
This commit is contained in:
parent
bb18fd8f66
commit
34ab565683
@ -22,7 +22,7 @@ pub struct Human<'a>(&'a StarWarsChar);
|
||||
|
||||
/// A humanoid creature in the Star Wars universe.
|
||||
#[Object]
|
||||
impl<'a> Human<'a> {
|
||||
impl Human<'_> {
|
||||
/// The id of the human.
|
||||
async fn id(&self) -> &str {
|
||||
self.0.id
|
||||
@ -63,7 +63,7 @@ pub struct Droid<'a>(&'a StarWarsChar);
|
||||
|
||||
/// A mechanical creature in the Star Wars universe.
|
||||
#[Object]
|
||||
impl<'a> Droid<'a> {
|
||||
impl Droid<'_> {
|
||||
/// The id of the droid.
|
||||
async fn id(&self) -> &str {
|
||||
self.0.id
|
||||
|
@ -17,7 +17,7 @@ mod v1 {
|
||||
ctx.head()
|
||||
.headers()
|
||||
.get("Accept-Version")
|
||||
.map_or(false, |hv| hv.as_bytes() == b"1")
|
||||
.is_some_and(|hv| hv.as_bytes() == b"1")
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ mod v2 {
|
||||
ctx.head()
|
||||
.headers()
|
||||
.get("Accept-Version")
|
||||
.map_or(false, |hv| hv.as_bytes() == b"2")
|
||||
.is_some_and(|hv| hv.as_bytes() == b"2")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ async fn main() -> std::io::Result<()> {
|
||||
Either::Left(srv.call(sreq).map(|res| res))
|
||||
} else {
|
||||
println!("An http request has arrived here, i will redirect it to use https");
|
||||
return Either::Right(future::ready(Ok(sreq.into_response(
|
||||
Either::Right(future::ready(Ok(sreq.into_response(
|
||||
HttpResponse::MovedPermanently()
|
||||
.append_header((http::header::LOCATION, url))
|
||||
.finish(),
|
||||
))));
|
||||
))))
|
||||
}
|
||||
})
|
||||
.service(index)
|
||||
|
@ -10,7 +10,7 @@ use rand::{rngs::ThreadRng, Rng};
|
||||
use crate::session;
|
||||
|
||||
/// Message for chat server communications
|
||||
|
||||
///
|
||||
/// New chat session is created
|
||||
#[derive(Message)]
|
||||
#[rtype(usize)]
|
||||
|
@ -19,7 +19,7 @@ use rand::{rngs::ThreadRng, Rng};
|
||||
pub struct Message(pub String);
|
||||
|
||||
/// Message for chat server communications
|
||||
|
||||
///
|
||||
/// New chat session is created
|
||||
#[derive(Message)]
|
||||
#[rtype(usize)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user