From 66964be393e9fe661a9b083d541fb7ff175a04fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Tue, 26 May 2026 23:34:31 -0300 Subject: [PATCH] chore(fmt): apply cargo fmt to recent LSP changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure rustfmt churn — the anchor-match, source-relative resolution, and config-unwrap commits introduced lines that needed rustfmt reformatting. CI's `cargo fmt --check` job was blocking on this. Co-Authored-By: Claude Sonnet 4.6 --- crates/nuwiki-lsp/src/config.rs | 8 +++++++- crates/nuwiki-lsp/src/diagnostics.rs | 3 +-- crates/nuwiki-lsp/src/index.rs | 13 +++++-------- crates/nuwiki-lsp/tests/link_health.rs | 11 ++++++----- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/crates/nuwiki-lsp/src/config.rs b/crates/nuwiki-lsp/src/config.rs index a8f1aa1..50c1119 100644 --- a/crates/nuwiki-lsp/src/config.rs +++ b/crates/nuwiki-lsp/src/config.rs @@ -377,7 +377,13 @@ impl Config { // Unwrap { "nuwiki": { ... } } → { ... } so both clients work. let inner = value .as_object() - .and_then(|m| if m.len() == 1 { m.values().next() } else { None }) + .and_then(|m| { + if m.len() == 1 { + m.values().next() + } else { + None + } + }) .filter(|v| v.is_object()) .unwrap_or(value); diff --git a/crates/nuwiki-lsp/src/diagnostics.rs b/crates/nuwiki-lsp/src/diagnostics.rs index 2610959..267b234 100644 --- a/crates/nuwiki-lsp/src/diagnostics.rs +++ b/crates/nuwiki-lsp/src/diagnostics.rs @@ -210,8 +210,7 @@ pub fn classify_link( } fn anchor_resolves_on(page: &crate::index::IndexedPage, anchor: &str) -> bool { - page.find_heading_by_anchor(anchor).is_some() - || page.tags.iter().any(|t| t.name == anchor) + page.find_heading_by_anchor(anchor).is_some() || page.tags.iter().any(|t| t.name == anchor) } /// Same classification as [`classify_link`] but driven from the cached diff --git a/crates/nuwiki-lsp/src/index.rs b/crates/nuwiki-lsp/src/index.rs index 1354069..732192f 100644 --- a/crates/nuwiki-lsp/src/index.rs +++ b/crates/nuwiki-lsp/src/index.rs @@ -179,14 +179,11 @@ impl WorkspaceIndex { for link in &page.outgoing { if let Some(tgt) = &link.target_page { let key = canonical_link_name(tgt, &name, link.is_absolute, ext); - self.backlinks - .entry(key) - .or_default() - .push(Backlink { - source_uri: uri.clone(), - source_span: link.span, - target_anchor: link.anchor.clone(), - }); + self.backlinks.entry(key).or_default().push(Backlink { + source_uri: uri.clone(), + source_span: link.span, + target_anchor: link.anchor.clone(), + }); } } diff --git a/crates/nuwiki-lsp/tests/link_health.rs b/crates/nuwiki-lsp/tests/link_health.rs index d2ce7ef..e460fd6 100644 --- a/crates/nuwiki-lsp/tests/link_health.rs +++ b/crates/nuwiki-lsp/tests/link_health.rs @@ -489,7 +489,11 @@ fn wiki_link_resolves_source_relative_first() { LinkSeverity::Warning, true, ); - assert!(diags.is_empty(), "expected no diagnostics, got: {:?}", diags); + assert!( + diags.is_empty(), + "expected no diagnostics, got: {:?}", + diags + ); } #[test] @@ -500,10 +504,7 @@ fn wiki_link_falls_back_to_root_relative() { let root = "/tmp/srcrel2"; let idx = build_index( root, - &[ - ("index", "[[posts/foo|Foo]]\n"), - ("posts/foo", "= Foo =\n"), - ], + &[("index", "[[posts/foo|Foo]]\n"), ("posts/foo", "= Foo =\n")], ); let src = "[[posts/foo|Foo]]\n"; let ast = parse(src);