Skip to content

Commit 14a1cdd

Browse files
kevincodex1claude
andauthored
chore: bump v0.3.9, fix all clippy warnings, enforce strict CI lint (#12)
* chore: bump v0.3.9, fix all clippy warnings, enforce strict CI lint - Bump workspace version 0.3.8 → 0.3.9 - Fix 22 clippy warnings across 17 files: - Replace .last() with .next_back() on DoubleEndedIterators (8 instances) - Remove useless .into() conversions on anyhow::Error (3) - Remove needless borrows in gl init (3) - Replace map_or with is_some_and/is_none_or (3) - Collapse consecutive str::replace into char array pattern (2) - Change &PathBuf to &Path in function signatures (2) - Remove dead code: unused init_bare_repo function - Collapse if-let into outer match arm - Replace vec![...] with array literal - Introduce RecordAnchorInput struct (10 params → 1 struct) - Fix always-true boolean condition in gossip task guard - Promote clippy from advisory to strict (-D warnings) in CI Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style: cargo fmt Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent be09938 commit 14a1cdd

22 files changed

Lines changed: 97 additions & 108 deletions

File tree

‎.github/workflows/pr-checks.yml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ jobs:
3434
- name: cargo fmt --check
3535
run: cargo fmt --all -- --check
3636

37-
# TODO: tighten to `-- -D warnings` once existing lints are cleaned up
38-
- name: cargo clippy (advisory)
39-
run: cargo clippy --workspace --all-targets
40-
continue-on-error: true
37+
- name: cargo clippy
38+
run: cargo clippy --workspace --all-targets -- -D warnings
4139

4240
- name: cargo test
4341
run: cargo test --workspace

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ keys/
2222

2323
# Logs
2424
*.log
25+
.openclaude-profile.json

‎Cargo.lock‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
]
99

1010
[workspace.package]
11-
version = "0.3.8"
11+
version = "0.3.9"
1212
edition = "2021"
1313
license = "MIT OR Apache-2.0"
1414
authors = ["gitlawb contributors"]

‎crates/gitlawb-node/src/api/arweave.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub async fn list_anchors(
3030
.db
3131
.list_arweave_anchors(q.repo.as_deref(), limit)
3232
.await
33-
.map_err(|e| crate::error::AppError::Internal(e.into()))?;
33+
.map_err(crate::error::AppError::Internal)?;
3434

3535
Ok(Json(serde_json::json!({
3636
"anchors": anchors,

‎crates/gitlawb-node/src/api/events.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub async fn list_repo_events(
7070
record
7171
.owner_did
7272
.split(':')
73-
.last()
73+
.next_back()
7474
.unwrap_or(&record.owner_did),
7575
repo_name
7676
)

‎crates/gitlawb-node/src/api/ipfs.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub async fn get_by_cid(
5252
.db
5353
.list_all_repos()
5454
.await
55-
.map_err(|e| AppError::Internal(e.into()))?;
55+
.map_err(AppError::Internal)?;
5656

5757
for repo in &repos {
5858
let repo_path = match state.repo_store.acquire(&repo.owner_did, &repo.name).await {
@@ -105,7 +105,7 @@ pub async fn list_pins(State(state): State<AppState>) -> Result<Json<serde_json:
105105
.db
106106
.list_pinned_cids()
107107
.await
108-
.map_err(|e| AppError::Internal(e.into()))?;
108+
.map_err(AppError::Internal)?;
109109

110110
Ok(Json(serde_json::json!({
111111
"pins": pins,

‎crates/gitlawb-node/src/api/peers.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub async fn trigger_sync(State(state): State<AppState>) -> Result<Json<serde_js
125125
) {
126126
(Some(owner), Some(name)) => {
127127
// Use short owner (last colon segment) matching DB convention
128-
let short = owner.split(':').last().unwrap_or(owner);
128+
let short = owner.split(':').next_back().unwrap_or(owner);
129129
format!("{short}/{name}")
130130
}
131131
_ => continue,

‎crates/gitlawb-node/src/api/repos.rs‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ pub async fn list_repos(
134134
State(state): State<AppState>,
135135
Query(query): Query<ListReposQuery>,
136136
) -> Result<Response> {
137-
use axum::response::IntoResponse;
138137
use axum::http::HeaderValue;
138+
use axum::response::IntoResponse;
139139

140140
if let Some(raw_limit) = query.limit {
141141
let limit = raw_limit.clamp(1, 200);
@@ -513,7 +513,7 @@ pub async fn git_receive_pack(
513513
let owner_short = record
514514
.owner_did
515515
.split(':')
516-
.last()
516+
.next_back()
517517
.unwrap_or(&record.owner_did);
518518
let clone_url = format!("{}/{}/{}.git", base_url, owner_short, record.name);
519519

@@ -574,7 +574,7 @@ pub async fn git_receive_pack(
574574
record
575575
.owner_did
576576
.split(':')
577-
.last()
577+
.next_back()
578578
.unwrap_or(&record.owner_did),
579579
record.name
580580
);
@@ -706,17 +706,17 @@ pub async fn git_receive_pack(
706706
Ok(tx_id) if !tx_id.is_empty() => {
707707
let arweave_url = crate::arweave::arweave_url(&tx_id);
708708
let _ = db_clone
709-
.record_arweave_anchor(
710-
&repo_slug,
711-
&owner_did_for_arweave,
709+
.record_arweave_anchor(&crate::db::RecordAnchorInput {
710+
repo: &repo_slug,
711+
owner_did: &owner_did_for_arweave,
712712
ref_name,
713-
"0".repeat(64).as_str(),
713+
old_sha: "0".repeat(64).as_str(),
714714
new_sha,
715-
cid.as_deref(),
716-
&tx_id,
717-
&arweave_url,
718-
&node_did_str,
719-
)
715+
cid: cid.as_deref(),
716+
irys_tx_id: &tx_id,
717+
arweave_url: &arweave_url,
718+
node_did: &node_did_str,
719+
})
720720
.await;
721721
}
722722
Ok(_) => {}
@@ -865,7 +865,7 @@ pub async fn fork_repo(
865865
}
866866

867867
// Check no name conflict under the forker's ownership
868-
let forker_short = forker_did.split(':').last().unwrap_or(&forker_did);
868+
let forker_short = forker_did.split(':').next_back().unwrap_or(&forker_did);
869869
if state.db.get_repo(forker_short, &fork_name).await?.is_some() {
870870
return Err(AppError::BadRequest(format!(
871871
"you already have a repo named {fork_name}"
@@ -1018,7 +1018,7 @@ fn to_response(record: &crate::db::RepoRecord, state: &AppState, star_count: i64
10181018
let owner_short = record
10191019
.owner_did
10201020
.split(':')
1021-
.last()
1021+
.next_back()
10221022
.unwrap_or(&record.owner_did);
10231023

10241024
let base_url = state

‎crates/gitlawb-node/src/arweave.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ pub fn arweave_url(tx_id: &str) -> String {
111111
/// Build the Irys tag header value for Arweave indexing.
112112
/// Format: comma-separated "name:value" pairs.
113113
fn build_tags_header(anchor: &RefAnchor) -> String {
114-
vec![
115-
format!("App-Name:gitlawb"),
116-
format!("Schema:gitlawb/ref-update/v1"),
114+
[
115+
"App-Name:gitlawb".to_string(),
116+
"Schema:gitlawb/ref-update/v1".to_string(),
117117
format!("Repo:{}", sanitize_tag(&anchor.repo)),
118118
format!("Ref:{}", sanitize_tag(&anchor.ref_name)),
119119
format!("SHA:{}", &anchor.new_sha[..anchor.new_sha.len().min(16)]),

0 commit comments

Comments
 (0)