Add some more clippy lints (#2586)

* Add some more clippy lints

* restore config

* no allow dirty

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
Nutomic 2022-11-24 16:38:00 +00:00 committed by GitHub
parent c3c4508a72
commit d39bc14c43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 25 additions and 8 deletions

View file

@ -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::unused_self
- cargo clippy --workspace --all-features -- -D clippy::unwrap_used
- name: cargo test

View file

@ -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

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_api"

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_api_common"

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[dependencies]
lemmy_apub = { workspace = true }

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_apub"

View file

@ -58,6 +58,6 @@ pub(crate) async fn get_apub_person_outbox(
) -> Result<HttpResponse, LemmyError> {
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))
}

View file

@ -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))
}

View file

@ -14,7 +14,7 @@ pub(crate) struct EmptyOutbox {
}
impl EmptyOutbox {
pub(crate) async fn new(outbox_id: Url) -> Result<EmptyOutbox, LemmyError> {
pub(crate) fn new(outbox_id: Url) -> Result<EmptyOutbox, LemmyError> {
Ok(EmptyOutbox {
r#type: OrderedCollectionType::OrderedCollection,
id: outbox_id,

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_db_schema"

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
doctest = false

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
doctest = false

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
doctest = false

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
doctest = false

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_utils"

View file

@ -6,6 +6,7 @@ description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
[lib]
name = "lemmy_websocket"

View file

@ -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<Self>) {
fn hb(ctx: &mut ws::WebsocketContext<Self>) {
ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| {
// check client heartbeats
if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT {

View file

@ -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