From acbe7bf8196fae32222b766be4da906c480ac40a Mon Sep 17 00:00:00 2001 From: azzamsa Date: Tue, 9 Jul 2024 09:37:44 +0700 Subject: [PATCH] refactor: make cargo clippy happy --- .github/workflows/lint.yaml | 3 +-- backend/gdata/Cargo.toml | 2 +- backend/gdata/gdata_explorer/src/main.rs | 5 +++-- backend/src/bin/gen-namespace-secret.rs | 2 +- backend/src/routes/profile.rs | 8 ++++++-- justfile | 3 +++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 7691e9ff..4f882309 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -35,6 +35,5 @@ jobs: - name: Lint codebase shell: bash run: | - just lint - just fmt-check + just comply diff --git a/backend/gdata/Cargo.toml b/backend/gdata/Cargo.toml index e6d6b7c3..b9f18aae 100644 --- a/backend/gdata/Cargo.toml +++ b/backend/gdata/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "gdata" version = "0.0.1" -description = "A graph layer on top of Iroh documents." license = "MIT OR Apache-2.0" +description = "A graph layer on top of Iroh documents." edition.workspace = true repository.workspace = true diff --git a/backend/gdata/gdata_explorer/src/main.rs b/backend/gdata/gdata_explorer/src/main.rs index bc2b6c25..1c2e74e3 100644 --- a/backend/gdata/gdata_explorer/src/main.rs +++ b/backend/gdata/gdata_explorer/src/main.rs @@ -73,7 +73,7 @@ impl App { .relay_mode(iroh::net::relay::RelayMode::Disabled) .spawn() .await?; - let node_author = node.authors.default().await?; + let node_author = node.authors().default().await?; let graph = IrohGStore::new(node.client().clone(), node_author); let state = Self::load_home(&node).await?; @@ -88,7 +88,7 @@ impl App { async fn load_home(node: &FsNode) -> anyhow::Result { let mut docs = Vec::new(); - let mut stream = node.docs.list().await?; + let mut stream = node.docs().list().await?; while let Some(doc) = stream.next().await { let (doc, _cap) = doc?; docs.push(doc); @@ -215,6 +215,7 @@ impl Widget for &mut HomePage { } } +#[allow(dead_code)] struct NamespaceView { ns: NamespaceId, history: Vec>, diff --git a/backend/src/bin/gen-namespace-secret.rs b/backend/src/bin/gen-namespace-secret.rs index 9696d48c..38189aa6 100644 --- a/backend/src/bin/gen-namespace-secret.rs +++ b/backend/src/bin/gen-namespace-secret.rs @@ -2,4 +2,4 @@ use weird::iroh::docs::NamespaceSecret; fn main() { println!("{}", NamespaceSecret::new(&mut rand::thread_rng())); -} \ No newline at end of file +} diff --git a/backend/src/routes/profile.rs b/backend/src/routes/profile.rs index db751b7d..a0ad7385 100644 --- a/backend/src/routes/profile.rs +++ b/backend/src/routes/profile.rs @@ -7,7 +7,9 @@ use axum::{ }; use futures::{pin_mut, StreamExt}; use weird::{ - db::StringSerde, iroh::docs::AuthorId, profile::{Profile, Username} + db::StringSerde, + iroh::docs::AuthorId, + profile::{Profile, Username}, }; use crate::ARGS; @@ -33,7 +35,9 @@ pub fn install(router: Router) -> Router { .route("/profile/:user_id", delete(delete_profile)) } -async fn get_usernames(state: State) -> AppResult>>> { +async fn get_usernames( + state: State, +) -> AppResult>>> { let mut usernames = HashMap::default(); let stream = state.weird.get_usernames().await?; pin_mut!(stream); diff --git a/justfile b/justfile index 21e023bc..e03fb11a 100644 --- a/justfile +++ b/justfile @@ -29,15 +29,18 @@ dev: # Format the codebase. fmt: + cargo fmt --all pnpm run format dprint fmt # Check is the codebase properly formatted. fmt-check: + cargo fmt --all --check dprint check # Lint the codebase. lint: + cargo clippy --workspace --all-targets --all-features pnpm run lint # Run `typos --write-changes` to fix the mistakes typos