mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 03:11:32 +00:00
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:
parent
c3c4508a72
commit
d39bc14c43
18 changed files with 25 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_api"
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_api_common"
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_apub = { workspace = true }
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_apub"
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_db_schema"
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_utils"
|
||||
|
|
|
@ -6,6 +6,7 @@ description.workspace = true
|
|||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "lemmy_websocket"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue