diff --git a/Cargo.toml b/Cargo.toml index f6de029b..ab21dec0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,7 @@ unused_extern_crates = "warn" unused_import_braces = "warn" unused_lifetimes = "warn" unused_macro_rules = "warn" - -unused_qualifications = "allow" +unused_qualifications = "warn" [workspace.lints.clippy] # Groups. Keep alphabetically sorted diff --git a/src/api/ruma_wrapper/axum.rs b/src/api/ruma_wrapper/axum.rs index f55ffd85..8dd997e4 100644 --- a/src/api/ruma_wrapper/axum.rs +++ b/src/api/ruma_wrapper/axum.rs @@ -326,7 +326,7 @@ where }; let mut http_request = - http::Request::builder().uri(parts.uri).method(parts.method); + Request::builder().uri(parts.uri).method(parts.method); *http_request.headers_mut().unwrap() = parts.headers; if let Some(CanonicalJsonValue::Object(json_body)) = &mut json_body { diff --git a/src/database.rs b/src/database.rs index 698b67eb..4904ffd7 100644 --- a/src/database.rs +++ b/src/database.rs @@ -305,7 +305,7 @@ impl KeyValueDatabase { Self::check_db_setup(&config)?; if !Path::new(&config.database_path).exists() { - std::fs::create_dir_all(&config.database_path).map_err(|_| { + fs::create_dir_all(&config.database_path).map_err(|_| { Error::BadConfig( "Database folder doesn't exists and couldn't be created \ (e.g. due to missing permissions). Please create the \ @@ -1085,8 +1085,7 @@ impl KeyValueDatabase { ) .unwrap(); - let user_default_rules = - ruma::push::Ruleset::server_default(&user); + let user_default_rules = Ruleset::server_default(&user); account_data .content .global diff --git a/src/database/abstraction/watchers.rs b/src/database/abstraction/watchers.rs index 9f6e5a00..b31bd082 100644 --- a/src/database/abstraction/watchers.rs +++ b/src/database/abstraction/watchers.rs @@ -23,7 +23,7 @@ impl Watchers { { hash_map::Entry::Occupied(o) => o.get().1.clone(), hash_map::Entry::Vacant(v) => { - let (tx, rx) = tokio::sync::watch::channel(()); + let (tx, rx) = watch::channel(()); v.insert((tx, rx.clone())); rx } diff --git a/src/main.rs b/src/main.rs index b9d165be..799727da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -272,7 +272,7 @@ async fn run_server() -> io::Result<()> { /// The axum request handler task gets cancelled if the connection is shut down; /// by spawning our own task, processing continue after the client disconnects. async fn spawn_task( - req: axum::http::Request, + req: http::Request, next: axum::middleware::Next, ) -> std::result::Result { if services().globals.shutdown.load(atomic::Ordering::Relaxed) { @@ -284,13 +284,13 @@ async fn spawn_task( } async fn unrecognized_method( - req: axum::http::Request, + req: http::Request, next: axum::middleware::Next, ) -> std::result::Result { let method = req.method().clone(); let uri = req.uri().clone(); let inner = next.run(req).await; - if inner.status() == axum::http::StatusCode::METHOD_NOT_ALLOWED { + if inner.status() == StatusCode::METHOD_NOT_ALLOWED { warn!("Method not allowed: {method} {uri}"); return Ok(Ra(UiaaResponse::MatrixError(RumaError { body: ErrorBody::Standard { diff --git a/src/service/rooms/spaces.rs b/src/service/rooms/spaces.rs index 6dccafed..da54bed9 100644 --- a/src/service/rooms/spaces.rs +++ b/src/service/rooms/spaces.rs @@ -545,7 +545,7 @@ impl Service { match join_rule { JoinRule::Restricted(r) => { for rule in &r.allow { - if let join_rules::AllowRule::RoomMembership(rm) = rule { + if let AllowRule::RoomMembership(rm) = rule { if let Ok(true) = services() .rooms .state_cache diff --git a/src/utils.rs b/src/utils.rs index 9db1f035..0c8418a8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -145,20 +145,17 @@ pub(crate) fn deserialize_from_str< 'de, D: serde::de::Deserializer<'de>, T: FromStr, - E: std::fmt::Display, + E: fmt::Display, >( deserializer: D, ) -> Result { struct Visitor, E>(std::marker::PhantomData); - impl, Err: std::fmt::Display> serde::de::Visitor<'_> + impl, Err: fmt::Display> serde::de::Visitor<'_> for Visitor { type Value = T; - fn expecting( - &self, - formatter: &mut std::fmt::Formatter<'_>, - ) -> std::fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { write!(formatter, "a parsable string") }