Skip to content

Commit d99e46c

Browse files
authored
chore: silence rust-analyzer's cyclic-deps log spam (#294)
Follow-up to f6e49c5. Opening the workspace floods the rust-analyzer server log with "cyclic deps" warnings, one per dev-dependency cycle in the crate graph. They are all dev-dependency cycles, which Cargo allows. rust-analyzer keeps one crate-graph node per package and does not separate dev-deps from normal deps, so the standard "A dev-depends on B, B depends on A" pattern always looks like a cycle to it. Nearly all of ours are upstream reth's — reth-trie-db and reth-provider dev-depend on each other, and so on. The two that touch our crates are reth-seismic-node's dev-dep on itself, copied verbatim from reth-optimism-node, and reth-seismic-primitives dev-depending on reth-seismic-test-utils for a single test module. None of it is worth restructuring; upstream reth configures nothing for these and lives with them. So filter the log instead. RA_LOG is a tracing Targets filter, and add_dep_inner is the only tracing::warn! in project_model::workspace, so raising just that module to "error" drops these lines and keeps everything else: the module's own tracing::error! calls still pass, and every other module stays at "warn", rust-analyzer's own default. Measured with the 1.95.0 rust-analyzer, running analysis-stats over seismic-reth/crates/seismic/test-utils: 19 "cyclic deps" lines before, 0 after, and no other WARN or ERROR output in either run. This does not address the separate task_pool.rs SendError panic on server shutdown — that is a known upstream bug (rust-lang/rust-analyzer#18055), unrelated to logging config.
1 parent f6e49c5 commit d99e46c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

workspace/seismic.code-workspace

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,22 @@
9090
// up front costs several GB of memory per window, which is expensive in this workspace
9191
// that contains so many different repos.
9292
"rust-analyzer.cachePriming.enable": false,
93+
// Silence the "cyclic deps" warnings that flood the server log. They are
94+
// dev-dependency cycles, which Cargo allows: rust-analyzer keeps one node
95+
// per package and does not separate dev-deps from normal deps, so the
96+
// standard "A dev-depends on B, B depends on A" pattern always looks like a
97+
// cycle to it. Most of ours come from upstream reth (reth-trie-db and
98+
// reth-provider dev-depend on each other, and so on), so there is nothing
99+
// to fix on our side.
100+
//
101+
// The warning is logged by add_dep_inner in
102+
// https://github.com/rust-lang/rust-analyzer/blob/master/crates/project-model/src/workspace.rs
103+
// which is the only tracing::warn! in that module — everything else there
104+
// is tracing::error!, so raising just this module to "error" loses nothing.
105+
// "warn" is rust-analyzer's own default filter, kept here for every other
106+
// module. RA_LOG is a tracing Targets filter, hence the module::path syntax.
107+
"rust-analyzer.server.extraEnv": {
108+
"RA_LOG": "warn,project_model::workspace=error"
109+
},
93110
}
94111
}

0 commit comments

Comments
 (0)