Repository Analysis

rust-lang/rust-analyzer

A Rust compiler front-end for IDEs

1.7 Likely human-written View on GitHub
1.7
Adjusted Score
1.7
Raw Score
100%
Time Factor
2026-05-30
Last Push
16,491
Stars
Rust
Language
603,471
Lines of Code
1766
Files
946
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 6HIGH 0MEDIUM 12LOW 928

Pattern Findings

946 matches across 8 categories. Click a row to expand file-level details.

Over-Commented Block905 hits · 896 pts
SeverityFileLineSnippet
LOWcrates/hir-def/src/item_scope.rs181 /// and only normal scoped `macros` will be searched in.
LOWcrates/hir-def/src/import_map.rs41#[derive(Default)]
LOWcrates/hir-def/src/dyn_map.rs1//! This module defines a `DynMap` -- a container for heterogeneous maps.
LOWcrates/hir-def/src/expr_store.rs121 /// top level expression, it will not be listed in here.
LOWcrates/hir-def/src/expr_store.rs141 /// // this repeat expr is anon const #1, and *only it* appears in this list.
LOWcrates/hir-def/src/lib.rs1//! `hir_def` crate contains everything between macro expansion and type
LOWcrates/hir-def/src/lib.rs1061// manual impls that do not have a ModuleId container...
LOWcrates/hir-def/src/lib.rs1081 self.lookup(db).container
LOWcrates/hir-def/src/lib.rs1361// with `"type": "always"`.
LOWcrates/hir-def/src/hir.rs1//! This module describes hir-level representation of expressions.
LOWcrates/hir-def/src/hir.rs621 MacroDef(Box<MacroDefId>),
LOWcrates/hir-def/src/item_tree.rs1//! A simplified AST that only contains items.
LOWcrates/hir-def/src/item_tree.rs21//! resolution has not yet been performed. `ItemTree`s are per-file, while rustc's AST and HIR are
LOWcrates/hir-def/src/nameres.rs1//! This module implements import-resolution/macro expansion algorithm.
LOWcrates/hir-def/src/nameres.rs21//!
LOWcrates/hir-def/src/nameres.rs161}
LOWcrates/hir-def/src/nameres.rs181 pub modules: ModulesMap,
LOWcrates/hir-def/src/attrs.rs1//! Attributes for anything that is not name resolution.
LOWcrates/hir-def/src/resolver.rs541 /// doesn't necessary follow a strict scoping discipline. Rather, it just
LOWcrates/hir-def/src/resolver.rs561 ///
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs541// STMT_LIST@7..17
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs661// L_CURLY@9..10 "{"
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs741 a = 10+1;
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs761// BIN_EXPR@9..13
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs1741/* parse error: expected SEMICOLON */
LOWcrates/hir-def/src/macro_expansion_tests/mbe.rs1761// PATH_SEGMENT@6..7
LOWcrates/hir-def/src/macro_expansion_tests/proc_macros.rs1//! Tests for user-defined procedural macros.
LOWcrates/hir-def/src/macro_expansion_tests/proc_macros.rs41 #![cfg_attr(true, doc = "123...", attr2)]
LOWcrates/hir-def/src/macro_expansion_tests/proc_macros.rs61 );
LOW…es/hir-def/src/macro_expansion_tests/mbe/regression.rs941// PARAM_LIST@8..10
LOW…es/hir-def/src/macro_expansion_tests/mbe/regression.rs961// GENERIC_ARG_LIST@22..28
LOWcrates/hir-def/src/attrs/docs.rs41#[derive(Debug, Clone, PartialEq, Eq, Hash)]
LOWcrates/hir-def/src/expr_store/body.rs21/// The body of an item (function, const etc.).
LOWcrates/hir-def/src/expr_store/body.rs41 type Target = ExpressionStore;
LOWcrates/hir-def/src/expr_store/path.rs61 /// This specifies whether the args contain a Self type as the first
LOWcrates/hir-def/src/expr_store/lower.rs961 // captured and so that the drop order matches the equivalent non-async functions.
LOWcrates/hir-def/src/expr_store/lower.rs2101 /// }
LOWcrates/hir-def/src/expr_store/lower.rs2141
LOWcrates/hir-def/src/expr_store/lower.rs2241 /// Desugar `ast::TryExpr` from: `<expr>?` into:
LOWcrates/hir-def/src/expr_store/lower/format_args.rs921 ///
LOWcrates/hir-def/src/nameres/collector.rs261 ///
LOWcrates/hir-def/src/nameres/collector.rs461 self.unresolved_imports = unresolved_imports;
LOWcrates/hir-def/src/nameres/collector.rs601 ///
LOWcrates/hir-def/src/nameres/collector.rs641 crate_data.exported_derives.insert(proc_macro_id.into(), helpers);
LOWcrates/hir-def/src/nameres/collector.rs661 /// macro_rules! foo { () => {} }
LOWcrates/hir-def/src/nameres/collector.rs1721 // of that item (but not derive or fn like macros).
LOWcrates/hir-def/src/nameres/path_resolution.rs1//! This modules implements a function to resolve a path `foo::bar::baz` to a
LOWcrates/hir-def/src/nameres/tests/incremental.rs321 "file_item_tree_query",
LOWcrates/hir-def/src/nameres/tests/incremental.rs341// $0
LOWcrates/hir-def/src/nameres/tests/incremental.rs461
LOWcrates/hir-def/src/item_tree/attrs.rs121 // `AttrsOrCfg::Enabled`. It contains the concatenation of `self`'s attributes followed by
LOWcrates/base-db/src/editioned_file_id.rs21// impl EditionedFileId {
LOWcrates/base-db/src/input.rs81#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
LOWcrates/base-db/src/input.rs321 "" | "stable" => ReleaseChannel::Stable,
LOWcrates/base-db/src/input.rs361 /// The working directory to run proc-macros in invoked in the context of this crate.
LOWcrates/base-db/src/input.rs941/// can enable additional features, and is typically used when a
LOWcrates/hir-ty/src/display.rs141 /// T: Foo,
LOWcrates/hir-ty/src/variance.rs1//! Module for inferring the variance of type and lifetime parameters. See the [rustc dev guide]
LOWcrates/hir-ty/src/specialization.rs21// cannot create a cycle, but a cycle handler is required nevertheless.
LOWcrates/hir-ty/src/infer.rs1//! Type inference, i.e. the process of walking through the code and determining
845 more matches not shown…
Hallucination Indicators6 hits · 60 pts
SeverityFileLineSnippet
CRITICALcrates/hir-ty/src/infer/coerce.rs1087 if !coerce.delegate.0.result.expr_adjustments.contains_key(&new) {
CRITICALcrates/hir-ty/src/next_solver/infer/snapshot/fudge.rs186 let idx = vid.as_usize() - self.snapshot_vars.type_vars.0.start.as_usize();
CRITICALcrates/hir-ty/src/next_solver/infer/snapshot/fudge.rs231 let idx = vid.index() - self.snapshot_vars.region_vars.0.start.index();
CRITICALcrates/hir-ty/src/next_solver/infer/snapshot/fudge.rs247 let idx = vid.index() - self.snapshot_vars.const_vars.0.start.index();
CRITICALcrates/hir-ty/src/lower/path.rs817 GenericParamId::ConstParamId(_) => self.ctx.ctx.types.consts.error.into(),
CRITICALcrates/hir-ty/src/lower/path.rs818 GenericParamId::LifetimeParamId(_) => self.ctx.ctx.types.regions.error.into(),
Decorative Section Separators5 hits · 15 pts
SeverityFileLineSnippet
MEDIUMcrates/ide/src/extend_selection.rs664 r#"fn main() { let x = "═$0═══════"; }"#,
MEDIUMcrates/ide/src/extend_selection.rs666 r#""════════""#,
MEDIUMcrates/ide/src/extend_selection.rs667 r#"let x = "════════";"#,
MEDIUMcrates/ide/src/extend_selection.rs668 r#"{ let x = "════════"; }"#,
MEDIUMcrates/ide/src/extend_selection.rs669 r#"fn main() { let x = "════════"; }"#,
AI Slop Vocabulary6 hits · 14 pts
SeverityFileLineSnippet
MEDIUMcrates/hir-ty/src/next_solver/ty.rs340 // Definitely absolutely not copy.
MEDIUMcrates/ide-assists/src/lib.rs40//! * Make assists robust. If the assist depends on results of type-inference too
MEDIUMcrates/rust-analyzer/src/config.rs1003 /// [custom test harness](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-harness-field),
LOWcrates/hir-expand/src/builtin/derive_macro.rs1072 // Regardless of the only type param being designed as `#[pointee]` or not, we can just use it as such.
MEDIUMeditors/code/package-lock.json6183 "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz",
MEDIUMeditors/code/package.json2982 "markdownDescription": "Additional arguments to be passed through Cargo to launched tests, bench
Excessive Try-Catch Wrapping8 hits · 10 pts
SeverityFileLineSnippet
LOWlib/smol_str/src/gdb_smolstr_printer.py32 except Exception:
LOWlib/smol_str/src/gdb_smolstr_printer.py54 except Exception:
LOWlib/smol_str/src/gdb_smolstr_printer.py71 except Exception as e:
LOWlib/smol_str/src/gdb_smolstr_printer.py78 except Exception as e:
LOWlib/smol_str/src/gdb_smolstr_printer.py97 except Exception as e:
LOWlib/smol_str/src/gdb_smolstr_printer.py117 except Exception:
MEDIUMlib/smol_str/src/gdb_smolstr_printer.py29def _read_utf8(mem):
MEDIUMlib/smol_str/src/gdb_smolstr_printer.py51def to_string(self):
Hyper-Verbose Identifiers9 hits · 9 pts
SeverityFileLineSnippet
LOWeditors/code/src/commands.ts517function viewFileUsingTextDocumentContentProvider(
LOWeditors/code/src/commands.ts1100export function applySnippetWorkspaceEditCommand(_ctx: CtxInit): Cmd {
LOWeditors/code/src/main.ts222function checkConflictingExtensions() {
LOWeditors/code/src/snippets.ts7export async function applySnippetWorkspaceEdit(
LOWeditors/code/src/debug.ts410async function recompileTestFromDebuggingSession(session: vscode.DebugSession, ctx: Ctx) {
LOWeditors/code/src/debug.ts432export function initializeDebugSessionTrackingAndRebuild(ctx: Ctx) {
LOWeditors/code/src/client.ts372function assertIsCodeActionWithoutEditsAndCommands(
LOWeditors/code/src/config.ts557function substituteVSCodeVariableInString(val: string): string {
LOWeditors/code/src/bootstrap.ts179async function hasToolchainFileWithRaDeclared(uri: vscode.Uri): Promise<boolean> {
Slop Phrases5 hits · 8 pts
SeverityFileLineSnippet
LOWcrates/hir-ty/src/infer.rs1542 // don't forget to handle them here.
LOWcrates/ide/src/typing.rs36// Don't forget to add new trigger characters to `server_capabilities` in `caps.rs`.
LOWcrates/ide/src/syntax_highlighting/tags.rs44// Don't forget to adjust the feature description in crates/ide/src/syntax_highlighting.rs.
LOW…s/src/handlers/convert_named_struct_to_tuple_struct.rs60 // are to lift this limitation, don't forget to make `edit_struct_def()` consider macro files
LOW.vscode/launch.json105 // Don't forget to set `debug = 2` in `Cargo.toml` before building the server
Redundant / Tautological Comments2 hits · 3 pts
SeverityFileLineSnippet
LOWCargo.toml30# Set this to 1 or 2 to get more useful backtraces in debugger.
LOW.github/workflows/ci.yaml359 # Check if all jobs that we depend on (in the needs array) were successful (or have been skipped).