mirror of
https://github.com/actix/examples
synced 2025-02-22 17:23:18 +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.
|
/// A humanoid creature in the Star Wars universe.
|
||||||
#[Object]
|
#[Object]
|
||||||
impl<'a> Human<'a> {
|
impl Human<'_> {
|
||||||
/// The id of the human.
|
/// The id of the human.
|
||||||
async fn id(&self) -> &str {
|
async fn id(&self) -> &str {
|
||||||
self.0.id
|
self.0.id
|
||||||
@ -63,7 +63,7 @@ pub struct Droid<'a>(&'a StarWarsChar);
|
|||||||
|
|
||||||
/// A mechanical creature in the Star Wars universe.
|
/// A mechanical creature in the Star Wars universe.
|
||||||
#[Object]
|
#[Object]
|
||||||
impl<'a> Droid<'a> {
|
impl Droid<'_> {
|
||||||
/// The id of the droid.
|
/// The id of the droid.
|
||||||
async fn id(&self) -> &str {
|
async fn id(&self) -> &str {
|
||||||
self.0.id
|
self.0.id
|
||||||
|
@ -17,7 +17,7 @@ mod v1 {
|
|||||||
ctx.head()
|
ctx.head()
|
||||||
.headers()
|
.headers()
|
||||||
.get("Accept-Version")
|
.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()
|
ctx.head()
|
||||||
.headers()
|
.headers()
|
||||||
.get("Accept-Version")
|
.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))
|
Either::Left(srv.call(sreq).map(|res| res))
|
||||||
} else {
|
} else {
|
||||||
println!("An http request has arrived here, i will redirect it to use https");
|
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()
|
HttpResponse::MovedPermanently()
|
||||||
.append_header((http::header::LOCATION, url))
|
.append_header((http::header::LOCATION, url))
|
||||||
.finish(),
|
.finish(),
|
||||||
))));
|
))))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.service(index)
|
.service(index)
|
||||||
|
@ -10,7 +10,7 @@ use rand::{rngs::ThreadRng, Rng};
|
|||||||
use crate::session;
|
use crate::session;
|
||||||
|
|
||||||
/// Message for chat server communications
|
/// Message for chat server communications
|
||||||
|
///
|
||||||
/// New chat session is created
|
/// New chat session is created
|
||||||
#[derive(Message)]
|
#[derive(Message)]
|
||||||
#[rtype(usize)]
|
#[rtype(usize)]
|
||||||
|
@ -19,7 +19,7 @@ use rand::{rngs::ThreadRng, Rng};
|
|||||||
pub struct Message(pub String);
|
pub struct Message(pub String);
|
||||||
|
|
||||||
/// Message for chat server communications
|
/// Message for chat server communications
|
||||||
|
///
|
||||||
/// New chat session is created
|
/// New chat session is created
|
||||||
#[derive(Message)]
|
#[derive(Message)]
|
||||||
#[rtype(usize)]
|
#[rtype(usize)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user