mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
enable unused_qualifications lint
This commit is contained in:
parent
d7e945f4c5
commit
793d809ac6
7 changed files with 12 additions and 17 deletions
|
|
@ -13,8 +13,7 @@ unused_extern_crates = "warn"
|
||||||
unused_import_braces = "warn"
|
unused_import_braces = "warn"
|
||||||
unused_lifetimes = "warn"
|
unused_lifetimes = "warn"
|
||||||
unused_macro_rules = "warn"
|
unused_macro_rules = "warn"
|
||||||
|
unused_qualifications = "warn"
|
||||||
unused_qualifications = "allow"
|
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
# Groups. Keep alphabetically sorted
|
# Groups. Keep alphabetically sorted
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut http_request =
|
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;
|
*http_request.headers_mut().unwrap() = parts.headers;
|
||||||
|
|
||||||
if let Some(CanonicalJsonValue::Object(json_body)) = &mut json_body {
|
if let Some(CanonicalJsonValue::Object(json_body)) = &mut json_body {
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ impl KeyValueDatabase {
|
||||||
Self::check_db_setup(&config)?;
|
Self::check_db_setup(&config)?;
|
||||||
|
|
||||||
if !Path::new(&config.database_path).exists() {
|
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(
|
Error::BadConfig(
|
||||||
"Database folder doesn't exists and couldn't be created \
|
"Database folder doesn't exists and couldn't be created \
|
||||||
(e.g. due to missing permissions). Please create the \
|
(e.g. due to missing permissions). Please create the \
|
||||||
|
|
@ -1085,8 +1085,7 @@ impl KeyValueDatabase {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let user_default_rules =
|
let user_default_rules = Ruleset::server_default(&user);
|
||||||
ruma::push::Ruleset::server_default(&user);
|
|
||||||
account_data
|
account_data
|
||||||
.content
|
.content
|
||||||
.global
|
.global
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl Watchers {
|
||||||
{
|
{
|
||||||
hash_map::Entry::Occupied(o) => o.get().1.clone(),
|
hash_map::Entry::Occupied(o) => o.get().1.clone(),
|
||||||
hash_map::Entry::Vacant(v) => {
|
hash_map::Entry::Vacant(v) => {
|
||||||
let (tx, rx) = tokio::sync::watch::channel(());
|
let (tx, rx) = watch::channel(());
|
||||||
v.insert((tx, rx.clone()));
|
v.insert((tx, rx.clone()));
|
||||||
rx
|
rx
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ async fn run_server() -> io::Result<()> {
|
||||||
/// The axum request handler task gets cancelled if the connection is shut down;
|
/// The axum request handler task gets cancelled if the connection is shut down;
|
||||||
/// by spawning our own task, processing continue after the client disconnects.
|
/// by spawning our own task, processing continue after the client disconnects.
|
||||||
async fn spawn_task<B: Send + 'static>(
|
async fn spawn_task<B: Send + 'static>(
|
||||||
req: axum::http::Request<B>,
|
req: http::Request<B>,
|
||||||
next: axum::middleware::Next<B>,
|
next: axum::middleware::Next<B>,
|
||||||
) -> std::result::Result<axum::response::Response, StatusCode> {
|
) -> std::result::Result<axum::response::Response, StatusCode> {
|
||||||
if services().globals.shutdown.load(atomic::Ordering::Relaxed) {
|
if services().globals.shutdown.load(atomic::Ordering::Relaxed) {
|
||||||
|
|
@ -284,13 +284,13 @@ async fn spawn_task<B: Send + 'static>(
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn unrecognized_method<B: Send>(
|
async fn unrecognized_method<B: Send>(
|
||||||
req: axum::http::Request<B>,
|
req: http::Request<B>,
|
||||||
next: axum::middleware::Next<B>,
|
next: axum::middleware::Next<B>,
|
||||||
) -> std::result::Result<axum::response::Response, StatusCode> {
|
) -> std::result::Result<axum::response::Response, StatusCode> {
|
||||||
let method = req.method().clone();
|
let method = req.method().clone();
|
||||||
let uri = req.uri().clone();
|
let uri = req.uri().clone();
|
||||||
let inner = next.run(req).await;
|
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}");
|
warn!("Method not allowed: {method} {uri}");
|
||||||
return Ok(Ra(UiaaResponse::MatrixError(RumaError {
|
return Ok(Ra(UiaaResponse::MatrixError(RumaError {
|
||||||
body: ErrorBody::Standard {
|
body: ErrorBody::Standard {
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,7 @@ impl Service {
|
||||||
match join_rule {
|
match join_rule {
|
||||||
JoinRule::Restricted(r) => {
|
JoinRule::Restricted(r) => {
|
||||||
for rule in &r.allow {
|
for rule in &r.allow {
|
||||||
if let join_rules::AllowRule::RoomMembership(rm) = rule {
|
if let AllowRule::RoomMembership(rm) = rule {
|
||||||
if let Ok(true) = services()
|
if let Ok(true) = services()
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
|
|
|
||||||
|
|
@ -145,20 +145,17 @@ pub(crate) fn deserialize_from_str<
|
||||||
'de,
|
'de,
|
||||||
D: serde::de::Deserializer<'de>,
|
D: serde::de::Deserializer<'de>,
|
||||||
T: FromStr<Err = E>,
|
T: FromStr<Err = E>,
|
||||||
E: std::fmt::Display,
|
E: fmt::Display,
|
||||||
>(
|
>(
|
||||||
deserializer: D,
|
deserializer: D,
|
||||||
) -> Result<T, D::Error> {
|
) -> Result<T, D::Error> {
|
||||||
struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>);
|
struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>);
|
||||||
impl<T: FromStr<Err = Err>, Err: std::fmt::Display> serde::de::Visitor<'_>
|
impl<T: FromStr<Err = Err>, Err: fmt::Display> serde::de::Visitor<'_>
|
||||||
for Visitor<T, Err>
|
for Visitor<T, Err>
|
||||||
{
|
{
|
||||||
type Value = T;
|
type Value = T;
|
||||||
|
|
||||||
fn expecting(
|
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
&self,
|
|
||||||
formatter: &mut std::fmt::Formatter<'_>,
|
|
||||||
) -> std::fmt::Result {
|
|
||||||
write!(formatter, "a parsable string")
|
write!(formatter, "a parsable string")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue