From: Nutomic Date: Thu, 24 Nov 2022 16:38:00 +0000 (+0000) Subject: Add some more clippy lints (#2586) X-Git-Url: http://these/git/%22%7Burl%7D/%7B%60%24%7BghostArchiveUrl%7D/%7B%60/feeds/inbox/%7BlocalRss%7D?a=commitdiff_plain;h=d39bc14c43d9190c52779128f696c8ee27fb63e4;p=lemmy.git Add some more clippy lints (#2586) * Add some more clippy lints * restore config * no allow dirty Co-authored-by: Dessalines --- diff --git a/.drone.yml b/.drone.yml index aa9d6d3c..34116b56 100644 --- a/.drone.yml +++ b/.drone.yml @@ -32,10 +32,12 @@ steps: - rustup component add clippy - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity + -D clippy::style -D clippy::correctness -D clippy::suspicious -D clippy::dbg_macro -D clippy::inefficient_to_string -D clippy::items-after-statements -D clippy::implicit_clone -D clippy::wildcard_imports -D clippy::cast_lossless - -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls + -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls + -D clippy::unused_self - cargo clippy --workspace --all-features -- -D clippy::unwrap_used - name: cargo test diff --git a/Cargo.toml b/Cargo.toml index 0bca1e64..67e85b27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ description = "A link aggregator for the fediverse" license = "AGPL-3.0" homepage = "https://join-lemmy.org/" documentation = "https://join-lemmy.org/docs/en/index.html" +repository = "https://github.com/LemmyNet/lemmy" [package] name = "lemmy_server" @@ -14,6 +15,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] doctest = false diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index 73f33750..b707545b 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_api" diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 9b34e63a..bfbaa8e2 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_api_common" diff --git a/crates/api_crud/Cargo.toml b/crates/api_crud/Cargo.toml index d37f3d02..b4f68a8d 100644 --- a/crates/api_crud/Cargo.toml +++ b/crates/api_crud/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [dependencies] lemmy_apub = { workspace = true } diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 9cb70bf4..c2a8827e 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_apub" diff --git a/crates/apub/src/http/person.rs b/crates/apub/src/http/person.rs index 1653697b..0ca31bd5 100644 --- a/crates/apub/src/http/person.rs +++ b/crates/apub/src/http/person.rs @@ -58,6 +58,6 @@ pub(crate) async fn get_apub_person_outbox( ) -> Result { let person = Person::read_from_name(context.pool(), &info.user_name, false).await?; let outbox_id = generate_outbox_url(&person.actor_id)?.into(); - let outbox = EmptyOutbox::new(outbox_id).await?; + let outbox = EmptyOutbox::new(outbox_id)?; Ok(create_apub_response(&outbox)) } diff --git a/crates/apub/src/http/site.rs b/crates/apub/src/http/site.rs index 28eef88a..201fc5b3 100644 --- a/crates/apub/src/http/site.rs +++ b/crates/apub/src/http/site.rs @@ -28,7 +28,7 @@ pub(crate) async fn get_apub_site_outbox( "{}/site_outbox", context.settings().get_protocol_and_hostname() ); - let outbox = EmptyOutbox::new(Url::parse(&outbox_id)?).await?; + let outbox = EmptyOutbox::new(Url::parse(&outbox_id)?)?; Ok(create_apub_response(&outbox)) } diff --git a/crates/apub/src/protocol/collections/empty_outbox.rs b/crates/apub/src/protocol/collections/empty_outbox.rs index 8c9cf06e..b4731f31 100644 --- a/crates/apub/src/protocol/collections/empty_outbox.rs +++ b/crates/apub/src/protocol/collections/empty_outbox.rs @@ -14,7 +14,7 @@ pub(crate) struct EmptyOutbox { } impl EmptyOutbox { - pub(crate) async fn new(outbox_id: Url) -> Result { + pub(crate) fn new(outbox_id: Url) -> Result { Ok(EmptyOutbox { r#type: OrderedCollectionType::OrderedCollection, id: outbox_id, diff --git a/crates/db_schema/Cargo.toml b/crates/db_schema/Cargo.toml index 90ee264f..d996e2ac 100644 --- a/crates/db_schema/Cargo.toml +++ b/crates/db_schema/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_db_schema" diff --git a/crates/db_views/Cargo.toml b/crates/db_views/Cargo.toml index 765418ce..41968f31 100644 --- a/crates/db_views/Cargo.toml +++ b/crates/db_views/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] doctest = false diff --git a/crates/db_views_actor/Cargo.toml b/crates/db_views_actor/Cargo.toml index 9bea4674..abec875b 100644 --- a/crates/db_views_actor/Cargo.toml +++ b/crates/db_views_actor/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] doctest = false diff --git a/crates/db_views_moderator/Cargo.toml b/crates/db_views_moderator/Cargo.toml index b953b726..ad0bf167 100644 --- a/crates/db_views_moderator/Cargo.toml +++ b/crates/db_views_moderator/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] doctest = false diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index 5a732fd5..cbcd259c 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] doctest = false diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index f1a09ae4..21f92b11 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_utils" diff --git a/crates/websocket/Cargo.toml b/crates/websocket/Cargo.toml index 0d36bca4..829b759a 100644 --- a/crates/websocket/Cargo.toml +++ b/crates/websocket/Cargo.toml @@ -6,6 +6,7 @@ description.workspace = true license.workspace = true homepage.workspace = true documentation.workspace = true +repository.workspace = true [lib] name = "lemmy_websocket" diff --git a/crates/websocket/src/routes.rs b/crates/websocket/src/routes.rs index 6f6f0756..a3b1b046 100644 --- a/crates/websocket/src/routes.rs +++ b/crates/websocket/src/routes.rs @@ -54,7 +54,7 @@ impl Actor for WsSession { /// We register ws session with ChatServer fn started(&mut self, ctx: &mut Self::Context) { // we'll start heartbeat process on session start. - self.hb(ctx); + WsSession::hb(ctx); // register self in chat server. `AsyncContext::wait` register // future within context, but context waits until this future resolves @@ -159,7 +159,7 @@ impl WsSession { /// helper method that sends ping to client every second. /// /// also this method checks heartbeats from client - fn hb(&self, ctx: &mut ws::WebsocketContext) { + fn hb(ctx: &mut ws::WebsocketContext) { ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { // check client heartbeats if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { diff --git a/scripts/fix-clippy.sh b/scripts/fix-clippy.sh index 3ad68bcd..53b4c756 100755 --- a/scripts/fix-clippy.sh +++ b/scripts/fix-clippy.sh @@ -1,9 +1,11 @@ #!/bin/bash set -e -cargo clippy --workspace --fix --allow-dirty --tests --all-targets --all-features -- \ +cargo clippy --workspace --fix --allow-staged --tests --all-targets --all-features -- \ -D warnings -D deprecated -D clippy::perf -D clippy::complexity \ + -D clippy::style -D clippy::correctness -D clippy::suspicious \ -D clippy::dbg_macro -D clippy::inefficient_to_string \ -D clippy::items-after-statements -D clippy::implicit_clone \ -D clippy::wildcard_imports -D clippy::cast_lossless \ - -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls + -D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls \ + -D clippy::unused_self