Public report of rust-lang/rust, published 26 October 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 26 October 2026, 00:21 UTC · Survey ID cd_1b454d8244af4cbc806cd8326c743c66

rust-lang/rust

Measured 26 October 2026, 00:03 UTC, at code version 76456a6

Regression: 1 dimension fell since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 48out of 100 Weak
CriticalWeakAdequateStrongExemplary
Down 1 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 2,275,874 lines of product code in 236 projects, tests not counted · Estimated rebuild effort: about 24.3 person-years · Weakest lens: Code Health, 41

Findings by how serious they are

169 critical 12915 serious 235 minor

9 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 00:03 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

89of 89 dimensions measured by tools.
13127of 13319 findings point to an exact file and line, so you can open each one in the code. The other 192 concern the repository as a whole, such as missing documentation.
89dimensions across 9 lenses, read from 2,275,874 lines of product code in 236 projects.
Chapters

Executive summary

rust-lang/rust falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 48 out of 100 and is rated Weak, and 154 of its 169 critical findings are security problems.

Code Health, at 41, is the weakest lens and counts most in the score. The best first step is splitting the oversized files, worth about 4 points. Replacing the four exposed passwords or keys and switching the old ones off comes next, worth about 2 points. Raising Code Health to 70 would lift the score to about 53.

Seventy-five settings leave the servers or containers unsafe. Fifty-two passwords or keys in the code's history and four in the code are open to anyone who can read the repository, and fifteen known security holes in the packages the code depends on can be used by attackers. Correcting the unsafe settings, replacing each exposed password or key and updating the vulnerable packages would close these risks. The two pipeline steps that run downloads without checking them need each download checked against a known checksum first. The two places where the code runs text as code or as a command need a direct call instead. The four parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.

The product code is 2,275,874 lines, about €3,500,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Code Health 41 · counts for 45%Security and Compliance 44 · counts for 25%Production Readiness 54 · counts for 14%Accessibility 54 · counts for 8%Architecture 65 · counts for 4%Maturity 75 · counts for 2%Performance 97 · counts for 1%Domain Modelling 100 · counts for 1%Event Sourcing 100 · counts for 0%

If Code Health rose from 41 to 70, the lowest score rated Strong, the score would rise from 48 to about 53.

Code composition: what the lines of code are
Product code 67%Tests 33%
New since the last survey: 446 findings

These 446 critical or serious findings weren't in the previous survey, on 11 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · Ty::hir_fmt (cyclomatic 117) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cyclomatic Complexity · hir_ide::display::render_const_scalar_inner (cyclomatic 57) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cyclomatic Complexity · rustc_codegen_llvm::context::init_module (cyclomatic 53) compiler/rustc_codegen_llvm/src/context.rs
  • Cyclomatic Complexity · hir_ide::display::render_const_scalar_from_valtree_inner (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cyclomatic Complexity · hir_ide::display::write_bounds_like_dyn_trait (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cyclomatic Complexity · UnsafeVisitor::walk_expr (cyclomatic 33) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/unsafe_check.rs
  • Cyclomatic Complexity · rustc_codegen_llvm::debuginfo::metadata::build_basic_type_di_node (cyclomatic 31) compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
  • Cyclomatic Complexity · rustc_lint::types::lint_nan (cyclomatic 29) compiler/rustc_lint/src/types.rs
  • Cyclomatic Complexity · Path::hir_fmt (cyclomatic 29) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cyclomatic Complexity · LateResolutionVisitor::with_const_and_generic_param_rib (cyclomatic 28) compiler/rustc_resolve/src/late.rs
  • Cyclomatic Complexity · rustc_mir_transform::canonicalization::canonicalize_binary_operands (cyclomatic 27) compiler/rustc_mir_transform/src/canonicalization.rs
  • Cyclomatic Complexity · Pat::hir_fmt (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs
  • Cyclomatic Complexity · LateResolutionVisitor::detect_missing_turbofish (cyclomatic 22) compiler/rustc_resolve/src/late/diagnostics.rs
  • Cyclomatic Complexity · hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
  • Cyclomatic Complexity · libm::math::exp2m1f::cr_exp2m1f (cyclomatic 19) library/compiler-builtins/libm/src/math/exp2m1f.rs
  • Cyclomatic Complexity · MirEvalError::pretty_print (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty/errors.rs
  • Cyclomatic Complexity · ide::moniker::def_to_non_local_moniker (cyclomatic 18) src/tools/rust-analyzer/crates/ide/src/moniker.rs
  • Cyclomatic Complexity · AttributeParser::check_target (cyclomatic 17) compiler/rustc_attr_parsing/src/target_checking.rs
  • Cyclomatic Complexity · libm::math::exp2m1::cr_exp2m1 (cyclomatic 17) library/compiler-builtins/libm/src/math/exp2m1.rs
  • Cyclomatic Complexity · rustc_codegen_ssa::back::symbol_export::reachable_non_generics_helper (cyclomatic 16) compiler/rustc_codegen_ssa/src/back/symbol_export.rs
  • Cyclomatic Complexity · PanicUnimplemented::check_expr (cyclomatic 16) src/tools/clippy/clippy_lints/src/panic_unimplemented.rs
  • Cyclomatic Complexity · EvalContextExt::set_generic_socket_option (cyclomatic 16) src/tools/miri/src/shims/unix/socket.rs
  • Cyclomatic Complexity · EvalContextExt::get_generic_socket_option (cyclomatic 16) src/tools/miri/src/shims/unix/socket.rs
  • Cyclomatic Complexity · ide_completion::completions::attribute::cfg::complete_cfg (cyclomatic 16) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs
  • Cognitive Complexity · Ty::hir_fmt (cognitive 149) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cognitive Complexity · hir_ide::display::render_const_scalar_inner (cognitive 87) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cognitive Complexity · libm::math::exp2m1f::cr_exp2m1f (cognitive 80) library/compiler-builtins/libm/src/math/exp2m1f.rs
  • Cognitive Complexity · hir_ide::display::write_bounds_like_dyn_trait (cognitive 77) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cognitive Complexity · Path::hir_fmt (cognitive 73) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cognitive Complexity · LateResolutionVisitor::with_const_and_generic_param_rib (cognitive 59) compiler/rustc_resolve/src/late.rs
  • Cognitive Complexity · rustc_codegen_llvm::context::init_module (cognitive 58) compiler/rustc_codegen_llvm/src/context.rs
  • Cognitive Complexity · LateResolutionVisitor::detect_missing_turbofish (cognitive 50) compiler/rustc_resolve/src/late/diagnostics.rs
  • Cognitive Complexity · Pat::hir_fmt (cognitive 36) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs
  • Cognitive Complexity · ExprValidator::check_for_unnecessary_else (cognitive 35) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/expr.rs
  • Cognitive Complexity · hir_ide::display::render_const_scalar_from_valtree_inner (cognitive 35) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • Cognitive Complexity · libm::math::exp2m1::cr_exp2m1 (cognitive 33) library/compiler-builtins/libm/src/math/exp2m1.rs
  • Cognitive Complexity · hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cognitive 33) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
  • Cognitive Complexity · UnsafeVisitor::walk_expr (cognitive 31) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/unsafe_check.rs
  • Cognitive Complexity · MirEvalError::pretty_print (cognitive 31) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty/errors.rs
  • Cognitive Complexity · LintParser::parse (cognitive 29) compiler/rustc_attr_parsing/src/attributes/lint.rs
  • Cognitive Complexity · rustc_lint::types::lint_nan (cognitive 29) compiler/rustc_lint/src/types.rs
  • Cognitive Complexity · GccCodegenBackend::init (cognitive 26) compiler/rustc_codegen_gcc/src/lib.rs
  • Cognitive Complexity · Builder::gcc_shr (cognitive 24) compiler/rustc_codegen_gcc/src/int.rs
  • Cognitive Complexity · Socket::poll_connected (cognitive 24) library/std/src/sys/net/connection/socket/unix.rs
  • Cognitive Complexity · EvalContextExt::set_generic_socket_option (cognitive 24) src/tools/miri/src/shims/unix/socket.rs
  • Cognitive Complexity · rustc_codegen_llvm::back::write::optimize_inner (cognitive 22) compiler/rustc_codegen_llvm/src/back/write.rs
  • Cognitive Complexity · ArgMatchingCtxt::detect_missing_turbofish (cognitive 22) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
  • Cognitive Complexity · EvalContextExt::emulate_math_intrinsic (cognitive 22) src/tools/miri/src/intrinsics/math.rs
  • Cognitive Complexity · Resolver::check_unused_macros (cognitive 21) compiler/rustc_resolve/src/macros.rs
  • Cognitive Complexity · AliasFixup::visit_statement (cognitive 21) compiler/rustc_mir_transform/src/move_elimination.rs
  • Cognitive Complexity · std::sys::fs::windows::rename_inner (cognitive 21) library/std/src/sys/fs/windows.rs
  • Cognitive Complexity · WfCheckingCtxt::check_test_binder_region_constraints (cognitive 20) compiler/rustc_hir_analysis/src/check/wfcheck.rs
  • Cognitive Complexity · rustc_mir_transform::coroutine::create_coroutine_resume_function (cognitive 20) compiler/rustc_mir_transform/src/coroutine/mod.rs
  • Cognitive Complexity · LateResolutionVisitor::visit_fn (cognitive 20) compiler/rustc_resolve/src/late.rs
  • Cognitive Complexity · ItemNameRepetitions::check_name_repetition (cognitive 20) src/tools/clippy/clippy_lints/src/item_name_repetitions.rs
  • Cognitive Complexity · clippy_lints::attrs::deprecated_attributes_without_fields::check_fields (cognitive 20) src/tools/clippy/clippy_lints/src/attrs/deprecated_attributes_without_fields.rs
  • Cognitive Complexity · rustc_traits::codegen::codegen_select_candidate (cognitive 20) compiler/rustc_traits/src/codegen.rs
  • Cognitive Complexity · buildSettingsPageSections (cognitive 20) src/librustdoc/html/static/js/settings.js
  • Cognitive Complexity · EvalContextExt::get_generic_socket_option (cognitive 19) src/tools/miri/src/shims/unix/socket.rs
  • Cognitive Complexity · MirPrettyCtx::blocks (cognitive 19) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty.rs
  • Cognitive Complexity · rustc_mir_build::thir::constant::lit_to_const (cognitive 18) compiler/rustc_mir_build/src/thir/constant.rs
  • Cognitive Complexity · RustdocVisitor::visit_item_inner (cognitive 18) src/librustdoc/visit_ast.rs
  • Cognitive Complexity · DeclValidator::validate_struct_fields (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • Cognitive Complexity · DeclValidator::validate_enum_variants (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • Cognitive Complexity · DeclValidator::validate_enum_variant_fields (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • Cognitive Complexity · MatchCheckCtx::ctors_for_ty (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check/pat_analysis.rs
  • Cognitive Complexity · ide_completion::completions::attribute::cfg::complete_cfg (cognitive 18) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs
  • Cognitive Complexity · LoweringContext::lower_fn_decl (cognitive 17) compiler/rustc_ast_lowering/src/lib.rs
  • Cognitive Complexity · FnCtxt::check_argument_types_maybe_method_like (cognitive 17) compiler/rustc_hir_typeck/src/callee.rs
  • Cognitive Complexity · DeclValidator::validate_union_fields (cognitive 17) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • Cognitive Complexity · Function::hir_fmt (cognitive 16) src/tools/rust-analyzer/crates/hir/src/display.rs
  • Cognitive Complexity · DeclValidator::validate_func_body (cognitive 16) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • Cognitive Complexity · HirFormatter::format_bounds_with (cognitive 16) src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • God Classes · MethodTooLong: Ty.hir_fmt src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • God Classes · FileTooLong: src/display.rs src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • God Classes · FunctionTooLong: rustc_codegen_llvm::context::init_module compiler/rustc_codegen_llvm/src/context.rs
  • God Classes · FunctionTooLong: hir_ide::display::render_const_scalar_inner src/tools/rust-analyzer/crates/hir-ide/src/display.rs
  • God Classes · FunctionTooLong: libm::math::exp2m1f::cr_exp2m1f library/compiler-builtins/libm/src/math/exp2m1f.rs
  • God Classes · ClassTooLong: EvalContextExt src/tools/miri/src/shims/unix/socket.rs
  • God Classes · FileTooLong: src/target_feature.rs src/tools/rust-analyzer/crates/hir-ty/src/target_feature.rs
  • God Classes · FileTooLong: unix/socket.rs src/tools/miri/src/shims/unix/socket.rs
  • God Classes · MethodTooLong: LateResolutionVisitor.with_const_and_generic_param_rib compiler/rustc_resolve/src/late.rs
  • God Classes · TooManyMethods: SyntaxContext src/tools/rust-analyzer/crates/span/src/hygiene.rs
  • God Classes · FileTooLong: math/exp2m1.rs library/compiler-builtins/libm/src/math/exp2m1.rs
  • God Classes · TooManyMethods: Const compiler/rustc_type_ir/src/sty/consts.rs
  • God Classes · ClassTooLong: AttrFlags src/tools/rust-analyzer/crates/hir-def/src/attrs.rs
  • God Classes · FileTooLong: concurrency/sync.rs src/tools/miri/src/concurrency/sync.rs
  • God Classes · TooManyMethods: TcpStream library/std/src/sys/net/connection/xous/tcpstream.rs
  • God Classes · FunctionTooLong: libm::math::exp2m1::exp2m1_accurate library/compiler-builtins/libm/src/math/exp2m1.rs
  • God Classes · TooManyMethods: TcpStream library/std/src/sys/net/connection/socket/mod.rs
  • God Classes · TooManyMethods: TcpStream library/std/src/sys/net/connection/wasip1.rs
  • God Classes · FileTooLong: next_solver/util.rs src/tools/rust-analyzer/crates/hir-ty/src/next_solver/util.rs
  • God Classes · ClassTooLong: DeclValidator src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs
  • God Classes · MethodTooLong: LoweringContext.lower_fn_decl compiler/rustc_ast_lowering/src/lib.rs
  • God Classes · FunctionTooLong: rustdoc::clean::inline::try_inline src/librustdoc/clean/inline.rs
  • God Classes · MethodTooLong: MirEvalError.pretty_print src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty/errors.rs
  • God Classes · TooManyMethods: TcpStream library/std/src/sys/net/connection/uefi/mod.rs
  • God Classes · FileTooLong: infer/unify.rs src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
  • God Classes · MethodTooLong: TyLoweringContext.lower_ty_ext src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
  • God Classes · MethodTooLong: EvalContextExt.emulate_x86_avx512_intrinsic src/tools/miri/src/intrinsics/x86/avx512.rs

Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 423 findings

These 423 critical or serious findings were in the previous survey, on 11 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · Ty::hir_fmt (cyclomatic 117) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cyclomatic Complexity · rustc_codegen_cranelift::intrinsics::codegen_float_intrinsic_call (cyclomatic 59) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
  • Cyclomatic Complexity · hir_ty::display::render_const_scalar_inner (cyclomatic 57) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cyclomatic Complexity · rustc_codegen_llvm::context::create_module (cyclomatic 53) compiler/rustc_codegen_llvm/src/context.rs
  • Cyclomatic Complexity · NonAsciiIdents::check_crate (cyclomatic 39) compiler/rustc_lint/src/non_ascii_idents.rs
  • Cyclomatic Complexity · RedundantClone::check_fn (cyclomatic 38) src/tools/clippy/clippy_lints/src/redundant_clone.rs
  • Cyclomatic Complexity · hir_ty::display::render_const_scalar_from_valtree_inner (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cyclomatic Complexity · hir_ty::display::write_bounds_like_dyn_trait (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cyclomatic Complexity · UnsafeVisitor::walk_expr (cyclomatic 33) src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs
  • Cyclomatic Complexity · AsmLabels::check_expr (cyclomatic 32) compiler/rustc_lint/src/builtin.rs
  • Cyclomatic Complexity · Path::hir_fmt (cyclomatic 29) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cyclomatic Complexity · NeedlessPassByValue::check_fn (cyclomatic 28) src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
  • Cyclomatic Complexity · HashMapPass::check_expr (cyclomatic 26) src/tools/clippy/clippy_lints/src/entry.rs
  • Cyclomatic Complexity · ExplicitOutlivesRequirements::check_item (cyclomatic 25) compiler/rustc_lint/src/builtin.rs
  • Cyclomatic Complexity · UnusedResults::check_stmt (cyclomatic 25) compiler/rustc_lint/src/unused/must_use.rs
  • Cyclomatic Complexity · PtrNullChecks::check_expr (cyclomatic 24) compiler/rustc_lint/src/ptr_nulls.rs
  • Cyclomatic Complexity · LateResolutionVisitor::with_generic_param_rib (cyclomatic 24) compiler/rustc_resolve/src/late.rs
  • Cyclomatic Complexity · EndianBytes::check_expr (cyclomatic 23) src/tools/clippy/clippy_lints/src/endian_bytes.rs
  • Cyclomatic Complexity · SingleRangeInVecInit::check_expr (cyclomatic 23) src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs
  • Cyclomatic Complexity · TcpSocket::setsockopt (cyclomatic 23) src/tools/miri/src/shims/unix/tcp_socket.rs
  • Cyclomatic Complexity · Pat::hir_fmt (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs
  • Cyclomatic Complexity · InvalidValue::check_expr::ty_find_init_error (cyclomatic 22) compiler/rustc_lint/src/builtin.rs
  • Cyclomatic Complexity · DropForgetUseless::check_expr (cyclomatic 21) compiler/rustc_lint/src/drop_forget_useless.rs
  • Cyclomatic Complexity · NeedlessBool::check_expr (cyclomatic 21) src/tools/clippy/clippy_lints/src/needless_bool.rs
  • Cyclomatic Complexity · RedundantTypeAnnotations::check_local (cyclomatic 21) src/tools/clippy/clippy_lints/src/redundant_type_annotations.rs
  • Cyclomatic Complexity · MissingCopyImplementations::check_item (cyclomatic 20) compiler/rustc_lint/src/builtin.rs
  • Cyclomatic Complexity · LiteralStringWithFormattingArg::check_expr (cyclomatic 20) src/tools/clippy/clippy_lints/src/literal_string_with_formatting_args.rs
  • Cyclomatic Complexity · TcpSocket::getsockopt (cyclomatic 20) src/tools/miri/src/shims/unix/tcp_socket.rs
  • Cyclomatic Complexity · rustc_codegen_llvm::va_arg::emit_powerpc_va_arg (cyclomatic 19) compiler/rustc_codegen_llvm/src/va_arg.rs
  • Cyclomatic Complexity · ComparisonChain::check_expr (cyclomatic 19) src/tools/clippy/clippy_lints/src/comparison_chain.rs
  • Cyclomatic Complexity · MirEvalError::pretty_print (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
  • Cyclomatic Complexity · MethodDef::expand_enum_method_body (cyclomatic 18) compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
  • Cyclomatic Complexity · ManualCheckedOps::check_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/manual_checked_ops.rs
  • Cyclomatic Complexity · ManualRangePatterns::check_pat (cyclomatic 18) src/tools/clippy/clippy_lints/src/manual_range_patterns.rs
  • Cyclomatic Complexity · TraitDef::create_derived_impl (cyclomatic 17) compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
  • Cyclomatic Complexity · RedundantSlicing::check_expr (cyclomatic 17) src/tools/clippy/clippy_lints/src/redundant_slicing.rs
  • Cyclomatic Complexity · BadUseOfFindAttr::check_arm::find_attr_kind_in_pat (cyclomatic 16) compiler/rustc_lint/src/internal.rs
  • Cyclomatic Complexity · InvalidFromUtf8::check_expr (cyclomatic 16) compiler/rustc_lint/src/invalid_from_utf8.rs
  • Cyclomatic Complexity · NoopMethodCall::check_expr (cyclomatic 16) compiler/rustc_lint/src/noop_method_call.rs
  • Cyclomatic Complexity · OpaqueHiddenInferredBound::check_ty (cyclomatic 16) compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
  • Cyclomatic Complexity · UnsafeExprCollector::visit_expr (cyclomatic 16) src/tools/clippy/clippy_lints/src/multiple_unsafe_ops_per_block.rs
  • Cyclomatic Complexity · SameNameMethod::check_crate_post (cyclomatic 16) src/tools/clippy/clippy_lints/src/same_name_method.rs
  • Cyclomatic Complexity · hir_ty::lower::generic_predicates (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
  • Cognitive Complexity · Ty::hir_fmt (cognitive 149) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cognitive Complexity · NonAsciiIdents::check_crate (cognitive 107) compiler/rustc_lint/src/non_ascii_idents.rs
  • Cognitive Complexity · AsmLabels::check_expr (cognitive 94) compiler/rustc_lint/src/builtin.rs
  • Cognitive Complexity · hir_ty::display::render_const_scalar_inner (cognitive 87) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cognitive Complexity · ExplicitOutlivesRequirements::check_item (cognitive 81) compiler/rustc_lint/src/builtin.rs
  • Cognitive Complexity · hir_ty::display::write_bounds_like_dyn_trait (cognitive 77) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cognitive Complexity · Path::hir_fmt (cognitive 73) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cognitive Complexity · RedundantClone::check_fn (cognitive 68) src/tools/clippy/clippy_lints/src/redundant_clone.rs
  • Cognitive Complexity · rustc_codegen_llvm::context::create_module (cognitive 58) compiler/rustc_codegen_llvm/src/context.rs
  • Cognitive Complexity · SameNameMethod::check_crate_post (cognitive 52) src/tools/clippy/clippy_lints/src/same_name_method.rs
  • Cognitive Complexity · TcpSocket::setsockopt (cognitive 51) src/tools/miri/src/shims/unix/tcp_socket.rs
  • Cognitive Complexity · LateResolutionVisitor::with_generic_param_rib (cognitive 50) compiler/rustc_resolve/src/late.rs
  • Cognitive Complexity · HashMapPass::check_expr (cognitive 49) src/tools/clippy/clippy_lints/src/entry.rs
  • Cognitive Complexity · NeedlessPassByValue::check_fn (cognitive 48) src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
  • Cognitive Complexity · LiteralStringWithFormattingArg::check_expr (cognitive 45) src/tools/clippy/clippy_lints/src/literal_string_with_formatting_args.rs
  • Cognitive Complexity · TcpSocket::getsockopt (cognitive 43) src/tools/miri/src/shims/unix/tcp_socket.rs
  • Cognitive Complexity · Pat::hir_fmt (cognitive 36) src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs
  • Cognitive Complexity · ManualRangePatterns::check_pat (cognitive 35) src/tools/clippy/clippy_lints/src/manual_range_patterns.rs
  • Cognitive Complexity · RedundantTypeAnnotations::check_local (cognitive 35) src/tools/clippy/clippy_lints/src/redundant_type_annotations.rs
  • Cognitive Complexity · SingleRangeInVecInit::check_expr (cognitive 35) src/tools/clippy/clippy_lints/src/single_range_in_vec_init.rs
  • Cognitive Complexity · ExprValidator::check_for_unnecessary_else (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs
  • Cognitive Complexity · hir_ty::display::render_const_scalar_from_valtree_inner (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/display.rs
  • Cognitive Complexity · ComparisonChain::check_expr (cognitive 34) src/tools/clippy/clippy_lints/src/comparison_chain.rs
  • Cognitive Complexity · BlocksInConditions::check_expr (cognitive 33) src/tools/clippy/clippy_lints/src/blocks_in_conditions.rs
  • Cognitive Complexity · TraitDef::create_derived_impl (cognitive 32) compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
  • Cognitive Complexity · RestWhenDestructuringStruct::check_pat (cognitive 32) src/tools/clippy/clippy_lints/src/rest_when_destructuring_struct.rs
  • Cognitive Complexity · PtrNullChecks::check_expr (cognitive 31) compiler/rustc_lint/src/ptr_nulls.rs
  • Cognitive Complexity · UnsafeVisitor::walk_expr (cognitive 31) src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs
  • Cognitive Complexity · MirEvalError::pretty_print (cognitive 31) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
  • Cognitive Complexity · InvalidFromUtf8::check_expr (cognitive 30) compiler/rustc_lint/src/invalid_from_utf8.rs
  • Cognitive Complexity · ImplicitHasher::check_item (cognitive 30) src/tools/clippy/clippy_lints/src/implicit_hasher.rs
  • Cognitive Complexity · OpaqueHiddenInferredBound::check_ty (cognitive 29) compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
  • Cognitive Complexity · BlockScrutinee::check_expr (cognitive 28) src/tools/clippy/clippy_lints/src/block_scrutinee.rs
  • Cognitive Complexity · UnportableVariant::check_item (cognitive 28) src/tools/clippy/clippy_lints/src/enum_clike.rs
  • Cognitive Complexity · RedundantSlicing::check_expr (cognitive 28) src/tools/clippy/clippy_lints/src/redundant_slicing.rs
  • Cognitive Complexity · NeedlessBool::check_expr (cognitive 27) src/tools/clippy/clippy_lints/src/needless_bool.rs
  • Cognitive Complexity · ManualCheckedOps::check_expr (cognitive 26) src/tools/clippy/clippy_lints/src/manual_checked_ops.rs
  • Cognitive Complexity · Socket::connect_timeout (cognitive 25) library/std/src/sys/net/connection/socket/unix.rs
  • Cognitive Complexity · InteriorMutableConsts::check_expr (cognitive 23) compiler/rustc_lint/src/interior_mutable_consts.rs
  • Cognitive Complexity · MultipleBoundLocations::check_fn (cognitive 23) src/tools/clippy/clippy_lints/src/multiple_bound_locations.rs
  • Cognitive Complexity · OctalEscapes::check_expr (cognitive 23) src/tools/clippy/clippy_lints/src/octal_escapes.rs
  • Cognitive Complexity · UselessConcat::check_expr (cognitive 23) src/tools/clippy/clippy_lints/src/useless_concat.rs
  • Cognitive Complexity · rustc_codegen_llvm::back::write::optimize (cognitive 22) compiler/rustc_codegen_llvm/src/back/write.rs
  • Cognitive Complexity · MissingCopyImplementations::check_item (cognitive 22) compiler/rustc_lint/src/builtin.rs
  • Cognitive Complexity · UnusedResults::check_stmt (cognitive 22) compiler/rustc_lint/src/unused/must_use.rs
  • Cognitive Complexity · IneffectiveOpenOptions::check_expr (cognitive 22) src/tools/clippy/clippy_lints/src/ineffective_open_options.rs
  • Cognitive Complexity · ItemNameRepetitions::check_item (cognitive 22) src/tools/clippy/clippy_lints/src/item_name_repetitions.rs
  • Cognitive Complexity · ManualRotate::check_expr (cognitive 22) src/tools/clippy/clippy_lints/src/manual_rotate.rs
  • Cognitive Complexity · NonPanicFmt::check_expr (cognitive 21) compiler/rustc_lint/src/non_fmt_panic.rs
  • Cognitive Complexity · NonSnakeCase::check_snake_case (cognitive 21) compiler/rustc_lint/src/nonstandard_style.rs
  • Cognitive Complexity · std::sys::fs::windows::rename (cognitive 21) library/std/src/sys/fs/windows.rs
  • Cognitive Complexity · EndianBytes::check_expr (cognitive 21) src/tools/clippy/clippy_lints/src/endian_bytes.rs
  • Cognitive Complexity · MethodDef::expand_enum_method_body (cognitive 20) compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
  • Cognitive Complexity · ExplicitOutlivesRequirements::consolidate_outlives_bound_spans (cognitive 20) compiler/rustc_lint/src/builtin.rs
  • Cognitive Complexity · LetUnderscore::check_local (cognitive 20) src/tools/clippy/clippy_lints/src/let_underscore.rs
  • Cognitive Complexity · InvalidValue::check_expr::variant_find_init_error (cognitive 19) compiler/rustc_lint/src/builtin.rs
  • Cognitive Complexity · DerefNullPtr::check_expr (cognitive 19) compiler/rustc_lint/src/builtin.rs
Rebuild cost: about €3,500,000 · Estimate
Cost to rebuild€1,200,000 to €5,900,000, for 19,564 to 62,067 hours of work, about 24.3 person-years for 14 to 46 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 48. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 2,275,874 lines of product code

How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 4 points · Medium effort · Large Files
2
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.
Raises the score by about 2 points · Low effort · REDACTED Scanning
3
Bring the 2 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with rustc_codegen_gcc::intrinsic::old_archs::old_archs (cyclomatic 1362), rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cyclomatic 242).
Raises the score by about 2 points · Medium effort · Cyclomatic Complexity

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €3,500,000 to build again, about 24.3 person-years of work. Its weakest lens is Code Health, at 41 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 555,638 lines over the last 90 days, which is about 2,253,421 lines a year. At that pace, the extra work comes to an estimated 219.8 to 1319 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch rustc_abi rustc_abi rustc_data_structures rustc_data_structures rustc_abi->rustc_data_structures rustc_errors rustc_errors rustc_abi->rustc_errors rustc_index rustc_index rustc_abi->rustc_index rustc_macros rustc_macros rustc_abi->rustc_macros rustc_span rustc_span rustc_abi->rustc_span rustc_ast rustc_ast rustc_ast->rustc_data_structures rustc_ast->rustc_index rustc_ast->rustc_macros rustc_ast->rustc_span rustc_attr_ir rustc_attr_ir rustc_attr_ir->rustc_abi rustc_attr_ir->rustc_ast rustc_attr_ir->rustc_data_structures rustc_attr_ir->rustc_macros rustc_attr_ir->rustc_span rustc_structures rustc_structures rustc_attr_ir->rustc_structures rustc_attr_parsing rustc_attr_parsing rustc_attr_parsing->rustc_abi rustc_attr_parsing->rustc_ast rustc_attr_parsing->rustc_attr_ir rustc_attr_parsing->rustc_data_structures rustc_attr_parsing->rustc_errors rustc_lint_defs rustc_lint_defs rustc_attr_parsing->rustc_lint_defs rustc_attr_parsing->rustc_macros rustc_session rustc_session rustc_attr_parsing->rustc_session rustc_attr_parsing->rustc_span rustc_attr_parsing->rustc_structures rustc_target rustc_target rustc_attr_parsing->rustc_target rustc_codegen_ssa rustc_codegen_ssa rustc_codegen_ssa->rustc_abi rustc_codegen_ssa->rustc_ast rustc_codegen_ssa->rustc_attr_ir rustc_codegen_ssa->rustc_attr_parsing rustc_codegen_ssa->rustc_data_structures rustc_codegen_ssa->rustc_errors rustc_hir rustc_hir rustc_codegen_ssa->rustc_hir rustc_codegen_ssa->rustc_index rustc_codegen_ssa->rustc_lint_defs rustc_codegen_ssa->rustc_macros rustc_metadata rustc_metadata rustc_codegen_ssa->rustc_metadata rustc_middle rustc_middle rustc_codegen_ssa->rustc_middle rustc_codegen_ssa->rustc_session rustc_codegen_ssa->rustc_span rustc_codegen_ssa->rustc_structures rustc_codegen_ssa->rustc_target rustc_trait_selection rustc_trait_selection rustc_codegen_ssa->rustc_trait_selection rustc_data_structures->rustc_index rustc_data_structures->rustc_macros rustc_driver_impl rustc_driver_impl rustc_driver_impl->rustc_abi rustc_driver_impl->rustc_ast rustc_driver_impl->rustc_codegen_ssa rustc_driver_impl->rustc_data_structures rustc_driver_impl->rustc_errors rustc_driver_impl->rustc_hir rustc_driver_impl->rustc_index rustc_interface rustc_interface rustc_driver_impl->rustc_interface rustc_driver_impl->rustc_lint_defs rustc_driver_impl->rustc_macros rustc_driver_impl->rustc_metadata rustc_driver_impl->rustc_middle rustc_driver_impl->rustc_session rustc_driver_impl->rustc_span rustc_driver_impl->rustc_structures rustc_driver_impl->rustc_target rustc_errors->rustc_ast rustc_errors->rustc_data_structures rustc_errors->rustc_index rustc_errors->rustc_lint_defs rustc_errors->rustc_macros rustc_errors->rustc_span rustc_hir->rustc_abi rustc_hir->rustc_ast rustc_hir->rustc_attr_ir rustc_hir->rustc_data_structures rustc_hir->rustc_errors rustc_hir->rustc_index rustc_hir->rustc_lint_defs rustc_hir->rustc_macros rustc_hir->rustc_span rustc_hir->rustc_target rustc_index->rustc_macros rustc_interface->rustc_ast rustc_interface->rustc_attr_ir rustc_interface->rustc_attr_parsing rustc_interface->rustc_codegen_ssa rustc_interface->rustc_data_structures rustc_interface->rustc_errors rustc_interface->rustc_hir rustc_interface->rustc_lint_defs rustc_interface->rustc_macros rustc_interface->rustc_metadata rustc_interface->rustc_middle rustc_interface->rustc_session rustc_interface->rustc_span rustc_interface->rustc_structures rustc_interface->rustc_target rustc_interface->rustc_trait_selection rustc_lint_defs->rustc_ast rustc_lint_defs->rustc_data_structures rustc_lint_defs->rustc_macros rustc_lint_defs->rustc_span rustc_metadata->rustc_abi rustc_metadata->rustc_ast rustc_metadata->rustc_attr_ir rustc_metadata->rustc_attr_parsing rustc_metadata->rustc_data_structures rustc_metadata->rustc_errors rustc_metadata->rustc_hir rustc_metadata->rustc_index rustc_metadata->rustc_lint_defs rustc_metadata->rustc_macros rustc_metadata->rustc_middle rustc_metadata->rustc_session rustc_metadata->rustc_span rustc_metadata->rustc_structures rustc_metadata->rustc_target rustc_middle->rustc_abi rustc_middle->rustc_ast rustc_middle->rustc_attr_ir rustc_middle->rustc_data_structures rustc_middle->rustc_errors rustc_middle->rustc_hir rustc_middle->rustc_index rustc_middle->rustc_lint_defs rustc_middle->rustc_macros rustc_middle->rustc_session rustc_middle->rustc_span rustc_middle->rustc_structures rustc_middle->rustc_target rustc_session->rustc_abi rustc_session->rustc_ast rustc_session->rustc_data_structures rustc_session->rustc_errors rustc_session->rustc_lint_defs rustc_session->rustc_macros rustc_session->rustc_span rustc_session->rustc_structures rustc_session->rustc_target rustc_span->rustc_data_structures rustc_span->rustc_index rustc_span->rustc_macros rustc_structures->rustc_data_structures rustc_structures->rustc_macros rustc_structures->rustc_span rustc_target->rustc_abi rustc_target->rustc_data_structures rustc_target->rustc_macros rustc_target->rustc_span rustc_target->rustc_structures rustc_trait_selection->rustc_abi rustc_trait_selection->rustc_ast rustc_trait_selection->rustc_attr_ir rustc_trait_selection->rustc_data_structures rustc_trait_selection->rustc_errors rustc_trait_selection->rustc_hir rustc_trait_selection->rustc_index rustc_trait_selection->rustc_lint_defs rustc_trait_selection->rustc_macros rustc_trait_selection->rustc_middle rustc_trait_selection->rustc_session rustc_trait_selection->rustc_span rustc_trait_selection->rustc_structures __more__ +216 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

5504 modules, with 29188 dependencies between them. 16 loops run through 1122 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 5464 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 rustc_const_eval.interpret.place2 std.process3 syntax.ast.generated.tokens4 bootstrap.core.session5 rustc_span.def_id6 rustc_span.symbol7 rustc_middle.mir.syntax8 rustc_span9 rustc_middle.ty10 rustc_public.mir.body11 rustc_infer.infer12 rustc_public.ty.tys13 rustc_ast.tokenstream14 rustc_macros.symbols15 rustc_public.crate_def16 rustc_hir_id17 rustc_middle.mir18 rustc_mir_dataflow.framework.graphviz19 rustc_ast.expand.typetree20 hir21 rustc_codegen_cranelift.example.issue-7279322 rustc_lint.context23 clippy_utils.msrvs24 rustc_lint.passes25 rustc_hir.hir26 rustc_attr_ir.target27 rustc_abi28 rustc_codegen_cranelift.example.mini_core29 core.fmt30 syntax.ast.generated.nodes31 hir.semantics32 ide_assists.assist_context33 parser.test_data.parser.ok.0016_struct_flavors34 compiler_builtins.float.cmp35 parser.test_data.parser.ok.0020_type_param_bounds36 rustc_middle.mir.visit37 clippy_utils.mir38 rustc_ast.ast39 clippy_lints.default40 alloc.collections.btree.set
1 rustc_const_eval.interpret.place2422
2 std.process10211102122
3 syntax.ast.generated.tokens111011120110102
4 bootstrap.core.session11111113
5 rustc_span.def_id131514335321
6 rustc_span.symbol13651282532
7 rustc_middle.mir.syntax113327148214779
8 rustc_span26372255525742112
9 rustc_middle.ty124241173642623755852181
10 rustc_public.mir.body1176110137117119
11 rustc_infer.infer111619111212132210
12 rustc_public.ty.tys131512166314718616352
13 rustc_ast.tokenstream3122111112
14 rustc_macros.symbols123111141
15 rustc_public.crate_def132121115
16 rustc_hir_id52123211
17 rustc_middle.mir1213811232453197610
18 rustc_mir_dataflow.framework.graphviz241113112
19 rustc_ast.expand.typetree11211
20 hir8212103281267356322865
21 rustc_codegen_cranelift.example.issue-7279314111119812214
22 rustc_lint.context32121132223
23 clippy_utils.msrvs1111
24 rustc_lint.passes21212634
25 rustc_hir.hir2111925137551411171421381071
26 rustc_attr_ir.target12115
27 rustc_abi118815981141
28 rustc_codegen_cranelift.example.mini_core112112411722133239
29 core.fmt15111511
30 syntax.ast.generated.nodes121341992863910318637141991811387
31 hir.semantics1111121112312211221
32 ide_assists.assist_context11211
33 parser.test_data.parser.ok.0016_struct_flavors111111
34 compiler_builtins.float.cmp12231
35 parser.test_data.parser.ok.0020_type_param_bounds1112211122
36 rustc_middle.mir.visit347417217
37 clippy_utils.mir111311123
38 rustc_ast.ast292615566171211821113109219541
39 clippy_lints.default12114
40 alloc.collections.btree.set11121231211254
Uses a module listed above itPart of a loopThe module itself
1 rustc_const_eval.interpret.place2 std.process3 syntax.ast.generated.tokens4 bootstrap.core.session5 rustc_span.def_id6 rustc_span.symbol7 rustc_middle.mir.syntax8 rustc_span9 rustc_middle.ty10 rustc_public.mir.body11 rustc_infer.infer12 rustc_public.ty.tys13 rustc_ast.tokenstream14 rustc_macros.symbols15 rustc_public.crate_def16 rustc_hir_id17 rustc_middle.mir18 rustc_mir_dataflow.framework.graphviz19 rustc_ast.expand.typetree20 hir21 rustc_codegen_cranelift.example.issue-7279322 rustc_lint.context23 clippy_utils.msrvs24 rustc_lint.passes25 rustc_hir.hir26 rustc_attr_ir.target27 rustc_abi28 rustc_codegen_cranelift.example.mini_core29 core.fmt30 syntax.ast.generated.nodes31 hir.semantics32 ide_assists.assist_context33 parser.test_data.parser.ok.0016_struct_flavors34 compiler_builtins.float.cmp35 parser.test_data.parser.ok.0020_type_param_bounds36 rustc_middle.mir.visit37 clippy_utils.mir38 rustc_ast.ast39 clippy_lints.default40 alloc.collections.btree.setrustc_const_eval.interpret.place1std.process2syntax.ast.generated.tokens3bootstrap.core.session4rustc_span.def_id5rustc_span.symbol6rustc_middle.mir.syntax7rustc_span8rustc_middle.ty9rustc_public.mir.body10rustc_infer.infer11rustc_public.ty.tys12rustc_ast.tokenstream13rustc_macros.symbols14rustc_public.crate_def15rustc_hir_id16rustc_middle.mir17rustc_mir_dataflow.framework.graphviz18rustc_ast.expand.typetree19hir20rustc_codegen_cranelift.example.issue-7279321rustc_lint.context22clippy_utils.msrvs23rustc_lint.passes24rustc_hir.hir25rustc_attr_ir.target26rustc_abi27rustc_codegen_cranelift.example.mini_core28core.fmt29syntax.ast.generated.nodes30hir.semantics31ide_assists.assist_context32parser.test_data.parser.ok.0016_struct_flavors33compiler_builtins.float.cmp34parser.test_data.parser.ok.0020_type_param_bounds35rustc_middle.mir.visit36clippy_utils.mir37rustc_ast.ast38clippy_lints.default39alloc.collections.btree.set40242210211102122111011120110102111111131315143353211365128253211332714821477926372255525742112124241173642623755852181117611013711711911161911121213221013151216631471861635231221111121231111411321211155212321112138112324531976102411131121121182121032812673563228651411111981221432121132223111121212634211192513755141117142138107112115118815981141112112411722133239151115111213419928639103186371419918113871111121112312211221112111111111223111122111223474172171113111232926155661712118211131092195411211411121231211254+5464 more modules (most-connected shown)

At a glance — Code Health · 41% · Weak · gated by D1, D2, R2, R3, X4 ·

At a glance — Architecture · 65% · Adequate · gated by AX8 ·

At a glance — Maturity · 75% · Strong ·

At a glance — Readiness · 54% · Adequate · gated by D13 ·

At a glance — Security · 44% · Weak · gated by D28, D29, D30, D31, D36 ·

At a glance — Domain Modelling · 100% · Exemplary ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Accessibility · 54% · Adequate ·

At a glance — Performance · 97% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A02:2025 — Security Misconfiguration156High / Critical
A05:2025 — Injection72High / Critical
A07:2025 — Authentication Failures57High / Critical
A03:2025 — Software Supply Chain Failures48High / Critical

Roadmap

Begin by splitting the eight largest files into smaller, focused modules to improve maintainability and addressing the 58 high-complexity functions by breaking them down to reduce branching logic. Simultaneously, review all MD5 and SHA1 usages to replace weak cryptographic hashes with secure alternatives where protection is needed, or switch to non-cryptographic hashes for identifier derivation. Finally, resolve the 1,911 instances of unstructured logging to enable better observability and remediate the 34 high-severity secrets found in the repository history.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+4.0 ptsMediumLarge Files
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.+1.9 ptsLowREDACTED Scanning
Bring the 2 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with rustc_codegen_gcc::intrinsic::old_archs::old_archs (cyclomatic 1362), rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cyclomatic 242).+1.7 ptsMediumCyclomatic Complexity
Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 5 sites, not one: `compiler/rustc_span/src/lib.rs:1832` (`Md5::digest`), `compiler/rustc_span/src/lib.rs:1835` (`Sha1::digest`), `compiler/rustc_span/src/lib.rs:1887` (`Sha1::new`), `compiler/rustc_span/src/lib.rs:1899` (`Md5::new`), `src/tools/coverage-dump/src/llvm_utils.rs:44` (`Md5::new`). Each is a separate decision — fixing only the line this row cites leaves the others in place.+3.0 ptsMediumWeb-Security Posture
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.+2.4 ptsMediumCyclomatic Complexity
Interpolated log message defeats structured logging+2.4 ptsMediumStructured logging
Resolve the 34 High secret finding(s) in Secrets (history) — start with REDACTED (32), REDACTED (2).+2.3 ptsMediumSecrets (history)
Resolve the 1 Yanked release finding(s) in Dependency Hygiene.+1.1 ptsLowDependency Hygiene

File quality

Per-file score 0–10 — a quality signature. Of 3232 files carrying findings, judged against the Production bar: 0% slop · 57% mixed · 43% near-clean.

FileScoreBandWorst signal
REDACTED0.5SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED1.6SlopREDACTED Scanning: Leaked secret: REDACTED
REDACTED2.3SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.3SlopSecrets (history): REDACTED: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.5SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.4MixedSecrets (history): High secret: REDACTED

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 169

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 12915

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 235

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 9

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 89 of 89 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 89 dimensions across the health lenses
D1D2D3D4D5D6D9D12D13D14D15D16D17D19D20D26D28D29D30D31D34D35D36D43D44AC2AC3AC5AC6AC7AX10AX3AX4AX6AX8AX9DM1DM2DM4DM5ES1ES2M1M2M3M4P1P10P2P3P4P5P6PF1PF3R1R10R11R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 13127 of 13319 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a17584-a5de-7f8d-8bcd-b6ebd3d3aa45.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.rs, .ts) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .ts) and this repository declares a Cargo test suite (repository root, 1241 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A hotspot's complexity is meant to be the worst body its churn actually touched. For compiler/rustc_feature/src/unstable.rs, src/tools/compiletest/src/common.rs, clippy_utils/src/ty/mod.rs, clippy_lints/src/returns/needless_return.rs, clippy_lints/src/indexing_slicing.rs, … that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D31 IaC & Container Security — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `src/librustdoc/html/static/js/rustdoc.d.ts`, `src/librustdoc/html/static/js/stringdex.d.ts` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via REDACTED (REDACTED). docker build failed (exit 1) — node:24.16-slim@sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f: failed to resolve source metadata for docker.io/library/node:24.16-slim@sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f: failed to do request: Head "https://registry-1.docker.io/v2/library/node/manifests/sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f": Forbidden; runtime evidence skipped.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 16 further occurrence(s) are not listed individually; the score already reflects all 56.
  • X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1871 further occurrence(s) are not listed individually; the score already reflects all 1911.

Repo exclusion declarations: 8 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity3.3 / 10Weak✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 3.3 / 10 · rule-coverage 100% · ceiling Prevented

1529 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was rustc_codegen_gcc::intrinsic::old_archs::old_archs at 1362. A further 299 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being rustc_codegen_gcc::intrinsic::llvm::intrinsic at 630 — they are counted neither in the figure above nor in this dimension's score. 100 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: compiler/rustc_feature/src/unstable.rs (Features::internal at 265), compiler/rustc_attr_ir/src/encode_cross_crate.rs (AttributeKind::is_extern_indicator at 195), compiler/rustc_hir_analysis/src/check/intrinsic.rs (rustc_hir_analysis::check::intrinsic::check_intrinsic_type at 157), library/compiler-builtins/libm-test/src/domain.rs (libm_test::domain::get_domain at 93), library/core/src/io/error.rs (ErrorKind::from_prim at 88), and 95 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

clippy_lints::doc::check_doc (cyclomatic 72) · ×80src/tools/clippy/clippy_lints/src/doc/mod.rs:1116
FnCtxt::suggest_traits_to_import (cyclomatic 84) · ×56compiler/rustc_hir_typeck/src/method/suggest.rs:4140
ide::hover::render::definition (cyclomatic 64) · ×40src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446
rustdoc::html::render::search_index::build_index (cyclomatic 84) · ×38REDACTED:1267
rustc_hir_analysis::check::check::check_item_type (cyclomatic 62) · ×33compiler/rustc_hir_analysis/src/check/check.rs:762

+ 452 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 2 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with rustc_codegen_gcc::intrinsic::old_archs::old_archs (cyclomatic 1362), rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cyclomatic 242). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 2 together lifts Cyclomatic Complexity from 3.3 to about 5.1/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity3.0 / 10Weak✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 3.0 / 10 · rule-coverage 100% · ceiling Prevented

2477 method(s) exceeded the cognitive complexity threshold of 15; the worst was stringdex.loadDatabase at 397.

clippy_lints::doc::check_doc (cognitive 127) · ×153src/tools/clippy/clippy_lints/src/doc/mod.rs:1116
FnCtxt::suggest_traits_to_import (cognitive 190) · ×88compiler/rustc_hir_typeck/src/method/suggest.rs:4140
rustc_hir_analysis::check::check::check_item_type (cognitive 86) · ×61compiler/rustc_hir_analysis/src/check/check.rs:762
rustdoc::html::render::search_index::build_index (cognitive 175) · ×59REDACTED:1267
Parser::parse_fn_front_matter (cognitive 73) · ×57compiler/rustc_parse/src/parser/function.rs:413

+ 669 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cognitive Complexity — start with stringdex.loadDatabase (cognitive 397), rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic (cognitive 363), rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cognitive 328). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cognitive Complexity from 3.0 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes8.4 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.4 / 10 · rule-coverage 100% · ceiling Prevented

1339 god class(es) detected.

FileTooLong: x86/avx512f.rs · ×497library/stdarch/crates/core_arch/src/x86/avx512f.rs
MethodTooLong: DocSearch.execQuery · ×328REDACTED:2155
FunctionTooLong: stringdex.loadDatabase · ×257src/librustdoc/html/static/js/stringdex.js:1089
TooManyMethods: FnCtxt · ×109compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs:46
ClassTooLong: LateResolutionVisitor · ×109compiler/rustc_resolve/src/late.rs:841

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 497 FileTooLong finding(s) in God Classes — start with mod.rs (45), lib.rs (25), diagnostics.rs (15). — One of this dimension's main actionable groups (497 warning-level).
  2. Resolve the 328 MethodTooLong finding(s) in God Classes — start with mod.rs (22), lib.rs (16), diagnostics.rs (13). — One of this dimension's main actionable groups (328 warning-level).
  3. Resolve the 257 FunctionTooLong finding(s) in God Classes — start with mod.rs (12), lib.rs (10), asm.rs (8). — One of this dimension's main actionable groups (257 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication9.8 / 10Stronggated by 857 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

831 duplicated block group(s) detected. A further 26 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 46 of the 857 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (5 lines × 2) · ×79compiler/rustc_ast/src/ast.rs:177
Duplicated block (8 lines × 2) · ×59compiler/rustc_ast_pretty/src/pprust/state/item.rs:364
Duplicated block (7 lines × 2) · ×59compiler/rustc_ast/src/ast.rs:1585
Duplicated block (6 lines × 2) · ×59compiler/rustc_ast_lowering/src/item.rs:377
Duplicated block (9 lines × 2) · ×52compiler/rustc_ast_pretty/src/pprust/state/expr.rs:1016

+ 155 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 79 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with simd.rs (5), mod.rs (3), arc.rs (3). — One of this dimension's main actionable groups (79 warning-level).
  2. Resolve the 59 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with simd.rs (8), type_.rs (2), wfcheck.rs (2). — One of this dimension's main actionable groups (59 warning-level).
  3. Resolve the 59 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with mod.rs (7), expr.rs (3), builder.rs (3). — One of this dimension's main actionable groups (59 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling7.4 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 7.4 / 10 · rule-coverage 100% · ceiling Prevented

236 production modules (Cargo+npm), 0 dependency cycle(s), 35 unstable depended-on module(s). Read from the build's own module declarations; 36 module(s) off the main sequence, with abstractness counted on 181 of the 236 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: build_helper · ×34
Unstable project hir-ide
Unstable project ide
Unstable project ide-diagnostics
Unstable project load-cargo

+ 32 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 34 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (34 warning-level).
  2. Resolve the 1 Unstable project hir-ide finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project ide finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.7 / 10Stronggated by 73 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Verified

73 of 2646 classes have LCOM4 above 3.

Low cohesion: Builder (LCOM4 37) · ×73compiler/rustc_codegen_llvm/src/llvm/ffi.rs:717

What to do

  1. Resolve the 73 Low cohesion finding(s) in Cohesion (LCOM4) — start with mod.rs (9), lib.rs (5), context.rs (2). — One of this dimension's main actionable groups (73 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

14851 test methods: 11073 unit, 3778 integration, 0 BDD, 0 e2e. The Rust suite contributes 14828 `#[test]` function(s) across 1241 file(s) declaring at least one; its unit/integration split is Cargo's own — 446 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 23 test function(s) across 1 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D12 · Dependency Hygiene7.5 4.7 / 10Weak✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 4.7 / 10 · rule-coverage 63% · ceiling Verified

72 outdated, 1 yanked direct Cargo dependencies. 187 of 299 direct crates were graded against crates.io (0 not published there, 112 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Yanked release: aes
Outdated: annotate-snippets · ×72

What to do

  1. Resolve the 1 Yanked release finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).
  2. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning0.0 / 10Critical✓ Tool-verified

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Prevented

3 secret(s) detected.

REDACTED

What to do

  1. Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
  2. Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 501 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 484 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: src/intrinsic/archs.rs (3×8835=26505); compiler/rustc_passes/src/check_attr.rs (57×194=11058); src/intrinsic/llvm.rs (15×630=9450) Repeated repair below the complexity floor: src/tools/clippy/clippy_lints/src/functions/must_use.rs (3 of 3 changes were fixes)

Hotspot: src/intrinsic/archs.rs · ×483src/intrinsic/archs.rs:4
Repeated repair: src/tools/clippy/clippy_lints/src/functions/must_use.rssrc/tools/clippy/clippy_lints/src/functions/must_use.rs:142

What to do

  1. Resolve the 483 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (36), lib.rs (11), main.rs (9). — One of this dimension's main actionable groups (483 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with must_use.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor8.9 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 100% · ceiling Documented

294 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is library/stdarch/crates/core_arch/src/s390x/vector.rs. Counted over 2618 of the 6258 production source files in this repository: 3624 are under the ~2,400-byte size floor this dimension measures over, and the remaining 16 have no attributable history left to measure.

Off-boarding risk: anonymized user #1 · ×26
Further sole-owners (lower concentration)

What to do

  1. Resolve the 26 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (26 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.5 / 10Stronggated by 5815 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Prevented

6184 deducted task-comment markers across 2275874 LoC (0.3/KLoC) → score 9.5. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

FixmeComment · ×5302tests/ui-fulldeps/pprust-parenthesis-insertion.rs:52
TodoComment · ×273tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.rs:35
HackComment · ×192tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs:29
XxxComment · ×35src/tools/rust-analyzer/crates/test-fixture/src/lib.rs:1056
FixmeComment repeated across 10 files · ×3tests/ui/panics/issue-47429-short-backtraces.rs:22

+ 9 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 5302 FixmeComment finding(s) in Explicit Debt — start with mod.rs (379), lib.rs (184), foreign_items.rs (85). — One of this dimension's main actionable groups (5302 warning-level).
  2. Resolve the 273 TodoComment finding(s) in Explicit Debt — start with mod.rs (9), struct_field_doc_comment.rs (8), format_push_string_unfixable.rs (8). — One of this dimension's main actionable groups (273 warning-level).
  3. Resolve the 192 HackComment finding(s) in Explicit Debt — start with mod.rs (16), pretty.rs (6), check.rs (6). — One of this dimension's main actionable groups (192 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 813 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion7.7 / 10Strong✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic, LLM-independent.

Maturity: Documented → Verified → Prevented · effective 7.7 / 10 · rule-coverage 100% · ceiling Documented

27 of 235 build units (Cargo, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)0.0 / 10Critical✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

52 finding(s): 0 critical, 52 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 34 High secret finding(s) in Secrets (history) — start with REDACTED (32), REDACTED (2). — One of this dimension's main actionable groups (34 issue-level).
  2. Resolve the 18 REDACTED finding(s) in Secrets (history) — start with REDACTED (8), REDACTED (4), REDACTED (4). — One of this dimension's main actionable groups (18 issue-level).
  3. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.1 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.1 / 10 · rule-coverage 100% · ceiling Documented

79 finding(s): 0 critical, 8 high, 67 medium, 4 low. semgrep hit a parse error in 211 file(s) — `RELEASES.md`, `compiler/rustc_abi/src/lib.rs` (line 274, line 1817), `compiler/rustc_ast_lowering/src/delegation/generics.rs` (line 96, line 200), `compiler/rustc_attr_parsing/src/attributes/link_attrs.rs` (line 158, line 159, line 162), `compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs` (line 161, line 2485, line 2486, …), … (+206 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 21 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 9 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

42 finding(s): 0 critical, 15 high, 27 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 15 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (13), REDACTED (2). — One of this dimension's main actionable groups (15 issue-level).
  2. Resolve the 10 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (10). — One of this dimension's main actionable groups (10 warning-level).
  3. Resolve the 9 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (8), REDACTED. — One of this dimension's main actionable groups (9 warning-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security0.0 / 10Critical✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

156 finding(s): 0 critical, 75 high, 80 medium, 1 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 80 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (80). — One of this dimension's main actionable groups (80 warning-level).
  2. Resolve the 75 High IaC finding(s) in IaC & Container Security — start with REDACTED (75). — One of this dimension's main actionable groups (75 issue-level).
  3. Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness9.9 / 10Adequategated by 4 critical findings✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

24 of 2634 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is compiler/rustc_thread_pool/src/lib.rs. Counted over 2634 of the 6258 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×4compiler/rustc_thread_pool/src/lib.rs:1
Orphaned file · ×20library/std/src/sys/net/connection/motor.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 4 Orphaned knowledge finding(s) in Knowledge Freshness — start with lib.rs, tests.rs, project_json.rs. — One of this dimension's main actionable groups (4 issue-level).
  2. Resolve the 20 Orphaned file finding(s) in Knowledge Freshness — start with main.rs (2), motor.rs, directive.rs. — One of this dimension's main actionable groups (20 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling10.0 / 10Stronggated by 3 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: context.rs↔mod.rs 67%; encode_cross_crate.rs↔builtin_attrs.rs 67%; mod.rs↔intrinsic.rs 67%

Change coupling: context.rs ↔ mod.rs · ×2compiler/rustc_infer/src/infer/context.rs:1
Change-coupling hub: builtin_attrs.rs → data_structures.rs, encode_cross_crate.rs, check_attr.rscompiler/rustc_feature/src/builtin_attrs.rs

What to do

  1. Resolve the 2 Change coupling finding(s) in Change Coupling — start with context.rs, mod.rs. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with builtin_attrs.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

1/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 0 platform declaration(s) and 6 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC2 · Forms & labels7.2 / 10Strong✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — REDACTED:5244

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure5.2 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×3) — compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:2, REDACTED:2, REDACTED:2
  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×4) — compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:2, REDACTED:2, REDACTED:2, …

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety4.6 / 10Weak✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `#main-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/librustdoc/html/static/css/rustdoc.css:1135
  • `details.toggle > summary` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/librustdoc/html/static/css/rustdoc.css:2451
  • `.github-corner:hover .octo-arm` moves (`animation: octocat-wave 560ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/tools/clippy/util/gh-pages/style.css:742
  • `.github-corner .octo-arm` moves (`animation: octocat-wave 560ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/tools/clippy/util/gh-pages/style.css:763
  • `.settings-menu.rotate > a img` moves (`animation: rotating 2s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/librustdoc/html/static/css/rustdoc.css:2386

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 19 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.

What to do

  • Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
AX10 · Code composition9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX6 · Interface segregation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

AX8 · Test isolation0.0 / 10Critical✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

  • `compiletest` (production) references the test project `miropt-test-tools`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `sysroot` (production) references the test project `test`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `tidy` (production) references the test project `miropt-test-tools`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `util` (production) references the test project `libm-test`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.

What to do

  • Remove every production → test project reference: extract any shared test helper into a production support library (which the tests reference), or invert the dependency so the test project depends on production — not the reverse.
AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

  • `xous$module.get_env_store` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command. — library/std/src/sys/env/xous.rs:12

What to do

  • Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
DM1 · Aggregate boundaries10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether an aggregate references another aggregate by identity rather than embedding it by object reference.

Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.

Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.

DM2 · Strongly-typed ids10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.

Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.

Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.

DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.

Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)7.1 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 214 of 270 project(s) that lack one — worth up to 1.6 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability7.6 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 87/161 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `compiler/rustc`, `compiler/rustc_codegen_cranelift/build_system`, `compiler/rustc_codegen_gcc/build_system`, `compiler/rustc_codegen_gcc/build_system/asm-tester` and 69 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add a health-check endpoint (a /health route on your axum/actix router) so orchestrators and load balancers can probe liveness/readiness.
P3 · Security & performance tooling6.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P5 · DR & Backup4.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
  • Enable purge protection / soft-delete (and prevent_destroy on critical resources) so data stores can't be lost to an accidental or malicious delete.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

PF1 · Benchmark discipline9.5 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

R10 · Code Duplication8.7 / 10Strong✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.

  • src/librustdoc/html/static/.eslintrc.js:1 · src/tools/rustdoc-js/.eslintrc.js:1 — these 2 files are line-for-line copies of one another — 66 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — src/librustdoc/html/static/.eslintrc.js:1
  • src/librustdoc/html/static/js/stringdex.js:1941 · src/librustdoc/html/static/js/stringdex.js:2441 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:1941
  • src/tools/rust-analyzer/editors/code/src/commands.ts:210 · src/tools/rust-analyzer/editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/tools/rust-analyzer/editors/code/src/commands.ts:210
  • src/tools/rust-analyzer/editors/code/src/commands.ts:722 · src/tools/rust-analyzer/editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/tools/rust-analyzer/editors/code/src/commands.ts:722
  • src/librustdoc/html/static/js/stringdex.js:27 · src/librustdoc/html/static/js/stringdex.js:118 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:27
  • src/librustdoc/html/static/js/stringdex.js:3117 · src/librustdoc/html/static/js/stringdex.js:3155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:3117
  • src/librustdoc/html/static/js/stringdex.js:2646 · src/librustdoc/html/static/js/stringdex.js:2710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:2646
  • src/librustdoc/html/static/js/stringdex.js:1805 · src/librustdoc/html/static/js/stringdex.js:2355 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:1805
  • REDACTED:3437 · REDACTED:3473 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:3437
  • REDACTED:3182 · REDACTED:3381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:3182
  • src/librustdoc/html/static/js/stringdex.js:2160 · src/librustdoc/html/static/js/stringdex.js:2220 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:2160
  • REDACTED:2979 · REDACTED:3312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:2979
  • src/librustdoc/html/static/js/stringdex.js:2203 · src/librustdoc/html/static/js/stringdex.js:2259 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:2203
  • src/librustdoc/html/static/js/stringdex.js:4040 · src/librustdoc/html/static/js/stringdex.js:4347 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:4040
  • src/librustdoc/html/static/js/stringdex.js:371 · src/librustdoc/html/static/js/stringdex.js:494 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:371
  • src/librustdoc/html/static/js/stringdex.js:404 · src/librustdoc/html/static/js/stringdex.js:517 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:404
  • src/tools/rust-analyzer/editors/code/src/commands.ts:622 · src/tools/rust-analyzer/editors/code/src/commands.ts:727 · src/tools/rust-analyzer/editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — src/tools/rust-analyzer/editors/code/src/commands.ts:622
  • src/librustdoc/html/static/js/main.js:1595 · src/librustdoc/html/static/js/settings.js:354 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/main.js:1595
  • src/librustdoc/html/static/js/stringdex.js:3632 · src/librustdoc/html/static/js/stringdex.js:3649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:3632
  • REDACTED:2450 · REDACTED:2468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:2450
  • src/librustdoc/html/static/js/stringdex.js:716 · src/librustdoc/html/static/js/stringdex.js:766 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:716
  • src/librustdoc/html/static/js/stringdex.js:3225 · src/librustdoc/html/static/js/stringdex.js:3263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:3225
  • src/tools/rust-analyzer/editors/code/src/commands.ts:648 · src/tools/rust-analyzer/editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/tools/rust-analyzer/editors/code/src/commands.ts:648
  • src/librustdoc/html/static/js/stringdex.js:906 · src/librustdoc/html/static/js/stringdex.js:988 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:906
  • src/librustdoc/html/static/js/stringdex.js:3502 · src/librustdoc/html/static/js/stringdex.js:3555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:3502
  • src/librustdoc/html/static/js/stringdex.js:3516 · src/librustdoc/html/static/js/stringdex.js:3597 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:3516
  • src/tools/rust-analyzer/editors/code/src/commands.ts:1032 · src/tools/rust-analyzer/editors/code/src/commands.ts:1067 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/tools/rust-analyzer/editors/code/src/commands.ts:1032
  • src/tools/rust-analyzer/editors/code/src/commands.ts:1058 · src/tools/rust-analyzer/editors/code/src/commands.ts:1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/tools/rust-analyzer/editors/code/src/commands.ts:1058
  • REDACTED:1616 · REDACTED:1672 · REDACTED:1697 · REDACTED:1774 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1616
  • REDACTED:1811 · REDACTED:1824 · REDACTED:1877 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — REDACTED:1811
  • REDACTED:5526 · src/librustdoc/html/static/js/stringdex.js:3701 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:5526
  • src/librustdoc/html/static/js/stringdex.js:457 · src/librustdoc/html/static/js/stringdex.js:566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:457
  • src/librustdoc/html/static/js/stringdex.js:2285 · src/librustdoc/html/static/js/stringdex.js:2551 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:2285
  • src/tools/rust-analyzer/editors/code/src/commands.ts:102 · src/tools/rust-analyzer/editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/tools/rust-analyzer/editors/code/src/commands.ts:102
  • src/tools/rustdoc-js/tester.js:199 · src/tools/rustdoc-js/tester.js:246 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/tools/rustdoc-js/tester.js:199
  • src/librustdoc/html/static/js/main.js:38 · src/librustdoc/html/static/js/main.js:167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/main.js:38
  • REDACTED:4096 · REDACTED:4120 · REDACTED:4143 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:4096
  • REDACTED:5014 · REDACTED:5054 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:5014
  • src/librustdoc/html/static/js/stringdex.js:940 · src/librustdoc/html/static/js/stringdex.js:1013 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/librustdoc/html/static/js/stringdex.js:940
  • src/librustdoc/html/static/js/stringdex.js:3086 · src/librustdoc/html/static/js/stringdex.js:3098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/librustdoc/html/static/js/stringdex.js:3086

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R11 · Import Boundaries8.8 / 10Strong✓ Tool-verified

React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).

Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.

  • src/tools/rust-analyzer/editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/tools/rust-analyzer/editors/code/src/client.ts:5
  • src/tools/rust-analyzer/editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/tools/rust-analyzer/editors/code/src/config.ts:1

What to do

  • Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
R2 · Cyclomatic Complexity3.0 / 10Weak✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • makeSearchTreeFromBase64 has cyclomatic complexity 59 and cognitive complexity 195; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:3009
  • unifyFunctionTypes has cyclomatic complexity 47 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2979
  • unpackPostingsList has cyclomatic complexity 37 and cognitive complexity 80; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:4256
  • makeBranchesFromBinaryData has cyclomatic complexity 36 and cognitive complexity 93; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:3045
  • getNextElem has cyclomatic complexity 36 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:594
  • innerRunNameQuery has cyclomatic complexity 34 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3940
  • unifyFunctionTypeIsMatchCandidate has cyclomatic complexity 33 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3524
  • constructor has cyclomatic complexity 32 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:17
  • prefixMatches has cyclomatic complexity 31 and cognitive complexity 83; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:2031
  • buildItemSearchType has cyclomatic complexity 31 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1998
  • intersection has cyclomatic complexity 30 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:486
  • union has cyclomatic complexity 28 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/librustdoc/html/static/js/stringdex.js:363
  • (anonymous) has cyclomatic complexity 28 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2809
  • getItemsBefore has cyclomatic complexity 28 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:440
  • writeFn has cyclomatic complexity 27 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2504
  • getRow has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1896
  • valueCheck has cyclomatic complexity 23 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/tools/rustdoc-js/tester.js:156
  • unifyGenericTypes has cyclomatic complexity 23 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3312
  • transformResults has cyclomatic complexity 22 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2660
  • getIdentEndPosition has cyclomatic complexity 22 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:964

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files0.0 / 10Critical✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • REDACTED has 5386 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • src/librustdoc/html/static/js/stringdex.js has 4322 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/librustdoc/html/static/js/stringdex.js:1
  • src/librustdoc/html/static/js/main.js has 2107 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/librustdoc/html/static/js/main.js:1
  • src/tools/rust-analyzer/editors/code/src/commands.ts has 1416 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/tools/rust-analyzer/editors/code/src/commands.ts:1
  • src/tools/rustdoc-js/tester.js has 619 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/tools/rustdoc-js/tester.js:1
  • src/tools/rust-analyzer/editors/code/src/ctx.ts has 572 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/tools/rust-analyzer/editors/code/src/ctx.ts:1
  • src/tools/rust-analyzer/editors/code/src/config.ts has 546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/tools/rust-analyzer/editors/code/src/config.ts:1
  • src/librustdoc/html/static/js/storage.js has 409 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/librustdoc/html/static/js/storage.js:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage6.7 / 10Adequate✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×10) — REDACTED:1, src/librustdoc/html/static/js/stringdex.js:1, src/librustdoc/html/static/js/main.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness9.4 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 20 application, 6 tooling and 157 test entry point(s) detected in this repo. Gate removals on `yarn run build-base` — an undetected custom entry would make these reachable.
  • no import path from any entry point (20 application, 6 tooling, 157 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×2) — src/tools/error_index_generator/redirect.js, src/tools/error_index_generator/error-index.js
  • Nothing imports this binding — it is safe to review for removal. (×2) — src/tools/rust-analyzer/editors/code/src/lsp_ext.ts:160, REDACTED:231

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene4.5 / 10Weak✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Imported but not declared in any reachable package.json — installs work only by hoisting accident. — src/tools/rust-analyzer/editors/code/src/config.ts:7
  • Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×2)
  • Declared in src/tools/rust-analyzer/editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports8.3 / 10Strong✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

  • src/tools/rust-analyzer/editors/code/src/debug.ts → src/tools/rust-analyzer/editors/code/src/run.ts → src/tools/rust-analyzer/editors/code/src/debug.ts — src/tools/rust-analyzer/editors/code/src/debug.ts:8

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.
S1 · Web-Security Posture6.0 / 10Adequate✓ Tool-verified

Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. The server controls — HTTPS enforcement, HSTS, cookie flags, input validation — are read from a Rust server this repository starts itself, and its production Rust starts none. What serves its HTTP is outside the Rust source, and only what this card names about it was assessed.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. (×5) — compiler/rustc_span/src/lib.rs:1832, compiler/rustc_span/src/lib.rs:1835, compiler/rustc_span/src/lib.rs:1887, …
  • `https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. — compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:90

What to do

  • Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 5 sites, not one: `compiler/rustc_span/src/lib.rs:1832` (`Md5::digest`), `compiler/rustc_span/src/lib.rs:1835` (`Sha1::digest`), `compiler/rustc_span/src/lib.rs:1887` (`Sha1::new`), `compiler/rustc_span/src/lib.rs:1899` (`Md5::new`), `src/tools/coverage-dump/src/llvm_utils.rs:44` (`Md5::new`). Each is a separate decision — fixing only the line this row cites leaves the others in place.
  • Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `from_dict` is public and takes `data: JsonType` from its caller, and it calls itself at line 119 (`from_dict`) with a piece of `data` (and at line 123, line 130, line 137, line 151) — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/etc/debugger_tester/common.py:119

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation5.3 / 10Adequate✓ Tool-verified

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

  • `debug` at line 71 is called with an argument built by `JSON.stringify(debugConfig, null, 2)` (line 71), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — src/tools/rust-analyzer/editors/code/src/debug.ts:71

What to do

  • Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
X24 · Document value interpolated into markup unescaped3.7 / 10Weak✓ Tool-verified

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

  • `window.searchState.loadingText` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:508
  • `id` is text this program did not author, and it is written into a URL attribute through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:727
  • `struct[TEXT_IDX]` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:872
  • `text` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1016
  • `lines.map((line,index)=>generateLine(index+1)+line).join("\n")` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1255
  • `window.NOTABLE_TRAITS[notable_ty]` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1355
  • `drloChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/librustdoc/html/static/js/main.js:1618
  • `y` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1635
  • `x[1]` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1636
  • `x` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/main.js:1658
  • `path` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/librustdoc/html/static/js/main.js:1831
  • `title` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/librustdoc/html/static/js/scrape-examples.js:91
  • `typeName` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:4989
  • `obj.displayPath` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:5001
  • `desc` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:5008
  • `dlroChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. (×3) — REDACTED:5129, REDACTED:5131, REDACTED:5133
  • `getNakedUrl()` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. (×3) — REDACTED:5139, REDACTED:5140, REDACTED:5141
  • ``Query parser error: "${error.join("")}".`` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:5186
  • `c` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:5248
  • `newHref` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/librustdoc/html/static/js/storage.js:248
  • `currentUrl` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/librustdoc/html/static/js/storage.js:399
  • `rootPath` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. (×4) — src/librustdoc/html/static/js/storage.js:402, src/librustdoc/html/static/js/storage.js:405, src/librustdoc/html/static/js/storage.js:432, …

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 · Exception handling6.2 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — src/tools/rust-analyzer/lib/smol_str/src/gdb_smolstr_printer.py:54, src/etc/debugger_tester/gdb/from_gdb.py:66, src/etc/debugger_tester/gdb/from_gdb.py:277
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×3) — src/tools/rust-analyzer/lib/smol_str/src/gdb_smolstr_printer.py:117, REDACTED:353, src/librustdoc/html/static/js/storage.js:176
  • `.catch((_) => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. — src/tools/rust-analyzer/editors/code/src/ctx.ts:442

What to do

  • Swallowed exception (caught, then discarded)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging3.0 / 10Weak✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `debug!` at line 152 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/attr.rs:152
  • `debug!` at line 150 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/chains.rs:150
  • `debug!` at line 560 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/chains.rs:560
  • `debug!` at line 43 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/closures.rs:43
  • `debug!` at line 363 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/closures.rs:363
  • `trace!` at line 162 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/comment.rs:162
  • `debug!` at line 1813 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/comment.rs:1813
  • `debug!` at line 936 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:936
  • `debug!` at line 1201 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:1201
  • `debug!` at line 1669 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:1669
  • `debug!` at line 1819 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:1819
  • `debug!` at line 2038 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:2038
  • `debug!` at line 2123 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/expr.rs:2123
  • `debug!` at line 476 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/formatting.rs:476
  • `debug!` at line 56 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/items.rs:56
  • `debug!` at line 2549 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/items.rs:2549
  • `debug!` at line 2943 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/items.rs:2943
  • `debug!` at line 588 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/macros.rs:588
  • `debug!` at line 1090 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/macros.rs:1090
  • `debug!` at line 1142 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/macros.rs:1142
  • `debug!` at line 1417 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/macros.rs:1417
  • `debug!` at line 614 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/matches.rs:614
  • `debug!` at line 159 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/missed_spans.rs:159
  • `debug!` at line 198 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/missed_spans.rs:198
  • `warn!` at line 484 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/modules.rs:484
  • `debug!` at line 625 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/overflow.rs:625
  • `debug!` at line 641 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/overflow.rs:641
  • `debug!` at line 328 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/types.rs:328
  • `debug!` at line 1102 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/types.rs:1102
  • `debug!` at line 119 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/visitor.rs:119
  • `debug!` at line 228 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/visitor.rs:228
  • `debug!` at line 289 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/visitor.rs:289
  • `debug!` at line 38 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/modules/visitor.rs:38
  • `debug!` at line 98 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. (×2) — src/tools/rustfmt/src/modules/visitor.rs:98, src/tools/rustfmt/src/format-diff/main.rs:98
  • `debug!` at line 33 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/git-rustfmt/main.rs:33
  • `debug!` at line 120 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/git-rustfmt/main.rs:120
  • `debug!` at line 203 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/git-rustfmt/main.rs:203
  • `debug!` at line 205 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/git-rustfmt/main.rs:205
  • `debug!` at line 97 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/tools/rustfmt/src/format-diff/main.rs:97

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types9.3 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • ~1.7 `!` null assertions per 1k TypeScript source lines — 12 assertion(s) across the 7036 source line(s) of the 19 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: src/tools/rust-analyzer/editors/code/src/dependencies_provider.ts (3), src/tools/rust-analyzer/editors/code/src/client.ts (2), src/tools/rust-analyzer/editors/code/src/commands.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 45 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.1, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health41%Weak — gated by D1, D2, R2, R3, X4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture65%Adequate — gated by AX8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity75%StrongSolid.
Readiness54%Adequate — gated by D13Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security44%Weak — gated by D28, D29, D30, D31, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Event Sourcing100%ExemplarySolid.
Accessibility54%AdequateAcceptable, with room to improve.
Performance97%ExemplarySolid.
Unscored — 4 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 30 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 46 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — docker build failed (exit 1) — node:24.16-slim@sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f: failed to resolve source metadata for docker.io/library/node:24.16-slim@sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f: failed to do request: Head "https://registry-1.docker.io/v2/library/node/manifests/sha256:ca520832af80fa37a57c14077ed0fcdd83b5aefccc356059fdc3a9a05b78ae1f": Forbidden; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~1098258 lines of test source are present (.rs, .ts) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Python, Rust, TypeScript, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (syntax), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .rs, .ts, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — 2 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM3 Integration-event coupling — no integration events detected — coupling check not applicable
  • DM6 Domain ↔ infrastructure boundary — this Rust crate maps no type to a persistence framework (diesel/sea-orm/sqlx), so DM6's domain↔infrastructure fusion read has no population to be taken over
  • DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 169 finding(s)
D31 · IaC & Container Security · High IaC · ×75
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 50 more in this group — see findings.md.
D28 · Secrets (history) · High secret · ×34
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 9 more in this group — see findings.md.
D28 · Secrets (history) · REDACTED · ×18
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×15
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AX8 · Test isolation · Production project references a test project · ×4
  • Production project references a test project: compiletest → miropt-test-tools — `compiletest` (production) references the test project `miropt-test-tools`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: sysroot → test — `sysroot` (production) references the test project `test`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: tidy → miropt-test-tools — `tidy` (production) references the test project `miropt-test-tools`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: util → libm-test — `util` (production) references the test project `libm-test`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
D13 · REDACTED Scanning · Leaked secret · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×4
  • Orphaned knowledge compiler/rustc_thread_pool/src/lib.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
  • Orphaned knowledge src/tools/miri/src/borrow_tracker/tree_borrows/tree/tests.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
  • Orphaned knowledge src/tools/rust-analyzer/crates/project-model/src/project_json.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge src/tools/rustfmt/src/attr.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
AC3 · Page structure · <html> without a lang · ×3
  • <html> without a lang compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:2 — The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
  • <html> without a lang REDACTED:2 — The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
  • <html> without a lang REDACTED:2 — The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <select> without a programmatic label · ×1
  • <select> without a programmatic label REDACTED:5244 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: xous$module.get_env_store library/std/src/sys/env/xous.rs:12 — `xous$module.get_env_store` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
R8 · Dependency Hygiene · Unlisted import 'lodash' · ×1
  • Unlisted import 'lodash' src/tools/rust-analyzer/editors/code/src/config.ts:7 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
R9 · Circular Imports · Import cycle (2 files) · ×1
  • Import cycle (2 files) src/tools/rust-analyzer/editors/code/src/debug.ts:8 — src/tools/rust-analyzer/editors/code/src/debug.ts → src/tools/rust-analyzer/editors/code/src/run.ts → src/tools/rust-analyzer/editors/code/src/debug.ts
Serious — 12915 finding(s)
D17 · Explicit Debt · FixmeComment · ×5302
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:52 — // FIXME: Some of them shouldn't be. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:139 — // FIXME: no parentheses needed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:141 — // FIXME: pretty-printer produces invalid syntax. `2 + 2 as T < U` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:145 — // FIXME: pretty-printer produces invalid syntax. `if (let _ = () && Struct {}.x) {}` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:149 — // FIXME: pretty-printer produces invalid syntax. `for _ in 1..{ 2 } {}` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:153 — // FIXME: pretty-printer loses the attribute. `{ let Struct { field } = s; }` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/pprust-parenthesis-insertion.rs:157 — // FIXME: pretty-printer turns this into a range. `0..to_string()` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/rustc_public/check_allocation.rs:166 — // FIXME(rustc_public): add `read_ptr` to `Allocation` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/rustc_public/check_crate_defs.rs:47 — // FIXME: We are currently missing primitive type methods and trait implementations for external — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs:2 — // FIXME(bootstrap): Remove the ignore once we promote the next beta. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/internal-lints/missing-generic-type-visitable-derive.rs:2 — // FIXME(bootstrap): Remove the ignore once we promote the next beta. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui-fulldeps/internal-lints/missing-generic-type-visitable-derive.rs:116 — // FIXME(ada4a): this will currently lint, and suggest adding a derive, even though ther's already — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/unstable-feature-bound/unstable-feature-bound-two-error.rs:5 — // FIXME: both `feat_bar` and `feat_moo` are needed to pass this test, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/unstable-feature-bound/unstable_inherent_method.rs:5 — /// FIXME(tiif): we haven't allowed marking trait and impl method as — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.rs:71 — // FIXME: https://github.com/rust-lang/rust/issues/112504
  • FixmeComment tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.rs:72 — // FIXME: ~^ NOTE an unsafe function restricts its caller, but its body is safe by default — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.rs:4 — // FIXME(jieyouxu): this test is NOT run-rustfix because this test contains conflicting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/typeck/question-mark-operator-suggestion-span.rs:4 — // FIXME(jieyouxu): this test is currently NOT run-rustfix because there are conflicting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/typeck/typeck_type_placeholder_item.rs:204 — // type E: _; // FIXME: make the parser propagate the existence of `B` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type-alias-impl-trait/nested-tait-inference.rs:20 — // FIXME(type-alias-impl-trait): We could probably make this work. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type-alias-impl-trait/not_a_defining_use.rs:33 — //FIXME(oli-obk): these currently cause cycle errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs:4 — // FIXME: this is ruled out for now but should work — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type-alias-impl-trait/coherence/coherence_generalization.rs:3 — // FIXME(type_alias_impl_trait): What does this test? This needs a comment — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type/type-name-basic.rs:88 — // FIXME: these are sub-optimal, ideally the `for<...>` would be printed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests/ui/type/type-recursive-box-shadowed.rs:1 — //FIXME(compiler-errors): This fixup should suggest the full box path, not just `Box` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 5277 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×497
  • FileTooLong: x86/avx512f.rs library/stdarch/crates/core_arch/src/x86/avx512f.rs — FileTooLong — 27565 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 2609 free functions. The bar is 500 significant lines; this is 27065 over it, 55.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: x86/avx512fp16.rs library/stdarch/crates/core_arch/src/x86/avx512fp16.rs — FileTooLong — 8189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 923 free functions. The bar is 500 significant lines; this is 7689 over it, 16.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: x86/avx512bw.rs library/stdarch/crates/core_arch/src/x86/avx512bw.rs — FileTooLong — 7569 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 826 free functions. The bar is 500 significant lines; this is 7069 over it, 15.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mips/msa.rs library/stdarch/crates/core_arch/src/mips/msa.rs — FileTooLong — 4517 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 527 free functions. The bar is 500 significant lines; this is 4017 over it, 9.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: s390x/vector.rs library/stdarch/crates/core_arch/src/s390x/vector.rs — FileTooLong — 4027 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3527 over it, 8.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: x86/avx512dq.rs library/stdarch/crates/core_arch/src/x86/avx512dq.rs — FileTooLong — 3769 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 399 free functions. The bar is 500 significant lines; this is 3269 over it, 7.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/late.rs compiler/rustc_resolve/src/late.rs — FileTooLong — 3681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 84% of them inside a single declaration: LateResolutionVisitor (5 blocks, 841-5884). The bar is 500 significant lines; this is 3181 over it, 7.36× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/diagnostics.rs compiler/rustc_parse/src/diagnostics.rs — FileTooLong — 3602 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3102 over it, 7.20× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: method/suggest.rs compiler/rustc_hir_typeck/src/method/suggest.rs — FileTooLong — 3530 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 96% of them inside a single declaration: FnCtxt (98-4974). The bar is 500 significant lines; this is 3030 over it, 7.06× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: c/windows_sys.rs library/std/src/sys/pal/windows/c/windows_sys.rs — FileTooLong — 3501 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3001 over it, 7.00× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: late/diagnostics.rs compiler/rustc_resolve/src/late/diagnostics.rs — FileTooLong — 3330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 93% of them inside a single declaration: LateResolutionVisitor (187-4862). The bar is 500 significant lines; this is 2830 over it, 6.66× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 3300 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 99% of them inside a single declaration: initSearch (12-5561). The bar is 500 significant lines; this is 2800 over it, 6.60× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: powerpc/altivec.rs library/stdarch/crates/core_arch/src/powerpc/altivec.rs — FileTooLong — 3160 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2660 over it, 6.32× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: diagnostics/impls.rs compiler/rustc_resolve/src/diagnostics/impls.rs — FileTooLong — 2868 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2368 over it, 5.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/hir.rs compiler/rustc_hir/src/hir.rs — FileTooLong — 2777 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2277 over it, 5.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: js/stringdex.js src/librustdoc/html/static/js/stringdex.js — FileTooLong — 2776 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 2276 over it, 5.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: traits/fulfillment_errors.rs compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs — FileTooLong — 2765 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2265 over it, 5.53× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: parser/expr.rs compiler/rustc_parse/src/parser/expr.rs — FileTooLong — 2761 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2261 over it, 5.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: expr_store/lower.rs src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs — FileTooLong — 2641 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: ExprCollector (3 blocks, 508-3760). The bar is 500 significant lines; this is 2141 over it, 5.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/items.rs src/tools/rustfmt/src/items.rs — FileTooLong — 2627 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 49 free functions. The bar is 500 significant lines; this is 2127 over it, 5.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: fn_ctxt/suggestions.rs compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs — FileTooLong — 2548 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2048 over it, 5.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/expr.rs compiler/rustc_hir_typeck/src/expr.rs — FileTooLong — 2534 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2034 over it, 5.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mir/eval.rs src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs — FileTooLong — 2498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: Evaluator (2 blocks, 166-3070). The bar is 500 significant lines; this is 1998 over it, 5.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: wasm32/simd128.rs library/stdarch/crates/core_arch/src/wasm32/simd128.rs — FileTooLong — 2471 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 258 free functions. The bar is 500 significant lines; this is 1971 over it, 4.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: hir_ty_lowering/mod.rs compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs — FileTooLong — 2443 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1943 over it, 4.89× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 472 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×483
  • Hotspot: src/intrinsic/archs.rs src/intrinsic/archs.rs:4 — src/intrinsic/archs.rs changed 3 times in last 90 days, max cyclomatic complexity 8835 in rustc_codegen_gcc::intrinsic::archs::map_arch_intrinsic at line 4. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/intrinsic/archs.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_passes/src/check_attr.rs compiler/rustc_passes/src/check_attr.rs:177 — compiler/rustc_passes/src/check_attr.rs changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 194 in CheckAttrVisitor::check_one_parsed_attribute at line 177. 4 of those changes were fix/bug commits, and the other 53 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_passes/src/check_attr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/intrinsic/llvm.rs src/intrinsic/llvm.rs:1098 — src/intrinsic/llvm.rs changed 15 times in last 90 days, max cyclomatic complexity 630 in rustc_codegen_gcc::intrinsic::llvm::intrinsic at line 1098. 1 of those changes was a fix/bug commit, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/intrinsic/llvm.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_feature/src/unstable.rs compiler/rustc_feature/src/unstable.rs:172 — compiler/rustc_feature/src/unstable.rs changed 34 times in last 90 days, max cyclomatic complexity 265 in Features::internal at line 172. 1 of those changes was a fix/bug commit, and the other 33 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_feature/src/unstable.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/lib.rs src/lib.rs:178 — src/lib.rs changed 33 times in last 90 days, max cyclomatic complexity 225 in stdarch_verify::to_type at line 178. 1 of those changes was a fix/bug commit, and the other 32 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/bootstrap/src/core/build_steps/test.rs src/bootstrap/src/core/build_steps/test.rs:2338 — src/bootstrap/src/core/build_steps/test.rs changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in Compiletest::run at line 2338. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/bootstrap/src/core/build_steps/test.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/bootstrap/src/core/config/config.rs src/bootstrap/src/core/config/config.rs:383 — src/bootstrap/src/core/config/config.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 120 in Config::parse_inner at line 383. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/bootstrap/src/core/config/config.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_codegen_llvm/src/intrinsic.rs compiler/rustc_codegen_llvm/src/intrinsic.rs:124 — compiler/rustc_codegen_llvm/src/intrinsic.rs changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in Builder::codegen_intrinsic_call at line 124. 2 of those changes were fix/bug commits, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_codegen_llvm/src/intrinsic.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_hir_analysis/src/check/intrinsic.rs compiler/rustc_hir_analysis/src/check/intrinsic.rs:217 — compiler/rustc_hir_analysis/src/check/intrinsic.rs changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 157 in rustc_hir_analysis::check::intrinsic::check_intrinsic_type at line 217. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_hir_analysis/src/check/intrinsic.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: clippy_lints/src/methods/mod.rs clippy_lints/src/methods/mod.rs:5438 — clippy_lints/src/methods/mod.rs changed 22 times in last 90 days, max cyclomatic complexity 191 in Methods::check_methods at line 5438. 1 of those changes was a fix/bug commit, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- clippy_lints/src/methods/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/intrinsic/old_archs.rs src/intrinsic/old_archs.rs:13 — src/intrinsic/old_archs.rs changed 3 times in last 90 days, max cyclomatic complexity 1362 in rustc_codegen_gcc::intrinsic::old_archs::old_archs at line 13. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/intrinsic/old_archs.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/bootstrap/src/core/build_steps/llvm.rs src/bootstrap/src/core/build_steps/llvm.rs:440 — src/bootstrap/src/core/build_steps/llvm.rs changed 62 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in Llvm::run at line 440. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/bootstrap/src/core/build_steps/llvm.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/bootstrap/src/core/builder/cargo.rs src/bootstrap/src/core/builder/cargo.rs:700 — src/bootstrap/src/core/builder/cargo.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in Builder::cargo at line 700. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/bootstrap/src/core/builder/cargo.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:92 — compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 90 in TypeErrCtxt::report_selection_error at line 92. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/tools/miri/src/shims/unix/foreign_items.rs src/tools/miri/src/shims/unix/foreign_items.rs:111 — src/tools/miri/src/shims/unix/foreign_items.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 158 in EvalContextExt::emulate_foreign_item_inner at line 111. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/tools/miri/src/shims/unix/foreign_items.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_attr_ir/src/encode_cross_crate.rs compiler/rustc_attr_ir/src/encode_cross_crate.rs:224 — compiler/rustc_attr_ir/src/encode_cross_crate.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 195 in AttributeKind::is_extern_indicator at line 224. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_attr_ir/src/encode_cross_crate.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_resolve/src/diagnostics/impls.rs compiler/rustc_resolve/src/diagnostics/impls.rs:799 — compiler/rustc_resolve/src/diagnostics/impls.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 76 in Resolver::into_struct_error at line 799. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_resolve/src/diagnostics/impls.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:386 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 167 in rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call at line 386. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_attr_ir/src/lang_items.rs compiler/rustc_attr_ir/src/lang_items.rs:93 — compiler/rustc_attr_ir/src/lang_items.rs changed 10 times in last 90 days, max cyclomatic complexity 227 in LangItem::from_u32 at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_attr_ir/src/lang_items.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_resolve/src/late/diagnostics.rs compiler/rustc_resolve/src/late/diagnostics.rs:4403 — compiler/rustc_resolve/src/late/diagnostics.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in LateResolutionVisitor::add_missing_lifetime_specifiers_label at line 4403. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_resolve/src/late/diagnostics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_mir_build/src/thir/cx/expr.rs compiler/rustc_mir_build/src/thir/cx/expr.rs:392 — compiler/rustc_mir_build/src/thir/cx/expr.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in ThirBuildCx::make_mirror_unadjusted at line 392. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_mir_build/src/thir/cx/expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/intrinsic/mod.rs src/intrinsic/mod.rs:139 — src/intrinsic/mod.rs changed 23 times in last 90 days, max cyclomatic complexity 86 in Builder::codegen_intrinsic_call at line 139. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/intrinsic/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_hir_analysis/src/check/check.rs compiler/rustc_hir_analysis/src/check/check.rs:762 — compiler/rustc_hir_analysis/src/check/check.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in rustc_hir_analysis::check::check::check_item_type at line 762. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_hir_analysis/src/check/check.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: compiler/rustc_codegen_llvm/src/asm.rs compiler/rustc_codegen_llvm/src/asm.rs:728 — compiler/rustc_codegen_llvm/src/asm.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 93 in rustc_codegen_llvm::asm::reg_to_llvm at line 728. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- compiler/rustc_codegen_llvm/src/asm.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/bootstrap/src/core/build_steps/compile.rs src/bootstrap/src/core/build_steps/compile.rs:2120 — src/bootstrap/src/core/build_steps/compile.rs changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in Assemble::run at line 2120. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/bootstrap/src/core/build_steps/compile.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 458 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×328
  • MethodTooLong: DocSearch.execQuery REDACTED:2155 — MethodTooLong — execQuery runs 1588 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1488 over it, 15.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: EvalContextExt.emulate_foreign_item_inner src/tools/miri/src/shims/unix/foreign_items.rs:111 — MethodTooLong — emulate_foreign_item_inner runs 1035 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 935 over it, 10.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Config.parse_inner src/bootstrap/src/core/config/config.rs:383 — MethodTooLong — parse_inner runs 931 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 831 over it, 9.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: EvalContextExt.emulate_foreign_item_inner src/tools/miri/src/shims/windows/foreign_items.rs:131 — MethodTooLong — emulate_foreign_item_inner runs 827 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 727 over it, 8.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MirLowerCtx.lower_expr_to_place_without_adjust src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:370 — MethodTooLong — lower_expr_to_place_without_adjust runs 681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 581 over it, 6.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Evaluator.exec_intrinsic src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:560 — MethodTooLong — exec_intrinsic runs 654 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 554 over it, 6.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ThirBuildCx.make_mirror_unadjusted compiler/rustc_mir_build/src/thir/cx/expr.rs:392 — MethodTooLong — make_mirror_unadjusted runs 589 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 489 over it, 5.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Builder.expr_into_dest compiler/rustc_mir_build/src/builder/expr/into.rs:26 — MethodTooLong — expr_into_dest runs 577 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 477 over it, 5.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: InterpCx.eval_simd_intrinsic compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:21 — MethodTooLong — eval_simd_intrinsic runs 564 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 464 over it, 5.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Methods.check_methods src/tools/clippy/clippy_lints/src/methods/mod.rs:5438 — MethodTooLong — check_methods runs 535 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 435 over it, 5.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Builder.codegen_intrinsic_call compiler/rustc_codegen_llvm/src/intrinsic.rs:124 — MethodTooLong — codegen_intrinsic_call runs 524 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 424 over it, 5.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TypeChecker.visit_rvalue compiler/rustc_borrowck/src/type_check/mod.rs:992 — MethodTooLong — visit_rvalue runs 471 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 371 over it, 4.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FnCtxt.suggest_traits_to_import compiler/rustc_hir_typeck/src/method/suggest.rs:4140 — MethodTooLong — suggest_traits_to_import runs 453 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 353 over it, 4.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: EvalContextExtPriv.emulate_foreign_item_inner src/tools/miri/src/shims/foreign_items.rs:256 — MethodTooLong — emulate_foreign_item_inner runs 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 339 over it, 4.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Ty.hir_fmt src/tools/rust-analyzer/crates/hir-ide/src/display.rs:1281 — MethodTooLong — hir_fmt runs 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 339 over it, 4.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Options.from_matches src/librustdoc/config.rs:386 — MethodTooLong — from_matches runs 435 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 335 over it, 4.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TypeErrCtxt.note_and_explain_type_err compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs:20 — MethodTooLong — note_and_explain_type_err runs 431 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 331 over it, 4.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FunctionCx.codegen_intrinsic_call compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:56 — MethodTooLong — codegen_intrinsic_call runs 411 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 311 over it, 4.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Extended.run src/bootstrap/src/core/build_steps/dist.rs:1902 — MethodTooLong — run runs 411 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 311 over it, 4.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: InferenceContext.infer_expr_inner src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:317 — MethodTooLong — infer_expr_inner runs 393 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Evaluator.eval_rvalue src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1029 — MethodTooLong — eval_rvalue runs 390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 290 over it, 3.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExprCollector.maybe_collect_expr src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1417 — MethodTooLong — maybe_collect_expr runs 378 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TypeErrCtxt.maybe_report_ambiguity compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:206 — MethodTooLong — maybe_report_ambiguity runs 368 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 268 over it, 3.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Builder.cargo src/bootstrap/src/core/builder/cargo.rs:700 — MethodTooLong — cargo runs 363 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 263 over it, 3.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: InterpCx.eval_intrinsic compiler/rustc_const_eval/src/interpret/intrinsics.rs:172 — MethodTooLong — eval_intrinsic runs 362 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 262 over it, 3.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 303 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×273
  • TodoComment tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.rs:35 — // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_function.rs:52 — // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:15 — // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_type_to_generic_arg.rs:21 — // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:1412 — // todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/tidy/src/codegen.rs:1 — //! Tidy check for codegen backend TODO policy. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/tidy/src/codegen.rs:49 — // TODO policy for codegen-only trees. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/enum.rs:150 — // TODO make Dict "structlike" AKA name the two values. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/enum.rs:108 — // TODO make Dict "structlike" AKA name the two values. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/issue-2896.rs:33 — //TODO adjust code to only work with upper triangular half of cooccurrence matrix — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/issue-2896.rs:36 — //TODO adjust code to only work with upper triangular half of cooccurrence matrix — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/issue-2896.rs:68 — // //TODO compute top-k "similar items" per item — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/issue-2896.rs:69 — // //TODO compute top-k "similar items" per item — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/issue-691.rs:7 — // TODO: provide instructions to override default libm link and how to link to — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/match.rs:138 — // TODO uncomment when vertical whitespace is handled better — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/match.rs:139 — // TODO uncomment when vertical whitespace is handled better — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/match.rs:196 — // We push the whole expr to a new line, TODO split this macro as well — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/match.rs:197 — // We push the whole expr to a new line, TODO split this macro as well — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/struct_field_doc_comment.rs:7 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/struct_field_doc_comment.rs:37 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/struct_field_doc_comment.rs:58 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/target/struct_field_doc_comment.rs:67 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/struct_field_doc_comment.rs:6 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/struct_field_doc_comment.rs:38 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/tools/rustfmt/tests/source/struct_field_doc_comment.rs:61 — // TODO note — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 248 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×257
  • FunctionTooLong: stringdex.loadDatabase src/librustdoc/html/static/js/stringdex.js:1089 — FunctionTooLong — loadDatabase runs 1576 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1476 over it, 15.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:28 — FunctionTooLong — rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic runs 1162 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1062 over it, 11.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_llvm::intrinsic::generic_simd_intrinsic compiler/rustc_codegen_llvm/src/intrinsic.rs:2030 — FunctionTooLong — rustc_codegen_llvm::intrinsic::generic_simd_intrinsic runs 939 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 839 over it, 9.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:10 — FunctionTooLong — rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call runs 901 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 801 over it, 9.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:386 — FunctionTooLong — rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call runs 856 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 756 over it, 8.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:10 — FunctionTooLong — rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call runs 788 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 688 over it, 7.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:21 — FunctionTooLong — rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call runs 763 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 663 over it, 7.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ide_completion::context::analysis::classify_name_ref src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:966 — FunctionTooLong — ide_completion::context::analysis::classify_name_ref runs 565 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 465 over it, 5.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:119 — FunctionTooLong — rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments runs 547 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 447 over it, 5.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustdoc::html::render::search_index::build_index REDACTED:1267 — FunctionTooLong — rustdoc::html::render::search_index::build_index runs 494 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 394 over it, 4.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustdoc::opts src/librustdoc/lib.rs:199 — FunctionTooLong — rustdoc::opts runs 462 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 362 over it, 4.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustdoc::html::render::print_item::item_trait src/librustdoc/html/render/print_item.rs:646 — FunctionTooLong — rustdoc::html::render::print_item::item_trait runs 421 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 321 over it, 4.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_hir_analysis::check::intrinsic::check_intrinsic_type compiler/rustc_hir_analysis/src/check/intrinsic.rs:217 — FunctionTooLong — rustc_hir_analysis::check::intrinsic::check_intrinsic_type runs 416 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 316 over it, 4.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_ty_utils::layout::layout_of_uncached compiler/rustc_ty_utils/src/layout.rs:205 — FunctionTooLong — rustc_ty_utils::layout::layout_of_uncached runs 411 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 311 over it, 4.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustdoc::html::render::render_impl src/librustdoc/html/render/mod.rs:1866 — FunctionTooLong — rustdoc::html::render::render_impl runs 374 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 274 over it, 3.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: stdarch_gen_hexagon::hvx::get_compound_helper_signatures library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:640 — FunctionTooLong — stdarch_gen_hexagon::hvx::get_compound_helper_signatures runs 371 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 271 over it, 3.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: hir_expand::builtin::derive_macro::coerce_pointee_expand src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs:1128 — FunctionTooLong — hir_expand::builtin::derive_macro::coerce_pointee_expand runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_lint::register_builtins compiler/rustc_lint/src/lib.rs:327 — FunctionTooLong — rustc_lint::register_builtins runs 311 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 211 over it, 3.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_hir_analysis::check::check::check_item_type compiler/rustc_hir_analysis/src/check/check.rs:762 — FunctionTooLong — rustc_hir_analysis::check::check::check_item_type runs 297 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 197 over it, 2.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ide::hover::render::definition src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446 — FunctionTooLong — ide::hover::render::definition runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_cranelift::base::codegen_stmt compiler/rustc_codegen_cranelift/src/base.rs:610 — FunctionTooLong — rustc_codegen_cranelift::base::codegen_stmt runs 274 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 174 over it, 2.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_ssa::back::write::start_executing_work compiler/rustc_codegen_ssa/src/back/write.rs:1208 — FunctionTooLong — rustc_codegen_ssa::back::write::start_executing_work runs 255 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: tidy::style::check_file_style src/tools/tidy/src/style.rs:327 — FunctionTooLong — tidy::style::check_file_style runs 250 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 150 over it, 2.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rustc_codegen_llvm::context::init_module compiler/rustc_codegen_llvm/src/context.rs:197 — FunctionTooLong — rustc_codegen_llvm::context::init_module runs 247 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 147 over it, 2.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: stdarch_verify::to_type library/stdarch/crates/stdarch-verify/src/lib.rs:178 — FunctionTooLong — stdarch_verify::to_type runs 241 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 141 over it, 2.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 232 more in this group — see findings.md.
D17 · Explicit Debt · HackComment · ×192
  • HackComment tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs:29 — // HACK: This impls is necessary so that the impl above is well-formed. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/symbol-names/const-generics-structural-demangling.rs:53 — // HACK(eddyb) the full mangling is only in `.stderr` because we can normalize — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/symbol-names/const-generics-structural-demangling.rs:61 — // HACK(eddyb) the full mangling is only in `.stderr` because we can normalize — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/overloaded/overloaded-autoderef.rs:29 — // HACK assert_eq! would panic here because it stores the LHS and RHS in two locals. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/layout/hexagon-enum.rs:33 — // hack to get negative numbers without negation operator! — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/layout/thumb-enum.rs:33 — // hack to get negative numbers without negation operator! — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/impl-trait/example-calendar.rs:303 — // HACK(eddyb): only needed because `impl Trait` can't be — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/const_prop/ice-assert-fail-div-by-zero.rs:11 — // HACK: this test passes only because this is a const fn that is written to metadata — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/ui/backtrace/backtrace.rs:49 — // HACK(eddyb) work around the fact that verbosely demangled stack traces — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/rustdoc-json/reexport/private_twice_one_inline.rs:10 — /// Hack A — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/rustdoc-json/reexport/private_twice_one_inline.rs:18 — /// Hack B — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/adjustments.rs:5 — // Hack to get the correct size for the length part in slices — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/function-arguments.rs:189 — // Hack to get the correct size for the length part in slices — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/refs.rs:5 — // Hack to get the correct size for the length part in slices — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/zst-offset.rs:6 — // Hack to get the correct size for the length part in slices — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/dst-offset.rs:11 — // Hack to get the correct type for usize — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tests/codegen-llvm/range-attribute.rs:14 — // Hack to get the correct size for usize — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/tidy/src/style.rs:223 — // HACK(Ezrashaw): there is no way to split a markdown header over multiple lines — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rustfmt/src/comment.rs:1473 — // HACK: Work around mut borrow. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rustfmt/src/expr.rs:701 — // HACK: `true` if this is an `if` expression in an `else if`. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rustfmt/src/imports.rs:556 — // Hack around borrow checker. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rustfmt/src/missed_spans.rs:39 — // HACK(topecongiro): we use `format_missing()` to extract a missing comment between — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rustfmt/src/types.rs:292 — // HACK: squeeze out the span between the identifier and the parameters. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rust-analyzer/lib/text-size/src/range.rs:126 — // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/tools/rust-analyzer/lib/text-size/src/range.rs:133 — // HACK for const fn: math on primitives only — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • + 167 more in this group — see findings.md.
D2 · Cognitive Complexity · clippy_lints · ×153
  • clippy_lints::doc::check_doc (cognitive 127) src/tools/clippy/clippy_lints/src/doc/mod.rs:1116 — clippy_lints::doc::check_doc has cognitive complexity 127 (threshold 15). Drivers by points: if/else 33 (85 pts), boolean chains 22, match/switch 4 (14 pts), loops 2 (6 pts) (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::loops::needless_range_loop::check (cognitive 73) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:25 — clippy_lints::loops::needless_range_loop::check has cognitive complexity 73 (threshold 15). Drivers by points: if/else 26 (61 pts), boolean chains 7, match/switch 1 (5 pts) (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::methods::manual_inspect::check (cognitive 68) src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs:18 — clippy_lints::methods::manual_inspect::check has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (34 pts), match/switch 5 (19 pts), boolean chains 9, loops 2 (6 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::eta_reduction::check_closure (cognitive 65) src/tools/clippy/clippy_lints/src/eta_reduction.rs:90 — clippy_lints::eta_reduction::check_closure has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (38 pts), match/switch 6 (19 pts), boolean chains 8 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::loops::explicit_iter_loop::is_ref_iterable (cognitive 58) src/tools/clippy/clippy_lints/src/loops/explicit_iter_loop.rs:107 — clippy_lints::loops::explicit_iter_loop::is_ref_iterable has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 11, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::methods::unnecessary_to_owned::can_change_type (cognitive 55) src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs:498 — clippy_lints::methods::unnecessary_to_owned::can_change_type has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (48 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::write::literal::check (cognitive 54) src/tools/clippy/clippy_lints/src/write/literal.rs:16 — clippy_lints::write::literal::check has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 6 (23 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::lifetimes::check_fn_inner (cognitive 52) src/tools/clippy/clippy_lints/src/lifetimes.rs:208 — clippy_lints::lifetimes::check_fn_inner has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 4 (12 pts), match/switch 1 (6 pts), boolean chains 5 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::operators::op_ref::check (cognitive 51) src/tools/clippy/clippy_lints/src/operators/op_ref.rs:15 — clippy_lints::operators::op_ref::check has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 19, match/switch 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::methods::map_clone::check (cognitive 48) src/tools/clippy/clippy_lints/src/methods/map_clone.rs:45 — clippy_lints::methods::map_clone::check has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (34 pts), match/switch 3 (9 pts), boolean chains 5 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::methods::unwrap_expect_used::check (cognitive 48) src/tools/clippy/clippy_lints/src/methods/unwrap_expect_used.rs:40 — clippy_lints::methods::unwrap_expect_used::check has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 6, loops 2 (4 pts), match/switch 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::operators::assign_op_pattern::check (cognitive 47) src/tools/clippy/clippy_lints/src/operators/assign_op_pattern.rs:19 — clippy_lints::operators::assign_op_pattern::check has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (37 pts), boolean chains 6, match/switch 1 (4 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::ranges::check_possible_range_contains (cognitive 45) src/tools/clippy/clippy_lints/src/ranges.rs:212 — clippy_lints::ranges::check_possible_range_contains has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 4, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::casts::unnecessary_cast::check (cognitive 44) src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs:21 — clippy_lints::casts::unnecessary_cast::check has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 15, match/switch 3 (6 pts) (nesting depth added 11). Of this number, 43 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::attrs::useless_attribute::check (cognitive 43) src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs:10 — clippy_lints::attrs::useless_attribute::check has cognitive complexity 43 (threshold 15). Drivers by points: if/else 7 (30 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::methods::iter_overeager_cloned::check (cognitive 43) src/tools/clippy/clippy_lints/src/methods/iter_overeager_cloned.rs:37 — clippy_lints::methods::iter_overeager_cloned::check has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::methods::needless_collect::check (cognitive 43) src/tools/clippy/clippy_lints/src/methods/needless_collect.rs:26 — clippy_lints::methods::needless_collect::check has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 6, match/switch 2 (4 pts), loops 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::implicit_saturating_sub::check_with_condition (cognitive 40) src/tools/clippy/clippy_lints/src/implicit_saturating_sub.rs:304 — clippy_lints::implicit_saturating_sub::check_with_condition has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::methods::search_is_some::check (cognitive 39) src/tools/clippy/clippy_lints/src/methods/search_is_some.rs:19 — clippy_lints::methods::search_is_some::check has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (34 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::transmute::transmute_undefined_repr::check (cognitive 39) src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs:9 — clippy_lints::transmute::transmute_undefined_repr::check has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (32 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::matches::manual_utils::check_with (cognitive 38) src/tools/clippy/clippy_lints/src/matches/manual_utils.rs:20 — clippy_lints::matches::manual_utils::check_with has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 7, match/switch 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::loops::while_let_on_iterator::needs_mutable_borrow (cognitive 37) src/tools/clippy/clippy_lints/src/loops/while_let_on_iterator.rs:238 — clippy_lints::loops::while_let_on_iterator::needs_mutable_borrow has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_lints::unit_types::let_unit_value::check (cognitive 37) src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs:19 — clippy_lints::unit_types::let_unit_value::check has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 7, match/switch 1 (4 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::matches::match_wild_err_arm::check (cognitive 36) src/tools/clippy/clippy_lints/src/matches/match_wild_err_arm.rs:12 — clippy_lints::matches::match_wild_err_arm::check has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 2 (8 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • clippy_lints::option_if_let_else::try_get_option_occurrence (cognitive 36) src/tools/clippy/clippy_lints/src/option_if_let_else.rs:120 — clippy_lints::option_if_let_else::try_get_option_occurrence has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (12 pts), boolean chains 6 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 128 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×109
  • TooManyMethods: FnCtxt compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs:46 — TooManyMethods — 491 methods, declared across 27 files: src/expr.rs (67), src/pat.rs (62), fn_ctxt/_impl.rs (53), fn_ctxt/suggestions.rs (50), +23 more file(s). The bar is 30 methods; this is 461 over it, 16.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Parser compiler/rustc_parse_format/src/lib.rs:201 — TooManyMethods — 481 methods, declared across 14 files: parser/expr.rs (136), parser/item.rs (81), parser/diagnostics.rs (72), parser/ty.rs (48), +10 more file(s). The bar is 30 methods; this is 451 over it, 16.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LoweringContext compiler/rustc_ast_lowering/src/lib.rs:284 — TooManyMethods — 283 methods, declared across 12 files: src/lib.rs (94), src/expr.rs (74), src/item.rs (50), src/pat.rs (15), +8 more file(s). The bar is 30 methods; this is 253 over it, 9.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InterpCx compiler/rustc_const_eval/src/interpret/eval_context.rs:31 — TooManyMethods — 245 methods, declared across 20 files: interpret/memory.rs (53), interpret/eval_context.rs (28), interpret/place.rs (28), interpret/intrinsics.rs (24), +16 more file(s). The bar is 30 methods; this is 215 over it, 8.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InferenceContext src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:1342 — TooManyMethods — 208 methods, declared across 15 files: src/infer.rs (56), infer/pat.rs (36), infer/expr.rs (33), infer/closure.rs (19), +11 more file(s). The bar is 30 methods; this is 178 over it, 6.93× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InferCtxt compiler/rustc_infer/src/infer/mod.rs:244 — TooManyMethods — 175 methods, declared across 21 files: infer/mod.rs (84), outlives/obligations.rs (16), infer/at.rs (10), snapshot/mod.rs (10), +17 more file(s). The bar is 30 methods; this is 145 over it, 5.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Ty compiler/rustc_middle/src/ty/mod.rs:517 — TooManyMethods — 167 methods, declared across 5 files: ty/sty.rs (139), ty/util.rs (19), inhabitedness/mod.rs (4), ty/diagnostics.rs (3), +1 more file(s). The bar is 30 methods; this is 137 over it, 5.57× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SyntaxFactory src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory.rs:16 — TooManyMethods — 157 methods, declared across 2 files: syntax_factory/constructors.rs (153), ast/syntax_factory.rs (4). The bar is 30 methods; this is 127 over it, 5.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MirBorrowckCtxt compiler/rustc_borrowck/src/lib.rs:735 — TooManyMethods — 150 methods, declared across 11 files: diagnostics/mod.rs (28), src/lib.rs (26), src/borrowck_errors.rs (24), diagnostics/move_errors.rs (21), +7 more file(s). The bar is 30 methods; this is 120 over it, 5.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LateResolutionVisitor compiler/rustc_resolve/src/late.rs:841 — TooManyMethods — 142 methods, declared across 2 files: src/late.rs (86), late/diagnostics.rs (56). The bar is 30 methods; this is 112 over it, 4.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SemanticsImpl src/tools/rust-analyzer/crates/hir/src/semantics.rs:171 — TooManyMethods — 139 methods. The bar is 30 methods; this is 109 over it, 4.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TypeErrCtxt compiler/rustc_trait_selection/src/error_reporting/mod.rs:20 — TooManyMethods — 138 methods, declared across 11 files: traits/fulfillment_errors.rs (51), infer/mod.rs (31), infer/suggest.rs (16), infer/region.rs (11), +7 more file(s). The bar is 30 methods; this is 108 over it, 4.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Builder compiler/rustc_mir_build/src/builder/mod.rs:158 — TooManyMethods — 133 methods, declared across 16 files: builder/scope.rs (38), matches/mod.rs (34), expr/as_place.rs (11), builder/mod.rs (10), +12 more file(s). The bar is 30 methods; this is 103 over it, 4.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CodegenCx compiler/rustc_codegen_gcc/src/context.rs:39 — TooManyMethods — 122 methods, declared across 17 files: src/type_.rs (22), src/int.rs (18), src/consts.rs (12), src/context.rs (12), +13 more file(s). The bar is 30 methods; this is 92 over it, 4.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EvalCtxt compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:104 — TooManyMethods — 116 methods, declared across 13 files: eval_ctxt/mod.rs (51), solve/mod.rs (15), solve/trait_goals.rs (15), assembly/mod.rs (13), +9 more file(s). The bar is 30 methods; this is 86 over it, 3.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExprCollector src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:508 — TooManyMethods — 113 methods, declared across 3 files: expr_store/lower.rs (107), lower/format_args.rs (5), lower/asm.rs (1). The bar is 30 methods; this is 83 over it, 3.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CompilerCtxt compiler/rustc_public_bridge/src/context/mod.rs:23 — TooManyMethods — 112 methods, declared across 2 files: context/impls.rs (111), context/mod.rs (1). The bar is 30 methods; this is 82 over it, 3.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InferCtxt src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs:231 — TooManyMethods — 111 methods, declared across 13 files: infer/mod.rs (71), snapshot/mod.rs (10), canonical/instantiate.rs (6), outlives/obligations.rs (5), +9 more file(s). The bar is 30 methods; this is 81 over it, 3.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: State compiler/rustc_ast_pretty/src/pprust/state.rs:228 — TooManyMethods — 100 methods, declared across 3 files: pprust/state.rs (54), state/item.rs (24), state/expr.rs (22). The bar is 30 methods; this is 70 over it, 3.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CompilerInterface compiler/rustc_public/src/compiler_interface.rs:76 — TooManyMethods — 100 methods. The bar is 30 methods; this is 70 over it, 3.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SelectionContext compiler/rustc_trait_selection/src/traits/select/mod.rs:98 — TooManyMethods — 98 methods, declared across 3 files: select/mod.rs (49), select/candidate_assembly.rs (27), select/confirmation.rs (22). The bar is 30 methods; this is 68 over it, 3.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: State compiler/rustc_hir_pretty/src/lib.rs:72 — TooManyMethods — 97 methods. The bar is 30 methods; this is 67 over it, 3.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Resolver compiler/rustc_hir_typeck/src/writeback.rs:917 — TooManyMethods — 95 methods, declared across 8 files: diagnostics/impls.rs (43), src/ident.rs (21), src/build_reduced_graph.rs (14), src/macros.rs (10), +4 more file(s). The bar is 30 methods; this is 65 over it, 3.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: VecDeque library/alloc/src/collections/vec_deque/mod.rs:104 — TooManyMethods — 92 methods. The bar is 30 methods; this is 62 over it, 3.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Config src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:1113 — TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 84 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×109
  • ClassTooLong: LateResolutionVisitor compiler/rustc_resolve/src/late.rs:841 — ClassTooLong — 3107 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 142 methods, 5 blocks, lines 841-5884. The bar is 400 significant lines; this is 2707 over it, 7.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ExprCollector src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:508 — ClassTooLong — 2143 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 113 methods, 3 blocks, lines 508-3760. The bar is 400 significant lines; this is 1743 over it, 5.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Evaluator src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:166 — ClassTooLong — 2036 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 2 blocks, lines 166-3070. The bar is 400 significant lines; this is 1636 over it, 5.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: State compiler/rustc_hir_pretty/src/lib.rs:72 — ClassTooLong — 1801 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 97 methods, 6 blocks, lines 72-2689. The bar is 400 significant lines; this is 1401 over it, 4.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LoweringContext compiler/rustc_ast_lowering/src/lib.rs:284 — ClassTooLong — 1724 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 283 methods, 3 blocks, lines 284-3337. The bar is 400 significant lines; this is 1324 over it, 4.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Builder compiler/rustc_codegen_gcc/src/builder.rs:52 — ClassTooLong — 1597 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 73 methods, 14 blocks, lines 52-2620. The bar is 400 significant lines; this is 1197 over it, 3.99× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TypeChecker compiler/rustc_borrowck/src/type_check/mod.rs:227 — ClassTooLong — 1498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 4 blocks, lines 227-2760. The bar is 400 significant lines; this is 1098 over it, 3.75× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SelectionContext compiler/rustc_trait_selection/src/traits/select/mod.rs:98 — ClassTooLong — 1486 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 98 methods, 4 blocks, lines 98-2797. The bar is 400 significant lines; this is 1086 over it, 3.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Config src/bootstrap/src/core/config/config.rs:90 — ClassTooLong — 1359 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 64 methods, 3 blocks, lines 90-2026. The bar is 400 significant lines; this is 959 over it, 3.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MirLowerCtx src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:78 — ClassTooLong — 1335 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 2 blocks, lines 78-1941. The bar is 400 significant lines; this is 935 over it, 3.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AstValidator compiler/rustc_ast_passes/src/ast_validation.rs:123 — ClassTooLong — 1267 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 3 blocks, lines 123-2241. The bar is 400 significant lines; this is 867 over it, 3.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SourceAnalyzer src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:77 — ClassTooLong — 1203 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 2 blocks, lines 77-1752. The bar is 400 significant lines; this is 803 over it, 3.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: VecDeque library/alloc/src/collections/vec_deque/mod.rs:104 — ClassTooLong — 1162 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 92 methods, 25 blocks, lines 104-4151. The bar is 400 significant lines; this is 762 over it, 2.91× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ProbeContext compiler/rustc_hir_typeck/src/method/probe.rs:55 — ClassTooLong — 1089 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 4 blocks, lines 55-2718. The bar is 400 significant lines; this is 689 over it, 2.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: EvalContextExt src/tools/miri/src/shims/unix/foreign_items.rs:53 — ClassTooLong — 1072 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods. The bar is 400 significant lines; this is 672 over it, 2.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MirBorrowckCtxt compiler/rustc_borrowck/src/lib.rs:735 — ClassTooLong — 1069 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 150 methods, 3 blocks, lines 735-2763. The bar is 400 significant lines; this is 669 over it, 2.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: VnState compiler/rustc_mir_transform/src/gvn.rs:380 — ClassTooLong — 1047 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 40 methods, 4 blocks, lines 380-2145. The bar is 400 significant lines; this is 647 over it, 2.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MiriMachine src/tools/miri/src/machine.rs:511 — ClassTooLong — 1043 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 4 blocks, lines 511-2139. The bar is 400 significant lines; this is 643 over it, 2.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: EncodeContext compiler/rustc_metadata/src/rmeta/encoder.rs:56 — ClassTooLong — 1029 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 6 blocks, lines 56-2468. The bar is 400 significant lines; this is 629 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DefCollector src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:232 — ClassTooLong — 1005 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 22 methods, 2 blocks, lines 232-1881. The bar is 400 significant lines; this is 605 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: EvalContextExt src/tools/miri/src/shims/unix/fs.rs:454 — ClassTooLong — 1003 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 33 methods. The bar is 400 significant lines; this is 603 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CheckAttrVisitor compiler/rustc_passes/src/check_attr.rs:114 — ClassTooLong — 999 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 28 methods, 3 blocks, lines 114-1573. The bar is 400 significant lines; this is 599 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DbInterner src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:352 — ClassTooLong — 965 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 4 blocks, lines 352-2279. The bar is 400 significant lines; this is 565 over it, 2.41× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DropCtxt compiler/rustc_mir_transform/src/elaborate_drop.rs:142 — ClassTooLong — 934 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 2 blocks, lines 142-1676. The bar is 400 significant lines; this is 534 over it, 2.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Session src/bootstrap/src/core/session.rs:39 — ClassTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 82 methods, 4 blocks, lines 39-1805. The bar is 400 significant lines; this is 491 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 84 more in this group — see findings.md.
D2 · Cognitive Complexity · FnCtxt · ×88
  • FnCtxt::suggest_traits_to_import (cognitive 190) compiler/rustc_hir_typeck/src/method/suggest.rs:4140 — FnCtxt::suggest_traits_to_import has cognitive complexity 190 (threshold 15). Drivers by points: if/else 45 (112 pts), match/switch 13 (36 pts), loops 8 (23 pts), boolean chains 19 (nesting depth added 105). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::suggest_deref_or_ref (cognitive 145) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2966 — FnCtxt::suggest_deref_or_ref has cognitive complexity 145 (threshold 15). Drivers by points: if/else 43 (114 pts), boolean chains 15, match/switch 6 (13 pts), loops 1 (3 pts) (nesting depth added 80). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::label_fn_like (cognitive 130) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1661 — FnCtxt::label_fn_like has cognitive complexity 130 (threshold 15). Drivers by points: if/else 29 (76 pts), loops 7 (28 pts), match/switch 6 (17 pts), boolean chains 9 (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::handle_unsatisfied_predicates (cognitive 124) compiler/rustc_hir_typeck/src/method/suggest.rs:1705 — FnCtxt::handle_unsatisfied_predicates has cognitive complexity 124 (threshold 15). Drivers by points: if/else 34 (69 pts), match/switch 12 (27 pts), loops 10 (17 pts), boolean chains 11 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_expr_struct_fields (cognitive 102) compiler/rustc_hir_typeck/src/expr.rs:1879 — FnCtxt::check_expr_struct_fields has cognitive complexity 102 (threshold 15). Drivers by points: if/else 43 (87 pts), boolean chains 6, match/switch 3 (6 pts), loops 2 (3 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::instantiate_value_path (cognitive 92) compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:1025 — FnCtxt::instantiate_value_path has cognitive complexity 92 (threshold 15). Drivers by points: if/else 33 (65 pts), match/switch 9 (18 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::note_type_is_not_clone (cognitive 86) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2036 — FnCtxt::note_type_is_not_clone has cognitive complexity 86 (threshold 15). Drivers by points: if/else 18 (55 pts), match/switch 3 (15 pts), loops 2 (10 pts), boolean chains 6 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::suggest_deref_ref_or_into (cognitive 81) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:346 — FnCtxt::suggest_deref_ref_or_into has cognitive complexity 81 (threshold 15). Drivers by points: if/else 27 (48 pts), match/switch 3 (14 pts), loops 3 (12 pts), boolean chains 7 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::annotate_loop_expected_due_to_inference (cognitive 78) compiler/rustc_hir_typeck/src/demand.rs:576 — FnCtxt::annotate_loop_expected_due_to_inference has cognitive complexity 78 (threshold 15). Drivers by points: if/else 13 (49 pts), match/switch 3 (16 pts), loops 3 (8 pts), boolean chains 5 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::suggest_compatible_variants (cognitive 74) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2621 — FnCtxt::suggest_compatible_variants has cognitive complexity 74 (threshold 15). Drivers by points: if/else 18 (49 pts), match/switch 4 (13 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::note_source_of_type_mismatch_constraint (cognitive 69) compiler/rustc_hir_typeck/src/demand.rs:289 — FnCtxt::note_source_of_type_mismatch_constraint has cognitive complexity 69 (threshold 15). Drivers by points: if/else 30 (58 pts), loops 2 (4 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::analyze_closure (cognitive 63) compiler/rustc_hir_typeck/src/upvar.rs:243 — FnCtxt::analyze_closure has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (49 pts), loops 5 (9 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_expr_field (cognitive 62) compiler/rustc_hir_typeck/src/expr.rs:2779 — FnCtxt::check_expr_field has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (49 pts), boolean chains 5, loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::suggest_cast (cognitive 60) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:3420 — FnCtxt::suggest_cast has cognitive complexity 60 (threshold 15). Drivers by points: if/else 38 (44 pts), match/switch 6 (12 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • FnCtxt::point_at_expr_if_possible (cognitive 53) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:288 — FnCtxt::point_at_expr_if_possible has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 6 (13 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_pat_ref (cognitive 50) compiler/rustc_hir_typeck/src/pat.rs:2792 — FnCtxt::check_pat_ref has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (35 pts), match/switch 4 (8 pts), boolean chains 7 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_argument_types (cognitive 49) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:192 — FnCtxt::check_argument_types has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (37 pts), loops 5 (6 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_expr_block (cognitive 49) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1318 — FnCtxt::check_expr_block has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (46 pts), boolean chains 2, loops 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FnCtxt::check_expr_offset_of (cognitive 46) compiler/rustc_hir_typeck/src/expr.rs:3816 — FnCtxt::check_expr_offset_of has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (42 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::blame_specific_part_of_expr_corresponding_to_generic_param (cognitive 45) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:875 — FnCtxt::blame_specific_part_of_expr_corresponding_to_generic_param has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (41 pts), match/switch 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::check_tupled_arguments (cognitive 45) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:583 — FnCtxt::check_tupled_arguments has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (41 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::report_invalid_callee (cognitive 44) compiler/rustc_hir_typeck/src/callee.rs:917 — FnCtxt::report_invalid_callee has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (23 pts), match/switch 6 (12 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::report_failed_method_call_on_range_end (cognitive 44) compiler/rustc_hir_typeck/src/method/suggest.rs:2889 — FnCtxt::report_failed_method_call_on_range_end has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (24 pts), match/switch 4 (18 pts), loops 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::report_method_error (cognitive 43) compiler/rustc_hir_typeck/src/method/suggest.rs:256 — FnCtxt::report_method_error has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 2 (5 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCtxt::note_candidates_on_method_error (cognitive 43) compiler/rustc_hir_typeck/src/method/suggest.rs:2442 — FnCtxt::note_candidates_on_method_error has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 63 more in this group — see findings.md.
D1 · Cyclomatic Complexity · clippy_lints · ×80
  • clippy_lints::doc::check_doc (cyclomatic 72) src/tools/clippy/clippy_lints/src/doc/mod.rs:1116 — clippy_lints::doc::check_doc has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::operators::op_ref::check (cyclomatic 47) src/tools/clippy/clippy_lints/src/operators/op_ref.rs:15 — clippy_lints::operators::op_ref::check has cyclomatic complexity 47 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • clippy_lints::methods::manual_inspect::check (cyclomatic 40) src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs:18 — clippy_lints::methods::manual_inspect::check has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::casts::unnecessary_cast::check (cyclomatic 36) src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs:21 — clippy_lints::casts::unnecessary_cast::check has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::eta_reduction::check_closure (cyclomatic 35) src/tools/clippy/clippy_lints/src/eta_reduction.rs:90 — clippy_lints::eta_reduction::check_closure has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::loops::never_loop::never_loop_expr (cyclomatic 33) src/tools/clippy/clippy_lints/src/loops/never_loop.rs:293 — clippy_lints::loops::never_loop::never_loop_expr has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_lints::loops::explicit_iter_loop::is_ref_iterable (cyclomatic 31) src/tools/clippy/clippy_lints/src/loops/explicit_iter_loop.rs:107 — clippy_lints::loops::explicit_iter_loop::is_ref_iterable has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::matches::manual_utils::check_with (cyclomatic 30) src/tools/clippy/clippy_lints/src/matches/manual_utils.rs:20 — clippy_lints::matches::manual_utils::check_with has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::transmute::transmute_undefined_repr::check (cyclomatic 29) src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs:9 — clippy_lints::transmute::transmute_undefined_repr::check has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::write::literal::check (cyclomatic 29) src/tools/clippy/clippy_lints/src/write/literal.rs:16 — clippy_lints::write::literal::check has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::loops::needless_range_loop::check (cyclomatic 28) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:25 — clippy_lints::loops::needless_range_loop::check has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::matches::match_wild_enum::check (cyclomatic 28) src/tools/clippy/clippy_lints/src/matches/match_wild_enum.rs:15 — clippy_lints::matches::match_wild_enum::check has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_lints::casts::unnecessary_cast::walk_receiver_path_step (cyclomatic 26) src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs:537 — clippy_lints::casts::unnecessary_cast::walk_receiver_path_step has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • clippy_lints::operators::invalid_upcast_comparisons::upcast_comparison_bounds_err (cyclomatic 26) src/tools/clippy/clippy_lints/src/operators/invalid_upcast_comparisons.rs:67 — clippy_lints::operators::invalid_upcast_comparisons::upcast_comparison_bounds_err has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • clippy_lints::methods::unnecessary_sort_by::mirrored_exprs (cyclomatic 25) src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs:33 — clippy_lints::methods::unnecessary_sort_by::mirrored_exprs has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_lints::methods::unwrap_expect_used::check (cyclomatic 25) src/tools/clippy/clippy_lints/src/methods/unwrap_expect_used.rs:40 — clippy_lints::methods::unwrap_expect_used::check has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::lifetimes::could_use_elision (cyclomatic 24) src/tools/clippy/clippy_lints/src/lifetimes.rs:293 — clippy_lints::lifetimes::could_use_elision has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::methods::unnecessary_literal_unwrap::check (cyclomatic 24) src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs:27 — clippy_lints::methods::unnecessary_literal_unwrap::check has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::option_if_let_else::try_get_option_occurrence (cyclomatic 24) src/tools/clippy/clippy_lints/src/option_if_let_else.rs:120 — clippy_lints::option_if_let_else::try_get_option_occurrence has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::matches::collapsible_match::check_arm (cyclomatic 23) src/tools/clippy/clippy_lints/src/matches/collapsible_match.rs:74 — clippy_lints::matches::collapsible_match::check_arm has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::methods::needless_collect::check (cyclomatic 23) src/tools/clippy/clippy_lints/src/methods/needless_collect.rs:26 — clippy_lints::methods::needless_collect::check has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::operators::bit_mask::check (cyclomatic 23) src/tools/clippy/clippy_lints/src/operators/bit_mask.rs:13 — clippy_lints::operators::bit_mask::check has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_lints::time_subtraction::const_eval_duration (cyclomatic 23) src/tools/clippy/clippy_lints/src/time_subtraction.rs:220 — clippy_lints::time_subtraction::const_eval_duration has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::functions::misnamed_getters::check_fn (cyclomatic 22) src/tools/clippy/clippy_lints/src/functions/misnamed_getters.rs:14 — clippy_lints::functions::misnamed_getters::check_fn has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_lints::implicit_saturating_sub::check_with_condition (cyclomatic 22) src/tools/clippy/clippy_lints/src/implicit_saturating_sub.rs:304 — clippy_lints::implicit_saturating_sub::check_with_condition has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 55 more in this group — see findings.md.
D31 · IaC & Container Security · Medium IaC · ×80
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 55 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×79
  • Duplicated block (5 lines × 2) compiler/rustc_ast/src/ast.rs:177 — compiler/rustc_ast/src/ast.rs:177-181 | compiler/rustc_ast/src/ast.rs:197-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_ast_passes/src/ast_validation.rs:1637 — compiler/rustc_ast_passes/src/ast_validation.rs:1637-1641 | compiler/rustc_ast_passes/src/ast_validation.rs:1648-1652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/item.rs:30 — compiler/rustc_ast_pretty/src/pprust/state/item.rs:30-34 | compiler/rustc_ast_pretty/src/pprust/state/item.rs:609-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_builtin_macros/src/define_opaque.rs:13 — compiler/rustc_builtin_macros/src/define_opaque.rs:13-17 | compiler/rustc_builtin_macros/src/define_opaque.rs:25-29 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_builtin_macros/src/pattern_type.rs:15 — compiler/rustc_builtin_macros/src/pattern_type.rs:15-19 | compiler/rustc_builtin_macros/src/view_type.rs:16-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/scripts/rustc-clif.rs:56 — compiler/rustc_codegen_cranelift/scripts/rustc-clif.rs:56-60 | compiler/rustc_codegen_cranelift/scripts/rustdoc-clif.rs:56-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/cast.rs:131 — compiler/rustc_codegen_cranelift/src/cast.rs:131-135 | compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs:238-242 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:419 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:419-423 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:433-437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1270 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1270-1274 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1310-1314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:501 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:501-505 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:817-821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1078 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1078-1082 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1170-1174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_cranelift/src/value_and_place.rs:238 — compiler/rustc_codegen_cranelift/src/value_and_place.rs:238-242 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:738-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_gcc/src/asm.rs:1155 — compiler/rustc_codegen_gcc/src/asm.rs:1155-1159 | compiler/rustc_codegen_llvm/src/asm.rs:995-999 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:624 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:624-628 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:632-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1338 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1338-1342 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1372-1377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1210 — compiler/rustc_codegen_llvm/src/asm.rs:1210-1214 | compiler/rustc_codegen_llvm/src/asm.rs:1407-1411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_llvm/src/context.rs:1135 — compiler/rustc_codegen_llvm/src/context.rs:1135-1139 | compiler/rustc_codegen_llvm/src/context.rs:1146-1150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2083 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2083-2087 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3033-3037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_hir_analysis/src/check/entry.rs:43 — compiler/rustc_hir_analysis/src/check/entry.rs:43-47 | compiler/rustc_hir_analysis/src/check/entry.rs:57-61 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_hir_pretty/src/lib.rs:983 — compiler/rustc_hir_pretty/src/lib.rs:983-987 | compiler/rustc_hir_pretty/src/lib.rs:1011-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_hir_typeck/src/op.rs:284 — compiler/rustc_hir_typeck/src/op.rs:284-288 | compiler/rustc_hir_typeck/src/op.rs:296-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_middle/src/query/keys.rs:429 — compiler/rustc_middle/src/query/keys.rs:429-433 | compiler/rustc_middle/src/ty/print/mod.rs:306-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs:190 — compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs:190-194 | compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs:216-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_mir_build/src/builder/expr/as_constant.rs:177 — compiler/rustc_mir_build/src/builder/expr/as_constant.rs:177-181 | compiler/rustc_mir_build/src/builder/expr/as_constant.rs:188-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:578 — compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:578-582 | compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:586-590 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 54 more in this group — see findings.md.
D6 · Cohesion (LCOM4) · Low cohesion · ×73
  • Low cohesion: Builder (LCOM4 37) compiler/rustc_codegen_llvm/src/llvm/ffi.rs:717 — Builder's methods fall into 37 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 37 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Socket (LCOM4 26) library/std/src/sys/net/connection/socket/unix.rs:32 — Socket's methods fall into 26 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 26 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Resolver (LCOM4 23) compiler/rustc_hir_typeck/src/writeback.rs:917 — Resolver's methods fall into 23 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 23 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GenericCx (LCOM4 19) compiler/rustc_codegen_llvm/src/context.rs:70 — GenericCx's methods fall into 19 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 19 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CodegenCx (LCOM4 15) compiler/rustc_codegen_gcc/src/context.rs:39 — CodegenCx's methods fall into 15 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 15 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: EnzymeWrapper (LCOM4 14) compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs:125 — EnzymeWrapper's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: StatCollector (LCOM4 14) compiler/rustc_passes/src/input_stats.rs:57 — StatCollector's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Completions (LCOM4 14) src/tools/rust-analyzer/crates/ide-completion/src/completions.rs:57 — Completions's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Diag (LCOM4 13) compiler/rustc_errors/src/diagnostic.rs:354 — Diag's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Formatter (LCOM4 13) library/core/src/fmt/mod.rs:561 — Formatter's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FmtPrinter (LCOM4 12) compiler/rustc_middle/src/ty/print/pretty.rs:2094 — FmtPrinter's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: NodeRef (LCOM4 12) library/alloc/src/collections/btree/node.rs:189 — NodeRef's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: EarlyContextAndPass (LCOM4 11) compiler/rustc_lint/src/early.rs:29 — EarlyContextAndPass's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Rc (LCOM4 11) library/alloc/src/rcs/rc.rs:325 — Rc's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FnCtxt (LCOM4 10) compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs:46 — FnCtxt's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Parser (LCOM4 10) compiler/rustc_parse_format/src/lib.rs:201 — Parser's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Item (LCOM4 10) src/librustdoc/clean/types.rs:321 — Item's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Config (LCOM4 10) src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:1113 — Config's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CfgEval (LCOM4 9) compiler/rustc_builtin_macros/src/cfg_eval.rs:42 — CfgEval's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Socket (LCOM4 9) library/std/src/sys/net/connection/socket/hermit.rs:36 — Socket's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Socket (LCOM4 9) library/std/src/sys/net/connection/socket/windows.rs:117 — Socket's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LateContextAndPass (LCOM4 8) compiler/rustc_lint/src/late.rs:36 — LateContextAndPass's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Ty (LCOM4 8) compiler/rustc_middle/src/ty/mod.rs:517 — Ty's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Span (LCOM4 8) compiler/rustc_span/src/span_encoding.rs:89 — Span's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RegionInferenceContext (LCOM4 7) compiler/rustc_borrowck/src/region_infer/region_context.rs:85 — RegionInferenceContext's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • + 48 more in this group — see findings.md.
D2 · Cognitive Complexity · rustc_hir_analysis · ×61
  • rustc_hir_analysis::check::check::check_item_type (cognitive 86) compiler/rustc_hir_analysis/src/check/check.rs:762 — rustc_hir_analysis::check::check::check_item_type has cognitive complexity 86 (threshold 15). Drivers by points: if/else 21 (52 pts), match/switch 11 (26 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::check::check::opaque_type_cycle_error (cognitive 74) compiler/rustc_hir_analysis/src/check/check.rs:2186 — rustc_hir_analysis::check::check::opaque_type_cycle_error has cognitive complexity 74 (threshold 15). Drivers by points: if/else 12 (37 pts), loops 7 (31 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_hir_analysis::check::check::check_impl_items_against_trait (cognitive 55) compiler/rustc_hir_analysis/src/check/check.rs:1297 — rustc_hir_analysis::check::check::check_impl_items_against_trait has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (38 pts), match/switch 4 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_hir_analysis::check::check::check_opaque_precise_captures (cognitive 54) compiler/rustc_hir_analysis/src/check/check.rs:573 — rustc_hir_analysis::check::check::check_opaque_precise_captures has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (40 pts), match/switch 4 (8 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::collect::type_of::type_of (cognitive 54) compiler/rustc_hir_analysis/src/collect/type_of.rs:21 — rustc_hir_analysis::collect::type_of::type_of has cognitive complexity 54 (threshold 15). Drivers by points: match/switch 17 (31 pts), if/else 11 (21 pts), boolean chains 2 (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_hir_analysis::check::wfcheck::check_gat_where_clauses (cognitive 50) compiler/rustc_hir_analysis/src/check/wfcheck.rs:380 — rustc_hir_analysis::check::wfcheck::check_gat_where_clauses has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 4 (7 pts), match/switch 2 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args (cognitive 46) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:190 — rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 5 (11 pts), match/switch 2 (7 pts), boolean chains 1 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_hir_analysis::coherence::orphan::emit_orphan_check_error (cognitive 44) compiler/rustc_hir_analysis/src/coherence/orphan.rs:381 — rustc_hir_analysis::coherence::orphan::emit_orphan_check_error has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 3 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_hir_analysis::delegation::create_mapping (cognitive 43) compiler/rustc_hir_analysis/src/delegation.rs:179 — rustc_hir_analysis::delegation::create_mapping has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 6 (13 pts), loops 4 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::check::compare_impl_item::check_number_of_early_bound_regions (cognitive 42) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1150 — rustc_hir_analysis::check::compare_impl_item::check_number_of_early_bound_regions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (14 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::hir_ty_lowering::errors::prohibit_assoc_item_constraint (cognitive 42) compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs:1568 — rustc_hir_analysis::hir_ty_lowering::errors::prohibit_assoc_item_constraint has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_hir_analysis::hir_ty_lowering::errors::generics_args_err_extend (cognitive 42) compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs:1814 — rustc_hir_analysis::hir_ty_lowering::errors::generics_args_err_extend has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 3 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_hir_analysis::check::bounds_from_generic_clauses (cognitive 40) compiler/rustc_hir_analysis/src/check/mod.rs:392 — rustc_hir_analysis::check::bounds_from_generic_clauses has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 4 (7 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::check::compare_impl_item::compare_number_of_generics (cognitive 40) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1591 — rustc_hir_analysis::check::compare_impl_item::compare_number_of_generics has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 3 (8 pts), match/switch 3 (8 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::coherence::builtin::infringing_fields_error (cognitive 40) compiler/rustc_hir_analysis/src/coherence/builtin.rs:899 — rustc_hir_analysis::coherence::builtin::infringing_fields_error has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (25 pts), loops 4 (8 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::collect::generics_of::generics_of (cognitive 39) compiler/rustc_hir_analysis/src/collect/generics_of.rs:17 — rustc_hir_analysis::collect::generics_of::generics_of has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 6 (12 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::check::compare_impl_item::compare_number_of_method_arguments (cognitive 38) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1731 — rustc_hir_analysis::check::compare_impl_item::compare_number_of_method_arguments has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 1 (3 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_hir_analysis::coherence::orphan::orphan_check_impl (cognitive 37) compiler/rustc_hir_analysis/src/coherence/orphan.rs:22 — rustc_hir_analysis::coherence::orphan::orphan_check_impl has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 7 (17 pts), if/else 9 (16 pts), loops 1 (4 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_hir_analysis::check::check::check_transparent (cognitive 36) compiler/rustc_hir_analysis/src/check/check.rs:1779 — rustc_hir_analysis::check::check::check_transparent has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 13). Of this number, 23 points are the body's own statements and 13 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::diagnostics::remove_or_use_generic::suggest_to_remove_or_use_generic (cognitive 35) compiler/rustc_hir_analysis/src/diagnostics/remove_or_use_generic.rs:60 — rustc_hir_analysis::diagnostics::remove_or_use_generic::suggest_to_remove_or_use_generic has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count (cognitive 33) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:419 — rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 6, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::impl_wf_check::enforce_impl_lifetime_params_are_constrained (cognitive 33) compiler/rustc_hir_analysis/src/impl_wf_check.rs:77 — rustc_hir_analysis::impl_wf_check::enforce_impl_lifetime_params_are_constrained has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 2 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::check::compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait (cognitive 31) compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs:21 — rustc_hir_analysis::check::compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_analysis::coherence::builtin::visit_implementation_of_dispatch_from_dyn (cognitive 31) compiler/rustc_hir_analysis/src/coherence/builtin.rs:287 — rustc_hir_analysis::coherence::builtin::visit_implementation_of_dispatch_from_dyn has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 4, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_hir_analysis::hir_ty_lowering::generics::generic_arg_mismatch_err (cognitive 30) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:29 — rustc_hir_analysis::hir_ty_lowering::generics::generic_arg_mismatch_err has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 36 more in this group — see findings.md.
D2 · Cognitive Complexity · rustdoc · ×59
  • rustdoc::html::render::search_index::build_index (cognitive 175) REDACTED:1267 — rustdoc::html::render::search_index::build_index has cognitive complexity 175 (threshold 15). Drivers by points: if/else 46 (109 pts), loops 15 (38 pts), boolean chains 15, match/switch 7 (13 pts) (nesting depth added 92). Of this number, 128 points are the body's own statements and 47 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::passes::collect_intra_doc_links::resolution_failure (cognitive 121) src/librustdoc/passes/collect_intra_doc_links.rs:2093 — rustdoc::passes::collect_intra_doc_links::resolution_failure has cognitive complexity 121 (threshold 15). Drivers by points: if/else 33 (96 pts), match/switch 4 (12 pts), loops 3 (8 pts), boolean chains 5 (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustdoc::html::render::print_item::item_trait (cognitive 117) src/librustdoc/html/render/print_item.rs:646 — rustdoc::html::render::print_item::item_trait has cognitive complexity 117 (threshold 15). Drivers by points: if/else 40 (66 pts), loops 17 (39 pts), boolean chains 9, match/switch 1 (3 pts) (nesting depth added 50). Of this number, 110 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::doctest::make::parse_source (cognitive 77) src/librustdoc/doctest/make.rs:463 — rustdoc::doctest::make::parse_source has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (47 pts), boolean chains 11, match/switch 6 (10 pts), loops 3 (9 pts) (nesting depth added 37). Of this number, 61 points are the body's own statements and 16 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::doctest::run_test (cognitive 73) src/librustdoc/doctest.rs:607 — rustdoc::doctest::run_test has cognitive complexity 73 (threshold 15). Drivers by points: if/else 36 (55 pts), match/switch 6 (9 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::markdown::markdown_links (cognitive 73) src/librustdoc/html/markdown.rs:1793 — rustdoc::html::markdown::markdown_links has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 11 (15 pts), match/switch 5 (12 pts), boolean chains 6 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::render::search_index::simplify_fn_type (cognitive 66) REDACTED:2118 — rustdoc::html::render::search_index::simplify_fn_type has cognitive complexity 66 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 7, loops 2 (6 pts), match/switch 2 (4 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustdoc::clean::clean_generics (cognitive 65) src/librustdoc/clean/mod.rs:756 — rustdoc::clean::clean_generics has cognitive complexity 65 (threshold 15). Drivers by points: if/else 7 (31 pts), loops 7 (22 pts), match/switch 5 (11 pts), boolean chains 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::render::render_impl::doc_impl_item (cognitive 63) src/librustdoc/html/render/mod.rs:1887 — rustdoc::html::render::render_impl::doc_impl_item has cognitive complexity 63 (threshold 15). Drivers by points: if/else 29 (58 pts), boolean chains 3, match/switch 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rustdoc::html::render::render_impl) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustdoc::html::render::print_item::item_module (cognitive 63) src/librustdoc/html/render/print_item.rs:254 — rustdoc::html::render::print_item::item_module has cognitive complexity 63 (threshold 15). Drivers by points: match/switch 10 (28 pts), if/else 14 (26 pts), loops 6 (9 pts) (nesting depth added 33). Of this number, 58 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::clean::clean_middle_assoc_item (cognitive 62) src/librustdoc/clean/mod.rs:1393 — rustdoc::clean::clean_middle_assoc_item has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 10 (27 pts), boolean chains 2 (nesting depth added 34). Of this number, 57 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::passes::lint::unescaped_backticks::visit_item (cognitive 62) src/librustdoc/passes/lint/unescaped_backticks.rs:15 — rustdoc::passes::lint::unescaped_backticks::visit_item has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (45 pts), boolean chains 8, match/switch 3 (8 pts), loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::passes::lint::invalid_markdown_table::visit_item (cognitive 58) src/librustdoc/passes/lint/invalid_markdown_table.rs:32 — rustdoc::passes::lint::invalid_markdown_table::visit_item has cognitive complexity 58 (threshold 15). Drivers by points: if/else 9 (42 pts), loops 3 (10 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustdoc::clean::first_non_private (cognitive 55) src/librustdoc/clean/mod.rs:1659 — rustdoc::clean::first_non_private has cognitive complexity 55 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 4 (14 pts), match/switch 2 (7 pts), boolean chains 4 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::passes::lint::html_tags::visit_item (cognitive 54) src/librustdoc/passes/lint/html_tags.rs:19 — rustdoc::passes::lint::html_tags::visit_item has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 6 (11 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::clean::cfg::extract_cfg_from_attrs (cognitive 53) src/librustdoc/clean/cfg.rs:838 — rustdoc::clean::cfg::extract_cfg_from_attrs has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 7 (19 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 25). Of this number, 49 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::clean::inline::build_impl (cognitive 47) src/librustdoc/clean/inline.rs:472 — rustdoc::clean::inline::build_impl has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 9, match/switch 5 (8 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::render::print_item::compare_names (cognitive 46) src/librustdoc/html/render/print_item.rs:2222 — rustdoc::html::render::print_item::compare_names has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 6 (20 pts), if/else 5 (16 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::render::print_item::render_struct_fields (cognitive 46) src/librustdoc/html/render/print_item.rs:2541 — rustdoc::html::render::print_item::render_struct_fields has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 2 (5 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustdoc::html::render::render_impl (cognitive 44) src/librustdoc/html/render/mod.rs:1866 — rustdoc::html::render::render_impl has cognitive complexity 44 (threshold 15). Drivers by points: if/else 47 (90 pts), boolean chains 10, loops 5 (8 pts), match/switch 3 (5 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rustdoc::html::render::render_impl::doc_impl_item) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustdoc::clean::auto_trait::clean_region_outlives_constraints (cognitive 43) src/librustdoc/clean/auto_trait.rs:224 — rustdoc::clean::auto_trait::clean_region_outlives_constraints has cognitive complexity 43 (threshold 15). Drivers by points: if/else 7 (29 pts), loops 4 (7 pts), match/switch 3 (7 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::passes::collect_trait_impls::collect_trait_impls (cognitive 39) src/librustdoc/passes/collect_trait_impls.rs:19 — rustdoc::passes::collect_trait_impls::collect_trait_impls has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 7 (13 pts), match/switch 2 (8 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::main_args (cognitive 34) src/librustdoc/lib.rs:816 — rustdoc::main_args has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (22 pts), match/switch 5 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustdoc::html::format::fmt_type (cognitive 34) src/librustdoc/html/format.rs:1116 — rustdoc::html::format::fmt_type has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 5 (10 pts), boolean chains 2 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustdoc::clean::maybe_expand_private_type_alias (cognitive 33) src/librustdoc/clean/mod.rs:1853 — rustdoc::clean::maybe_expand_private_type_alias has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×59
  • Duplicated block (8 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/item.rs:364 — compiler/rustc_ast_pretty/src/pprust/state/item.rs:364-371 | compiler/rustc_ast_pretty/src/pprust/state/item.rs:397-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:84 — compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:84-91 | compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:114-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs:815 — compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs:815-822 | compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs:823-830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_attr_parsing/src/attributes/stability.rs:357 — compiler/rustc_attr_parsing/src/attributes/stability.rs:357-364 | compiler/rustc_attr_parsing/src/attributes/stability.rs:453-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_borrowck/src/diagnostics/mod.rs:613 — compiler/rustc_borrowck/src/diagnostics/mod.rs:613-620 | compiler/rustc_borrowck/src/diagnostics/mod.rs:633-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_builtin_macros/src/concat.rs:70 — compiler/rustc_builtin_macros/src/concat.rs:70-77 | compiler/rustc_builtin_macros/src/concat_bytes.rs:196-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:127 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:127-134 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:173-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:168 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:168-175 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:261-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:640 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:640-647 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:660-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:653 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:653-660 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:694-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:681 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:681-688 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:701-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:810 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:810-817 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:835-842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_cranelift/src/value_and_place.rs:219 — compiler/rustc_codegen_cranelift/src/value_and_place.rs:219-226 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:246-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_gcc/src/builder.rs:1482 — compiler/rustc_codegen_gcc/src/builder.rs:1482-1489 | compiler/rustc_codegen_gcc/src/builder.rs:1508-1515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_gcc/src/context.rs:649 — compiler/rustc_codegen_gcc/src/context.rs:649-656 | compiler/rustc_codegen_llvm/src/context.rs:1178-1185 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:81 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:81-88 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2143-2150 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1268 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1268-1275 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3306-3313 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_gcc/src/type_.rs:484 — compiler/rustc_codegen_gcc/src/type_.rs:484-491 | compiler/rustc_codegen_llvm/src/type_of.rs:168-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1621 — compiler/rustc_codegen_llvm/src/asm.rs:1621-1629 | compiler/rustc_codegen_llvm/src/asm.rs:1661-1668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_llvm/src/back/lto.rs:408 — compiler/rustc_codegen_llvm/src/back/lto.rs:408-415 | compiler/rustc_codegen_llvm/src/back/lto.rs:436-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_ssa/src/back/metadata.rs:528 — compiler/rustc_codegen_ssa/src/back/metadata.rs:528-535 | compiler/rustc_codegen_ssa/src/back/metadata.rs:651-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:161 — compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:161-168 | compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:382-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_ssa/src/back/write.rs:1869 — compiler/rustc_codegen_ssa/src/back/write.rs:1869-1876 | compiler/rustc_codegen_ssa/src/back/write.rs:1926-1933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_codegen_ssa/src/target_features.rs:467 — compiler/rustc_codegen_ssa/src/target_features.rs:467-474 | compiler/rustc_codegen_ssa/src/target_features.rs:493-500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:777 — compiler/rustc_const_eval/src/const_eval/machine.rs:777-784 | compiler/rustc_const_eval/src/const_eval/machine.rs:803-810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×59
  • Duplicated block (7 lines × 2) compiler/rustc_ast/src/ast.rs:1585 — compiler/rustc_ast/src/ast.rs:1585-1591 | compiler/rustc_hir/src/hir.rs:2247-2253 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_ast_pretty/src/pprust/state.rs:1372 — compiler/rustc_ast_pretty/src/pprust/state.rs:1372-1378 | compiler/rustc_hir_pretty/src/lib.rs:414-420 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:313 — compiler/rustc_ast_pretty/src/pprust/state/expr.rs:313-319 | compiler/rustc_hir_pretty/src/lib.rs:1417-1423 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state/expr.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:547 — compiler/rustc_ast_pretty/src/pprust/state/expr.rs:547-553 | compiler/rustc_hir_pretty/src/lib.rs:1650-1656 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state/expr.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs:145 — compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs:145-151 | compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs:321-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_borrowck/src/diagnostics/mod.rs:926 — compiler/rustc_borrowck/src/diagnostics/mod.rs:926-932 | compiler/rustc_borrowck/src/diagnostics/mod.rs:956-962 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:95 — compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:95-101 | compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:484-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_builtin_macros/src/concat.rs:15 — compiler/rustc_builtin_macros/src/concat.rs:15-21 | compiler/rustc_builtin_macros/src/concat_bytes.rs:140-146 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:289 — compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:289-295 | compiler/rustc_builtin_macros/src/format_foreign/shell/mod.rs:56-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_builtin_macros/src/source_util.rs:211 — compiler/rustc_builtin_macros/src/source_util.rs:211-217 | compiler/rustc_builtin_macros/src/source_util.rs:245-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_builtin_macros/src/util.rs:138 — compiler/rustc_builtin_macros/src/util.rs:138-144 | compiler/rustc_builtin_macros/src/util.rs:193-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:768 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:768-774 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:787-793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1044 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1044-1050 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1173-1179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/build_system/src/utils.rs:20 — compiler/rustc_codegen_gcc/build_system/src/utils.rs:20-27 | compiler/rustc_codegen_gcc/build_system/src/utils.rs:133-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/allocator.rs:81 — compiler/rustc_codegen_gcc/src/allocator.rs:81-87 | compiler/rustc_codegen_gcc/src/allocator.rs:107-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/back/lto.rs:73 — compiler/rustc_codegen_gcc/src/back/lto.rs:73-79 | compiler/rustc_codegen_llvm/src/back/lto.rs:103-109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/builder.rs:1164 — compiler/rustc_codegen_gcc/src/builder.rs:1164-1170 | compiler/rustc_codegen_llvm/src/builder.rs:1695-1701 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/consts.rs:248 — compiler/rustc_codegen_gcc/src/consts.rs:248-254 | compiler/rustc_codegen_llvm/src/consts.rs:353-359 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/context.rs:632 — compiler/rustc_codegen_gcc/src/context.rs:632-638 | compiler/rustc_codegen_llvm/src/context.rs:1165-1171 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:896 — compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:896-902 | compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:903-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_gcc/src/type_.rs:464 — compiler/rustc_codegen_gcc/src/type_.rs:464-470 | compiler/rustc_codegen_llvm/src/type_of.rs:137-143 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) compiler/rustc_codegen_llvm/src/builder.rs:1665 — compiler/rustc_codegen_llvm/src/builder.rs:1665-1671 | compiler/rustc_codegen_llvm/src/builder.rs:1699-1705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_hir_pretty/src/lib.rs:996 — compiler/rustc_hir_pretty/src/lib.rs:996-1002 | compiler/rustc_hir_pretty/src/lib.rs:1021-1027 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_hir_typeck/src/fallback.rs:555 — compiler/rustc_hir_typeck/src/fallback.rs:555-561 | compiler/rustc_hir_typeck/src/fallback.rs:584-592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) compiler/rustc_hir_typeck/src/upvar.rs:2499 — compiler/rustc_hir_typeck/src/upvar.rs:2499-2505 | compiler/rustc_hir_typeck/src/upvar.rs:2521-2527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×59
  • Duplicated block (6 lines × 2) compiler/rustc_ast_lowering/src/item.rs:377 — compiler/rustc_ast_lowering/src/item.rs:377-382 | compiler/rustc_ast_lowering/src/item.rs:386-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_ast_lowering/src/lib.rs:1445 — compiler/rustc_ast_lowering/src/lib.rs:1445-1450 | compiler/rustc_ast_lowering/src/lib.rs:1459-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:22 — compiler/rustc_ast_pretty/src/pprust/state/expr.rs:22-27 | compiler/rustc_hir_pretty/src/lib.rs:1136-1141 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state/expr.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) compiler/rustc_attr_parsing/src/attributes/autodiff.rs:53 — compiler/rustc_attr_parsing/src/attributes/autodiff.rs:53-58 | compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:109-114 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) compiler/rustc_attr_parsing/src/diagnostics.rs:1562 — compiler/rustc_attr_parsing/src/diagnostics.rs:1562-1569 | compiler/rustc_attr_parsing/src/diagnostics.rs:1598-1603 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_borrowck/src/universal_regions.rs:243 — compiler/rustc_borrowck/src/universal_regions.rs:243-248 | compiler/rustc_borrowck/src/universal_regions.rs:291-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_builtin_macros/src/env.rs:46 — compiler/rustc_builtin_macros/src/env.rs:46-51 | compiler/rustc_builtin_macros/src/env.rs:119-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs:112 — compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs:112-117 | compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs:170-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/cast.rs:139 — compiler/rustc_codegen_cranelift/src/cast.rs:139-144 | compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs:246-251 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/constant.rs:153 — compiler/rustc_codegen_cranelift/src/constant.rs:153-159 | compiler/rustc_codegen_cranelift/src/constant.rs:238-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:203 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:203-208 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:369-374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:139 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:139-144 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:198-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:711 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:711-716 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:722-727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:667 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:667-672 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3418-3423 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_gcc/src/type_.rs:433 — compiler/rustc_codegen_gcc/src/type_.rs:433-438 | compiler/rustc_codegen_llvm/src/type_.rs:143-148 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) compiler/rustc_codegen_gcc/src/type_of.rs:112 — compiler/rustc_codegen_gcc/src/type_of.rs:112-117 | compiler/rustc_codegen_llvm/src/type_of.rs:95-100 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) compiler/rustc_const_eval/src/check_consts/resolver.rs:176 — compiler/rustc_const_eval/src/check_consts/resolver.rs:176-181 | compiler/rustc_const_eval/src/check_consts/resolver.rs:187-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_const_eval/src/interpret/intrinsics.rs:276 — compiler/rustc_const_eval/src/interpret/intrinsics.rs:276-281 | compiler/rustc_mir_dataflow/src/move_paths/builder.rs:199-204 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:677 — compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:677-682 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:707-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_const_eval/src/interpret/memory.rs:488 — compiler/rustc_const_eval/src/interpret/memory.rs:488-493 | compiler/rustc_const_eval/src/interpret/memory.rs:504-509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_hir_analysis/src/coherence/builtin.rs:454 — compiler/rustc_hir_analysis/src/coherence/builtin.rs:454-459 | compiler/rustc_hir_analysis/src/coherence/builtin.rs:848-853 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_hir_typeck/src/coercion.rs:957 — compiler/rustc_hir_typeck/src/coercion.rs:957-962 | compiler/rustc_hir_typeck/src/coercion.rs:984-989 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_hir_typeck/src/writeback.rs:163 — compiler/rustc_hir_typeck/src/writeback.rs:163-168 | compiler/rustc_hir_typeck/src/writeback.rs:182-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_middle/src/ty/print/pretty.rs:423 — compiler/rustc_middle/src/ty/print/pretty.rs:423-428 | compiler/rustc_middle/src/ty/print/pretty.rs:431-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) compiler/rustc_mir_dataflow/src/framework/direction.rs:116 — compiler/rustc_mir_dataflow/src/framework/direction.rs:116-121 | compiler/rustc_mir_dataflow/src/framework/direction.rs:241-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 34 more in this group — see findings.md.
D2 · Cognitive Complexity · Parser · ×57
  • Parser::parse_fn_front_matter (cognitive 73) compiler/rustc_parse/src/parser/function.rs:413 — Parser::parse_fn_front_matter has cognitive complexity 73 (threshold 15). Drivers by points: if/else 20 (39 pts), match/switch 8 (29 pts), boolean chains 5 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::expected_one_of_not_found (cognitive 72) compiler/rustc_parse/src/parser/diagnostics.rs:348 — Parser::expected_one_of_not_found has cognitive complexity 72 (threshold 15). Drivers by points: if/else 36 (43 pts), boolean chains 28, loops 1 (nesting depth added 7). Of this number, 67 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::parse_pat_fields (cognitive 68) compiler/rustc_parse/src/parser/pat.rs:1669 — Parser::parse_pat_fields has cognitive complexity 68 (threshold 15). Drivers by points: if/else 25 (61 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_struct_fields (cognitive 62) compiler/rustc_parse/src/parser/expr.rs:3634 — Parser::parse_struct_fields has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (49 pts), match/switch 3 (7 pts), boolean chains 5, loops 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_expr_bottom (cognitive 56) compiler/rustc_parse/src/parser/expr.rs:1246 — Parser::parse_expr_bottom has cognitive complexity 56 (threshold 15). Drivers by points: if/else 45 (51 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::parse_ty_common (cognitive 54) compiler/rustc_parse/src/parser/ty.rs:273 — Parser::parse_ty_common has cognitive complexity 54 (threshold 15). Drivers by points: if/else 30 (37 pts), boolean chains 10, match/switch 3 (7 pts) (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::new (cognitive 53) compiler/rustc_parse_format/src/lib.rs:302 — Parser::new has cognitive complexity 53 (threshold 15). Drivers by points: if/else 23 (47 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Parser::parse_pat_with_range_pat (cognitive 51) compiler/rustc_parse/src/parser/pat.rs:721 — Parser::parse_pat_with_range_pat has cognitive complexity 51 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 8, match/switch 3 (8 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::parse_arm (cognitive 50) compiler/rustc_parse/src/parser/expr.rs:3129 — Parser::parse_arm has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 8 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Parser::check_no_chained_comparison (cognitive 49) compiler/rustc_parse/src/parser/diagnostics.rs:1340 — Parser::check_no_chained_comparison has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (35 pts), match/switch 3 (9 pts), boolean chains 5 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Parser::parse_item_kind (cognitive 45) compiler/rustc_parse/src/parser/item.rs:254 — Parser::parse_item_kind has cognitive complexity 45 (threshold 15). Drivers by points: if/else 29 (34 pts), boolean chains 11 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::parse_path_segment (cognitive 44) compiler/rustc_parse/src/parser/path.rs:291 — Parser::parse_path_segment has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 11, match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_param_general (cognitive 38) compiler/rustc_parse/src/parser/function.rs:737 — Parser::parse_param_general has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_generic_params (cognitive 35) compiler/rustc_parse/src/parser/generics.rs:204 — Parser::parse_generic_params has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (28 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_item_impl (cognitive 35) compiler/rustc_parse/src/parser/item.rs:696 — Parser::parse_item_impl has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::collect_tokens (cognitive 34) compiler/rustc_parse/src/parser/attr_wrapper.rs:156 — Parser::collect_tokens has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 5, loops 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::recover_missing_kw_before_item (cognitive 33) compiler/rustc_parse/src/parser/item.rs:506 — Parser::recover_missing_kw_before_item has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::format (cognitive 33) compiler/rustc_parse_format/src/lib.rs:618 — Parser::format has cognitive complexity 33 (threshold 15). Drivers by points: if/else 26 (33 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Parser::maybe_augment_stashed_expr_in_pats_with_suggestions (cognitive 32) compiler/rustc_parse/src/parser/pat.rs:511 — Parser::maybe_augment_stashed_expr_in_pats_with_suggestions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 6 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parameter_without_type (cognitive 29) compiler/rustc_parse/src/parser/diagnostics.rs:2004 — Parser::parameter_without_type has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 7, match/switch 2 (5 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_if_after_cond (cognitive 29) compiler/rustc_parse/src/parser/expr.rs:2460 — Parser::parse_if_after_cond has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 3, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::next (cognitive 27) compiler/rustc_parse_format/src/lib.rs:233 — Parser::next has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Parser::parse_outer_attributes (cognitive 26) compiler/rustc_parse/src/parser/attr.rs:40 — Parser::parse_outer_attributes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 1 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::expected_ident_found (cognitive 26) compiler/rustc_parse/src/parser/diagnostics.rs:201 — Parser::expected_ident_found has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_where_clause_predicates (cognitive 24) compiler/rustc_parse/src/parser/generics.rs:458 — Parser::parse_where_clause_predicates has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 32 more in this group — see findings.md.
D1 · Cyclomatic Complexity · FnCtxt · ×56
  • FnCtxt::suggest_traits_to_import (cyclomatic 84) compiler/rustc_hir_typeck/src/method/suggest.rs:4140 — FnCtxt::suggest_traits_to_import has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::handle_unsatisfied_predicates (cyclomatic 70) compiler/rustc_hir_typeck/src/method/suggest.rs:1705 — FnCtxt::handle_unsatisfied_predicates has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_deref_or_ref (cyclomatic 64) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2966 — FnCtxt::suggest_deref_or_ref has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_cast (cyclomatic 56) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:3420 — FnCtxt::suggest_cast has cyclomatic complexity 56 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • FnCtxt::instantiate_value_path (cyclomatic 50) compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:1025 — FnCtxt::instantiate_value_path has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::label_fn_like (cyclomatic 50) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:1661 — FnCtxt::label_fn_like has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_expr_struct_fields (cyclomatic 45) compiler/rustc_hir_typeck/src/expr.rs:1879 — FnCtxt::check_expr_struct_fields has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::note_source_of_type_mismatch_constraint (cyclomatic 39) compiler/rustc_hir_typeck/src/demand.rs:289 — FnCtxt::note_source_of_type_mismatch_constraint has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_deref_ref_or_into (cyclomatic 37) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:346 — FnCtxt::suggest_deref_ref_or_into has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::analyze_closure (cyclomatic 37) compiler/rustc_hir_typeck/src/upvar.rs:243 — FnCtxt::analyze_closure has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_compatible_variants (cyclomatic 32) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2621 — FnCtxt::suggest_compatible_variants has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_pat_inner (cyclomatic 32) compiler/rustc_hir_typeck/src/pat.rs:479 — FnCtxt::check_pat_inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FnCtxt::report_invalid_callee (cyclomatic 31) compiler/rustc_hir_typeck/src/callee.rs:917 — FnCtxt::report_invalid_callee has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::point_at_expr_if_possible (cyclomatic 30) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:288 — FnCtxt::point_at_expr_if_possible has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_argument_types (cyclomatic 30) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:192 — FnCtxt::check_argument_types has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_expr_field (cyclomatic 29) compiler/rustc_hir_typeck/src/expr.rs:2779 — FnCtxt::check_expr_field has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: FnCtxt::check_expr_kind (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FnCtxt::annotate_loop_expected_due_to_inference (cyclomatic 28) compiler/rustc_hir_typeck/src/demand.rs:576 — FnCtxt::annotate_loop_expected_due_to_inference has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::note_type_is_not_clone (cyclomatic 27) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:2036 — FnCtxt::note_type_is_not_clone has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::blame_specific_part_of_expr_corresponding_to_generic_param (cyclomatic 26) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:875 — FnCtxt::blame_specific_part_of_expr_corresponding_to_generic_param has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_unwrapping_inner_self (cyclomatic 26) compiler/rustc_hir_typeck/src/method/suggest.rs:3272 — FnCtxt::suggest_unwrapping_inner_self has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::report_method_error (cyclomatic 25) compiler/rustc_hir_typeck/src/method/suggest.rs:256 — FnCtxt::report_method_error has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_pat_ref (cyclomatic 25) compiler/rustc_hir_typeck/src/pat.rs:2792 — FnCtxt::check_pat_ref has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::check_tupled_arguments (cyclomatic 23) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:583 — FnCtxt::check_tupled_arguments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::suggest_missing_break_or_return_expr (cyclomatic 23) compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:1303 — FnCtxt::suggest_missing_break_or_return_expr has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnCtxt::report_binop_fulfillment_errors (cyclomatic 22) compiler/rustc_hir_typeck/src/op.rs:329 — FnCtxt::report_binop_fulfillment_errors has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rustc_hir_typeck::op::lang_item_for_binop (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • + 31 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED · ×52
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 27 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×52
  • Duplicated block (9 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:1016 — compiler/rustc_ast_pretty/src/pprust/state/expr.rs:1016-1024 | compiler/rustc_ast_pretty/src/pprust/state/expr.rs:1027-1035 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_attr_parsing/src/attributes/doc.rs:102 — compiler/rustc_attr_parsing/src/attributes/doc.rs:102-110 | compiler/rustc_attr_parsing/src/attributes/doc.rs:563-571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_builtin_macros/src/asm.rs:81 — compiler/rustc_builtin_macros/src/asm.rs:81-89 | compiler/rustc_parse/src/parser/asm.rs:260-268 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/inline_asm.rs:66 — compiler/rustc_codegen_cranelift/src/inline_asm.rs:66-74 | compiler/rustc_codegen_cranelift/src/inline_asm.rs:226-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/inline_asm.rs:812 — compiler/rustc_codegen_cranelift/src/inline_asm.rs:812-820 | compiler/rustc_codegen_cranelift/src/inline_asm.rs:861-869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:1180 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:1180-1188 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:1205-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1116 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1116-1124 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1253-1261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:50 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:50-58 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:520-528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_cranelift/src/pretty_clif.rs:129 — compiler/rustc_codegen_cranelift/src/pretty_clif.rs:129-137 | compiler/rustc_codegen_cranelift/src/pretty_clif.rs:148-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_gcc/src/declare.rs:24 — compiler/rustc_codegen_gcc/src/declare.rs:24-32 | compiler/rustc_codegen_gcc/src/declare.rs:76-84 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1029 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1029-1037 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1148-1156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_gcc/src/type_of.rs:36 — compiler/rustc_codegen_gcc/src/type_of.rs:36-44 | compiler/rustc_codegen_llvm/src/type_.rs:110-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_gcc/src/type_of.rs:48 — compiler/rustc_codegen_gcc/src/type_of.rs:48-56 | compiler/rustc_codegen_llvm/src/type_.rs:121-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2254 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2254-2262 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2306-2314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_const_eval/src/const_eval/valtrees.rs:369 — compiler/rustc_const_eval/src/const_eval/valtrees.rs:369-377 | compiler/rustc_middle/src/ty/util.rs:1588-1596 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:634 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:634-643 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2379-2387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:508 — compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:508-516 | compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:524-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_index/src/interval.rs:265 — compiler/rustc_index/src/interval.rs:265-273 | compiler/rustc_index/src/interval.rs:289-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_infer/src/infer/relate/type_relating.rs:109 — compiler/rustc_infer/src/infer/relate/type_relating.rs:109-117 | compiler/rustc_type_ir/src/relate/solver_relating.rs:136-144 — before extracting anything, compare `compiler/rustc_infer/src/infer/relate/type_relating.rs` and `compiler/rustc_type_ir/src/relate/solver_relating.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) compiler/rustc_interface/src/util.rs:673 — compiler/rustc_interface/src/util.rs:673-681 | compiler/rustc_interface/src/util.rs:704-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_macros/src/type_foldable.rs:29 — compiler/rustc_macros/src/type_foldable.rs:29-37 | compiler/rustc_type_ir_macros/src/lib.rs:169-177 — before extracting anything, compare `compiler/rustc_macros/src/type_foldable.rs` and `compiler/rustc_type_ir_macros/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) compiler/rustc_metadata/src/rmeta/encoder.rs:1595 — compiler/rustc_metadata/src/rmeta/encoder.rs:1595-1603 | compiler/rustc_metadata/src/rmeta/encoder.rs:1617-1625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_middle/src/query/keys.rs:445 — compiler/rustc_middle/src/query/keys.rs:445-453 | compiler/rustc_middle/src/ty/print/mod.rs:322-330 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) compiler/rustc_middle/src/ty/instance.rs:801 — compiler/rustc_middle/src/ty/instance.rs:801-809 | compiler/rustc_middle/src/ty/instance.rs:813-821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) compiler/rustc_mir_build/src/thir/cx/expr.rs:418 — compiler/rustc_mir_build/src/thir/cx/expr.rs:418-426 | compiler/rustc_mir_build/src/thir/cx/expr.rs:546-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 27 more in this group — see findings.md.
D2 · Cognitive Complexity · ide_assists · ×51
  • ide_assists::handlers::inline_call::inline (cognitive 75) src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs:349 — ide_assists::handlers::inline_call::inline has cognitive complexity 75 (threshold 15). Drivers by points: if/else 25 (46 pts), match/switch 7 (13 pts), boolean chains 8, loops 5 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cognitive 59) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54 — ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (43 pts), match/switch 5 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_variable::extract_variable (cognitive 56) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs:74 — ide_assists::handlers::extract_variable::extract_variable has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 10 (16 pts), boolean chains 3, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::unwrap_return_type::unwrap_return_type (cognitive 54) src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_return_type.rs:40 — ide_assists::handlers::unwrap_return_type::unwrap_return_type has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 5 (12 pts), boolean chains 4, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::inline_type_alias::create_replacement (cognitive 52) src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_type_alias.rs:320 — ide_assists::handlers::inline_type_alias::create_replacement has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 4, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cognitive 44) src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs:41 — ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 6, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cognitive 44) src/tools/rust-analyzer/crates/ide-assists/src/utils/gen_trait_fn_body.rs:414 — ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (16 pts), match/switch 5 (9 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::add_turbo_fish::add_turbo_fish (cognitive 39) src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_turbo_fish.rs:31 — ide_assists::handlers::add_turbo_fish::add_turbo_fish has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 7, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::apply_demorgan::apply_demorgan (cognitive 36) src/tools/rust-analyzer/crates/ide-assists/src/handlers/apply_demorgan.rs:40 — ide_assists::handlers::apply_demorgan::apply_demorgan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_function::update_external_control_flow (cognitive 35) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:2128 — ide_assists::handlers::extract_function::update_external_control_flow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (24 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::generate_new::generate_new (cognitive 35) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_new.rs:36 — ide_assists::handlers::generate_new::generate_new has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 4 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::convert_bool_to_enum::replace_usages (cognitive 30) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212 — ide_assists::handlers::convert_bool_to_enum::replace_usages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cognitive 30) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351 — ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 5 (11 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_module::extract_module (cognitive 29) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:56 — ide_assists::handlers::extract_module::extract_module has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cognitive 29) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_delegate_methods.rs:51 — ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cognitive 28) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31 — ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 4 (9 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::wrap_return_type::wrap_return_type (cognitive 28) src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs:43 — ide_assists::handlers::wrap_return_type::wrap_return_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 4 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_function::extract_function (cognitive 27) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:67 — ide_assists::handlers::extract_function::extract_function has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::generate_documentation_template::introduction_builder (cognitive 27) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_documentation_template.rs:187 — ide_assists::handlers::generate_documentation_template::introduction_builder has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_type_alias::collect_used_generics (cognitive 25) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_type_alias.rs:110 — ide_assists::handlers::extract_type_alias::collect_used_generics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_assists::handlers::remove_dbg::compute_dbg_replacement (cognitive 25) src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_dbg.rs:72 — ide_assists::handlers::remove_dbg::compute_dbg_replacement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cognitive 24) src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38 — ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_assists::handlers::extract_function::make_body (cognitive 23) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:1800 — ide_assists::handlers::extract_function::make_body has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 11 (23 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_assists::handlers::merge_match_arms::get_arm_types::recurse (cognitive 23) src/tools/rust-analyzer/crates/ide-assists/src/handlers/merge_match_arms.rs:130 — ide_assists::handlers::merge_match_arms::get_arm_types::recurse has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • ide_assists::handlers::remove_unused_imports::remove_unused_imports (cognitive 23) src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_unused_imports.rs:36 — ide_assists::handlers::remove_unused_imports::remove_unused_imports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 6 (9 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 26 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×50
  • Duplicated block (10 lines × 2) compiler/rustc_ast_pretty/src/pprust/state.rs:1857 — compiler/rustc_ast_pretty/src/pprust/state.rs:1857-1866 | compiler/rustc_hir_pretty/src/lib.rs:1553-1562 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) compiler/rustc_borrowck/src/lib.rs:1923 — compiler/rustc_borrowck/src/lib.rs:1923-1932 | compiler/rustc_borrowck/src/lib.rs:1967-1976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_builtin_macros/src/alloc_error_handler.rs:43 — compiler/rustc_builtin_macros/src/alloc_error_handler.rs:43-52 | compiler/rustc_builtin_macros/src/global_allocator.rs:56-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) compiler/rustc_builtin_macros/src/asm.rs:592 — compiler/rustc_builtin_macros/src/asm.rs:592-601 | compiler/rustc_builtin_macros/src/asm.rs:616-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_builtin_macros/src/util.rs:85 — compiler/rustc_builtin_macros/src/util.rs:85-94 | compiler/rustc_builtin_macros/src/util.rs:239-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:561 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:561-570 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:587-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:827 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:827-836 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:849-858 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:821 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:821-830 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:885-894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_gcc/src/asm.rs:344 — compiler/rustc_codegen_gcc/src/asm.rs:344-353 | compiler/rustc_codegen_gcc/src/asm.rs:390-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_gcc/src/consts.rs:262 — compiler/rustc_codegen_gcc/src/consts.rs:262-271 | compiler/rustc_codegen_llvm/src/consts.rs:368-377 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1344 — compiler/rustc_codegen_llvm/src/asm.rs:1344-1353 | compiler/rustc_codegen_llvm/src/asm.rs:1531-1540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1356 — compiler/rustc_codegen_llvm/src/asm.rs:1356-1365 | compiler/rustc_codegen_llvm/src/asm.rs:1542-1551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2643 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2643-2652 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2743-2752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2824 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2824-2833 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2910-2919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:307 — compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:307-318 | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:341-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:788 — compiler/rustc_const_eval/src/const_eval/machine.rs:788-797 | compiler/rustc_const_eval/src/const_eval/machine.rs:849-858 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_driver_impl/src/lib.rs:492 — compiler/rustc_driver_impl/src/lib.rs:492-501 | compiler/rustc_driver_impl/src/lib.rs:537-546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_hir_analysis/src/coherence/builtin.rs:476 — compiler/rustc_hir_analysis/src/coherence/builtin.rs:476-485 | compiler/rustc_hir_analysis/src/coherence/builtin/coerce_shared.rs:239-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) compiler/rustc_hir_analysis/src/coherence/builtin.rs:610 — compiler/rustc_hir_analysis/src/coherence/builtin.rs:610-619 | compiler/rustc_hir_analysis/src/coherence/builtin.rs:630-639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_hir_typeck/src/method/prelude_edition_lints.rs:35 — compiler/rustc_hir_typeck/src/method/prelude_edition_lints.rs:35-44 | compiler/rustc_hir_typeck/src/method/prelude_edition_lints.rs:476-485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_hir_typeck/src/upvar.rs:2240 — compiler/rustc_hir_typeck/src/upvar.rs:2240-2249 | compiler/rustc_hir_typeck/src/upvar.rs:2258-2267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_lint/src/context.rs:864 — compiler/rustc_lint/src/context.rs:864-873 | compiler/rustc_lint/src/context.rs:914-923 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) compiler/rustc_middle/src/ty/sty.rs:1978 — compiler/rustc_middle/src/ty/sty.rs:1978-1987 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:134-143 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) compiler/rustc_middle/src/ty/util.rs:1538 — compiler/rustc_middle/src/ty/util.rs:1538-1547 | compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs:33-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) compiler/rustc_mir_dataflow/src/move_paths/builder.rs:148 — compiler/rustc_mir_dataflow/src/move_paths/builder.rs:148-157 | compiler/rustc_mir_dataflow/src/move_paths/builder.rs:190-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 25 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×47
  • Duplicated block (11 lines × 2) compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs:378 — compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs:378-388 | compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs:394-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_borrowck/src/diagnostics/region_name.rs:518 — compiler/rustc_borrowck/src/diagnostics/region_name.rs:518-528 | compiler/rustc_borrowck/src/diagnostics/region_name.rs:926-936 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_borrowck/src/lib.rs:684 — compiler/rustc_borrowck/src/lib.rs:684-694 | compiler/rustc_borrowck/src/lib.rs:706-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_borrowck/src/lib.rs:1877 — compiler/rustc_borrowck/src/lib.rs:1877-1887 | compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:426-436 — before extracting anything, compare `compiler/rustc_borrowck/src/lib.rs` and `compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) compiler/rustc_borrowck/src/type_check/mod.rs:2373 — compiler/rustc_borrowck/src/type_check/mod.rs:2373-2383 | compiler/rustc_borrowck/src/type_check/mod.rs:2520-2530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:827 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:827-837 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2455-2465 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1189 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1189-1199 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1211-1221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_hir_analysis/src/check/region.rs:354 — compiler/rustc_hir_analysis/src/check/region.rs:354-364 | compiler/rustc_hir_analysis/src/check/region.rs:369-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs:191 — compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs:191-201 | compiler/rustc_hir_typeck/src/method/probe.rs:929-939 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) compiler/rustc_hir_analysis/src/collect/type_of.rs:124 — compiler/rustc_hir_analysis/src/collect/type_of.rs:124-134 | compiler/rustc_hir_analysis/src/collect/type_of.rs:176-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_hir_analysis/src/variance/constraints.rs:192 — compiler/rustc_hir_analysis/src/variance/constraints.rs:192-202 | compiler/rustc_hir_analysis/src/variance/constraints.rs:388-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:264 — compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:264-274 | compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:279-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_infer/src/infer/relate/type_relating.rs:90 — compiler/rustc_infer/src/infer/relate/type_relating.rs:90-100 | compiler/rustc_type_ir/src/relate/solver_relating.rs:117-127 — before extracting anything, compare `compiler/rustc_infer/src/infer/relate/type_relating.rs` and `compiler/rustc_type_ir/src/relate/solver_relating.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) compiler/rustc_middle/src/mir/generic_graphviz.rs:61 — compiler/rustc_middle/src/mir/generic_graphviz.rs:61-71 | compiler/rustc_middle/src/mir/graphviz.rs:54-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) compiler/rustc_middle/src/mir/terminator.rs:630 — compiler/rustc_middle/src/mir/terminator.rs:630-640 | compiler/rustc_middle/src/mir/terminator.rs:651-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_mir_build/src/check_unsafety.rs:1003 — compiler/rustc_mir_build/src/check_unsafety.rs:1003-1013 | compiler/rustc_mir_build/src/check_unsafety.rs:1022-1032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_mir_dataflow/src/value_analysis.rs:463 — compiler/rustc_mir_dataflow/src/value_analysis.rs:463-473 | compiler/rustc_mir_dataflow/src/value_analysis.rs:476-486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_mir_transform/src/lower_intrinsics.rs:120 — compiler/rustc_mir_transform/src/lower_intrinsics.rs:120-130 | compiler/rustc_mir_transform/src/lower_intrinsics.rs:140-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_parse/src/parser/ty.rs:1564 — compiler/rustc_parse/src/parser/ty.rs:1564-1574 | compiler/rustc_parse/src/parser/ty.rs:1578-1588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_resolve/src/ident.rs:605 — compiler/rustc_resolve/src/ident.rs:605-615 | compiler/rustc_resolve/src/ident.rs:671-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_symbol_mangling/src/export.rs:115 — compiler/rustc_symbol_mangling/src/export.rs:115-125 | compiler/rustc_type_ir/src/inherent.rs:193-203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) compiler/rustc_symbol_mangling/src/v0.rs:94 — compiler/rustc_symbol_mangling/src/v0.rs:94-104 | compiler/rustc_symbol_mangling/src/v0.rs:148-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_trait_selection/src/traits/effects.rs:212 — compiler/rustc_trait_selection/src/traits/effects.rs:212-222 | compiler/rustc_trait_selection/src/traits/effects.rs:303-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) compiler/rustc_type_ir/src/binder.rs:267 — compiler/rustc_type_ir/src/binder.rs:267-277 | compiler/rustc_type_ir/src/binder.rs:287-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) library/alloc/src/collections/btree/node.rs:1627 — library/alloc/src/collections/btree/node.rs:1627-1637 | library/alloc/src/collections/btree/node.rs:1691-1701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 22 more in this group — see findings.md.
D2 · Cognitive Complexity · ide · ×46
  • ide::syntax_highlighting::traverse (cognitive 103) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs:226 — ide::syntax_highlighting::traverse has cognitive complexity 103 (threshold 15). Drivers by points: if/else 17 (50 pts), match/switch 16 (49 pts), boolean chains 3, loops 1 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::hover::render::definition (cognitive 92) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446 — ide::hover::render::definition has cognitive complexity 92 (threshold 15). Drivers by points: if/else 34 (64 pts), match/switch 16 (28 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::folding_ranges::folding_ranges (cognitive 76) src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs:61 — ide::folding_ranges::folding_ranges has cognitive complexity 76 (threshold 15). Drivers by points: if/else 18 (65 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ide::syntax_highlighting::highlight::highlight_def (cognitive 69) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:451 — ide::syntax_highlighting::highlight::highlight_def has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (42 pts), match/switch 9 (22 pts), boolean chains 5 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::rename::transform_method_call_into_assoc_fn (cognitive 62) src/tools/rust-analyzer/crates/ide/src/rename.rs:627 — ide::rename::transform_method_call_into_assoc_fn has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (41 pts), match/switch 4 (14 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::highlight_related::highlight_references (cognitive 60) src/tools/rust-analyzer/crates/ide/src/highlight_related.rs:152 — ide::highlight_related::highlight_references has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (40 pts), match/switch 5 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::inlay_hints::adjustment::hints (cognitive 56) src/tools/rust-analyzer/crates/ide/src/inlay_hints/adjustment.rs:23 — ide::inlay_hints::adjustment::hints has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 10, match/switch 3 (7 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::rename::transform_assoc_fn_into_method_call (cognitive 44) src/tools/rust-analyzer/crates/ide/src/rename.rs:411 — ide::rename::transform_assoc_fn_into_method_call has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 3 (11 pts), loops 3 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::inlay_hints::implicit_drop::hints (cognitive 40) src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs:24 — ide::inlay_hints::implicit_drop::hints has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 6 (24 pts), if/else 6 (15 pts), loops 1 (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide::inlay_hints::closing_brace::hints (cognitive 39) src/tools/rust-analyzer/crates/ide/src/inlay_hints/closing_brace.rs:21 — ide::inlay_hints::closing_brace::hints has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 4 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::inlay_hints::lifetime::hints_ (cognitive 38) src/tools/rust-analyzer/crates/ide/src/inlay_hints/lifetime.rs:194 — ide::inlay_hints::lifetime::hints_ has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::syntax_highlighting::highlight::highlight_name_ref (cognitive 38) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:258 — ide::syntax_highlighting::highlight::highlight_name_ref has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::annotations::annotations (cognitive 35) src/tools/rust-analyzer/crates/ide/src/annotations.rs:58 — ide::annotations::annotations has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 5, match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 11). Of this number, 29 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::signature_help::signature_help_for_call (cognitive 35) src/tools/rust-analyzer/crates/ide/src/signature_help.rs:159 — ide::signature_help::signature_help_for_call has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 8 (17 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::view_syntax_tree::syntax_node_to_json (cognitive 35) src/tools/rust-analyzer/crates/ide/src/view_syntax_tree.rs:31 — ide::view_syntax_tree::syntax_node_to_json has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 5 (15 pts), loops 2 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::hover::hover_offset (cognitive 33) src/tools/rust-analyzer/crates/ide/src/hover.rs:159 — ide::hover::hover_offset has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, match/switch 3 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::join_lines::remove_newline (cognitive 33) src/tools/rust-analyzer/crates/ide/src/join_lines.rs:82 — ide::join_lines::remove_newline has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::syntax_highlighting::highlight::punctuation (cognitive 32) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:93 — ide::syntax_highlighting::highlight::punctuation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide::moniker::def_to_non_local_moniker (cognitive 31) src/tools/rust-analyzer/crates/ide/src/moniker.rs:283 — ide::moniker::def_to_non_local_moniker has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 5 (10 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::inlay_hints::param_name::hints (cognitive 28) src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs:19 — ide::inlay_hints::param_name::hints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::hover::render::render_memory_layout (cognitive 27) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:1165 — ide::hover::render::render_memory_layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 5 (10 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ide::inlay_hints::bind_pat::hints (cognitive 27) src/tools/rust-analyzer/crates/ide/src/inlay_hints/bind_pat.rs:22 — ide::inlay_hints::bind_pat::hints has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::signature_help::signature_help (cognitive 27) src/tools/rust-analyzer/crates/ide/src/signature_help.rs:73 — ide::signature_help::signature_help has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::goto_definition::goto_definition (cognitive 26) src/tools/rust-analyzer/crates/ide/src/goto_definition.rs:58 — ide::goto_definition::goto_definition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide::highlight_related::highlight_branch_exit_points (cognitive 26) src/tools/rust-analyzer/crates/ide/src/highlight_related.rs:308 — ide::highlight_related::highlight_branch_exit_points has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 4 (9 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • + 21 more in this group — see findings.md.
D2 · Cognitive Complexity · rustc_codegen_ssa · ×42
  • rustc_codegen_ssa::debuginfo::type_names::push_debuginfo_type_name (cognitive 142) compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs:51 — rustc_codegen_ssa::debuginfo::type_names::push_debuginfo_type_name has cognitive complexity 142 (threshold 15). Drivers by points: if/else 64 (113 pts), match/switch 7 (13 pts), loops 4 (12 pts), boolean chains 4 (nesting depth added 63). Of this number, 138 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::link_natively (cognitive 111) compiler/rustc_codegen_ssa/src/back/link.rs:1232 — rustc_codegen_ssa::back::link::link_natively has cognitive complexity 111 (threshold 15). Drivers by points: if/else 37 (79 pts), loops 7 (13 pts), boolean chains 10, match/switch 6 (9 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_codegen_ssa::back::write::start_executing_work (cognitive 94) compiler/rustc_codegen_ssa/src/back/write.rs:1208 — rustc_codegen_ssa::back::write::start_executing_work has cognitive complexity 94 (threshold 15). Drivers by points: if/else 33 (64 pts), match/switch 7 (17 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 45). Of this number, 93 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::codegen_attrs::process_builtin_attrs (cognitive 63) compiler/rustc_codegen_ssa/src/codegen_attrs.rs:58 — rustc_codegen_ssa::codegen_attrs::process_builtin_attrs has cognitive complexity 63 (threshold 15). Drivers by points: if/else 20 (50 pts), match/switch 3 (8 pts), boolean chains 4, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::mir::naked_asm::prefix_and_suffix (cognitive 61) compiler/rustc_codegen_ssa/src/mir/naked_asm.rs:144 — rustc_codegen_ssa::mir::naked_asm::prefix_and_suffix has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 14 (27 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::symbol_export::exported_generic_symbols_provider_local (cognitive 57) compiler/rustc_codegen_ssa/src/back/symbol_export.rs:309 — rustc_codegen_ssa::back::symbol_export::exported_generic_symbols_provider_local has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (40 pts), match/switch 3 (9 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::write::produce_final_output_artifacts (cognitive 56) compiler/rustc_codegen_ssa/src/back/write.rs:504 — rustc_codegen_ssa::back::write::produce_final_output_artifacts has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 6, loops 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::link_binary (cognitive 54) compiler/rustc_codegen_ssa/src/back/link.rs:303 — rustc_codegen_ssa::back::link::link_binary has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 6, loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::add_native_libs_from_crate (cognitive 52) compiler/rustc_codegen_ssa/src/back/link.rs:3367 — rustc_codegen_ssa::back::link::add_native_libs_from_crate has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (45 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::target_features::from_target_feature_attr (cognitive 52) compiler/rustc_codegen_ssa/src/target_features.rs:22 — rustc_codegen_ssa::target_features::from_target_feature_attr has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_codegen_ssa::back::link::linker_with_args (cognitive 42) compiler/rustc_codegen_ssa/src/back/link.rs:2878 — rustc_codegen_ssa::back::link::linker_with_args has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (25 pts), loops 6 (12 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::link_rlib (cognitive 36) compiler/rustc_codegen_ssa/src/back/link.rs:545 — rustc_codegen_ssa::back::link::link_rlib has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 4 (5 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::target_features::parse_rust_feature_list (cognitive 36) compiler/rustc_codegen_ssa/src/target_features.rs:192 — rustc_codegen_ssa::target_features::parse_rust_feature_list has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (11 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::link_staticlib (cognitive 35) compiler/rustc_codegen_ssa/src/back/link.rs:754 — rustc_codegen_ssa::back::link::link_staticlib has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 11, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::report_linker_output (cognitive 34) compiler/rustc_codegen_ssa/src/back/link.rs:1061 — rustc_codegen_ssa::back::link::report_linker_output has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 5). Of this number, 28 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_ssa::back::linker::get_linker (cognitive 34) compiler/rustc_codegen_ssa/src/back/linker.rs:50 — rustc_codegen_ssa::back::linker::get_linker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 4 (8 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::mir::arg_local_refs (cognitive 33) compiler/rustc_codegen_ssa/src/mir/mod.rs:451 — rustc_codegen_ssa::mir::arg_local_refs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (22 pts), match/switch 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::raw_dylib::create_elf_raw_dylib_stub (cognitive 32) compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs:208 — rustc_codegen_ssa::back::link::raw_dylib::create_elf_raw_dylib_stub has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 5 (7 pts), match/switch 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::target_features::internal_target_features (cognitive 31) compiler/rustc_codegen_ssa/src/target_features.rs:284 — rustc_codegen_ssa::target_features::internal_target_features has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::exec_linker (cognitive 28) compiler/rustc_codegen_ssa/src/back/link.rs:2113 — rustc_codegen_ssa::back::link::exec_linker has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (8 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 11). Of this number, 22 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::write::do_thin_lto (cognitive 28) compiler/rustc_codegen_ssa/src/back/write.rs:985 — rustc_codegen_ssa::back::write::do_thin_lto has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (8 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::metadata::elf_e_flags (cognitive 27) compiler/rustc_codegen_ssa/src/back/metadata.rs:272 — rustc_codegen_ssa::back::metadata::elf_e_flags has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 6 (11 pts), boolean chains 2 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_ssa::back::symbol_edit::macho_edit_impl (cognitive 26) compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:354 — rustc_codegen_ssa::back::symbol_edit::macho_edit_impl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3, boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_ssa::back::link::add_order_independent_options (cognitive 25) compiler/rustc_codegen_ssa/src/back/link.rs:3210 — rustc_codegen_ssa::back::link::add_order_independent_options has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_ssa::back::symbol_export::upstream_monomorphizations_provider (cognitive 25) compiler/rustc_codegen_ssa/src/back/symbol_export.rs:505 — rustc_codegen_ssa::back::symbol_export::upstream_monomorphizations_provider has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 17 more in this group — see findings.md.
D2 · Cognitive Complexity · LateResolutionVisitor · ×41
  • LateResolutionVisitor::add_missing_lifetime_specifiers_label (cognitive 180) compiler/rustc_resolve/src/late/diagnostics.rs:4403 — LateResolutionVisitor::add_missing_lifetime_specifiers_label has cognitive complexity 180 (threshold 15). Drivers by points: if/else 45 (120 pts), match/switch 8 (35 pts), loops 6 (17 pts), boolean chains 8 (nesting depth added 113). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LateResolutionVisitor::smart_resolve_context_dependent_help (cognitive 103) compiler/rustc_resolve/src/late/diagnostics.rs:2431 — LateResolutionVisitor::smart_resolve_context_dependent_help has cognitive complexity 103 (threshold 15). Drivers by points: if/else 33 (72 pts), match/switch 8 (14 pts), boolean chains 13, loops 1 (4 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LateResolutionVisitor::try_lookup_name_relaxed (cognitive 82) compiler/rustc_resolve/src/late/diagnostics.rs:1016 — LateResolutionVisitor::try_lookup_name_relaxed has cognitive complexity 82 (threshold 15). Drivers by points: if/else 24 (56 pts), match/switch 6 (16 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LateResolutionVisitor::make_base_error (cognitive 66) compiler/rustc_resolve/src/late/diagnostics.rs:383 — LateResolutionVisitor::make_base_error has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (39 pts), match/switch 5 (17 pts), boolean chains 10 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::with_const_and_generic_param_rib (cognitive 59) compiler/rustc_resolve/src/late.rs:3240 — LateResolutionVisitor::with_const_and_generic_param_rib has cognitive complexity 59 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 6 (19 pts), loops 6 (13 pts), boolean chains 3 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::suggest_assoc_type_from_bounds (cognitive 56) compiler/rustc_resolve/src/late/diagnostics.rs:208 — LateResolutionVisitor::suggest_assoc_type_from_bounds has cognitive complexity 56 (threshold 15). Drivers by points: if/else 25 (37 pts), loops 7 (14 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::smart_resolve_path_fragment (cognitive 51) compiler/rustc_resolve/src/late.rs:4828 — LateResolutionVisitor::smart_resolve_path_fragment has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 6, match/switch 5 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::detect_missing_turbofish (cognitive 50) compiler/rustc_resolve/src/late/diagnostics.rs:1773 — LateResolutionVisitor::detect_missing_turbofish has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 3 (7 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::suggest_introducing_lifetime_filtered (cognitive 48) compiler/rustc_resolve/src/late/diagnostics.rs:4186 — LateResolutionVisitor::suggest_introducing_lifetime_filtered has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (35 pts), loops 2 (6 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::resolve_elided_lifetimes_in_path (cognitive 47) compiler/rustc_resolve/src/late.rs:2313 — LateResolutionVisitor::resolve_elided_lifetimes_in_path has cognitive complexity 47 (threshold 15). Drivers by points: loops 7 (22 pts), if/else 9 (16 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 26). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • LateResolutionVisitor::resolve_lifetime (cognitive 41) compiler/rustc_resolve/src/late.rs:1907 — LateResolutionVisitor::resolve_lifetime has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (28 pts), match/switch 3 (11 pts), boolean chains 1, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::resolve_anonymous_lifetime (cognitive 41) compiler/rustc_resolve/src/late.rs:2019 — LateResolutionVisitor::resolve_anonymous_lifetime has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LateResolutionVisitor::suggest_using_enum_variant (cognitive 40) compiler/rustc_resolve/src/late/diagnostics.rs:3470 — LateResolutionVisitor::suggest_using_enum_variant has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 6 (11 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::resolve_fn_params (cognitive 39) compiler/rustc_resolve/src/late.rs:2627 — LateResolutionVisitor::resolve_fn_params has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 3 (11 pts), boolean chains 2, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::detect_missing_binding_available_from_pattern (cognitive 37) compiler/rustc_resolve/src/late/diagnostics.rs:1715 — LateResolutionVisitor::detect_missing_binding_available_from_pattern has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 4 (13 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::maybe_report_lifetime_uses (cognitive 36) compiler/rustc_resolve/src/late/diagnostics.rs:3972 — LateResolutionVisitor::maybe_report_lifetime_uses has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (27 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::lookup_typo_candidate (cognitive 35) compiler/rustc_resolve/src/late/diagnostics.rs:3229 — LateResolutionVisitor::lookup_typo_candidate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (5 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::lookup_assoc_candidate (cognitive 32) compiler/rustc_resolve/src/late/diagnostics.rs:3115 — LateResolutionVisitor::lookup_assoc_candidate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 4 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). Of this number, 31 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::suggest_adding_generic_parameter (cognitive 31) compiler/rustc_resolve/src/late/diagnostics.rs:3840 — LateResolutionVisitor::suggest_adding_generic_parameter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::lookup_doc_alias_name (cognitive 28) compiler/rustc_resolve/src/late/diagnostics.rs:1285 — LateResolutionVisitor::lookup_doc_alias_name has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::detect_assoc_type_constraint_meant_as_path (cognitive 27) compiler/rustc_resolve/src/late/diagnostics.rs:929 — LateResolutionVisitor::detect_assoc_type_constraint_meant_as_path has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::resolve_expr (cognitive 26) compiler/rustc_resolve/src/late.rs:5461 — LateResolutionVisitor::resolve_expr has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 5 (10 pts), match/switch 3 (5 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LateResolutionVisitor::err_code_special_cases (cognitive 24) compiler/rustc_resolve/src/late/diagnostics.rs:1516 — LateResolutionVisitor::err_code_special_cases has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (7 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LateResolutionVisitor::future_proof_import (cognitive 24) compiler/rustc_resolve/src/late.rs:2920 — LateResolutionVisitor::future_proof_import has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LateResolutionVisitor::resolve_doc_links (cognitive 24) compiler/rustc_resolve/src/late.rs:5748 — LateResolutionVisitor::resolve_doc_links has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (10 pts), boolean chains 3, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 16 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×41
  • Duplicated block (12 lines × 2) compiler/rustc_ast/src/token.rs:1053 — compiler/rustc_ast/src/token.rs:1053-1064 | compiler/rustc_ast/src/token.rs:1067-1078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:801 — compiler/rustc_ast_pretty/src/pprust/state/expr.rs:801-812 | compiler/rustc_hir_pretty/src/lib.rs:1771-1782 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state/expr.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1292 — compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1292-1303 | compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1335-1346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_borrowck/src/lib.rs:477 — compiler/rustc_borrowck/src/lib.rs:477-488 | compiler/rustc_borrowck/src/lib.rs:516-527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_borrowck/src/lib.rs:948 — compiler/rustc_borrowck/src/lib.rs:948-959 | compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:166-177 — before extracting anything, compare `compiler/rustc_borrowck/src/lib.rs` and `compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:758 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:758-769 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:811-822 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1003 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1003-1014 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1047-1058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:629 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:629-640 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:670-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1079 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1079-1090 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1130-1141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_gcc/src/builder.rs:2324 — compiler/rustc_codegen_gcc/src/builder.rs:2324-2335 | compiler/rustc_codegen_gcc/src/builder.rs:2354-2365 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:218 — compiler/rustc_codegen_llvm/src/asm.rs:218-229 | compiler/rustc_codegen_llvm/src/asm.rs:442-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs:194 — compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs:194-205 | compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs:57-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2676 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2676-2687 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2763-2774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_codegen_llvm/src/va_arg.rs:1103 — compiler/rustc_codegen_llvm/src/va_arg.rs:1103-1116 | compiler/rustc_codegen_llvm/src/va_arg.rs:1225-1236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_expand/src/mbe/macro_rules.rs:728 — compiler/rustc_expand/src/mbe/macro_rules.rs:728-739 | compiler/rustc_expand/src/mbe/macro_rules.rs:766-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_lint/src/late.rs:102 — compiler/rustc_lint/src/late.rs:102-113 | compiler/rustc_lint/src/late.rs:200-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_mir_build/src/builder/scope.rs:816 — compiler/rustc_mir_build/src/builder/scope.rs:816-827 | compiler/rustc_mir_build/src/builder/scope.rs:1072-1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_mir_transform/src/gvn.rs:1791 — compiler/rustc_mir_transform/src/gvn.rs:1791-1802 | compiler/rustc_mir_transform/src/gvn.rs:1805-1816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:813 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:813-824 | compiler/rustc_trait_selection/src/traits/effects.rs:492-503 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs` and `compiler/rustc_trait_selection/src/traits/effects.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) compiler/rustc_passes/src/lang_items.rs:101 — compiler/rustc_passes/src/lang_items.rs:101-112 | compiler/rustc_passes/src/lang_items.rs:115-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_resolve/src/ident.rs:1172 — compiler/rustc_resolve/src/ident.rs:1172-1183 | compiler/rustc_resolve/src/ident.rs:1238-1249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_resolve/src/late/diagnostics.rs:4554 — compiler/rustc_resolve/src/late/diagnostics.rs:4554-4565 | compiler/rustc_resolve/src/late/diagnostics.rs:4687-4698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_trait_selection/src/traits/auto_trait.rs:586 — compiler/rustc_trait_selection/src/traits/auto_trait.rs:586-597 | compiler/rustc_trait_selection/src/traits/auto_trait.rs:605-616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) compiler/rustc_trait_selection/src/traits/project.rs:1816 — compiler/rustc_trait_selection/src/traits/project.rs:1816-1827 | compiler/rustc_trait_selection/src/traits/project.rs:1850-1861 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) library/compiler-builtins/libm/src/math/lgamma_r.rs:204 — library/compiler-builtins/libm/src/math/lgamma_r.rs:204-215 | library/compiler-builtins/libm/src/math/lgammaf_r.rs:139-150 — before extracting anything, compare `library/compiler-builtins/libm/src/math/lgamma_r.rs` and `library/compiler-builtins/libm/src/math/lgammaf_r.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 16 more in this group — see findings.md.
D1 · Cyclomatic Complexity · ide · ×40
  • ide::hover::render::definition (cyclomatic 64) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:446 — ide::hover::render::definition has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::syntax_highlighting::highlight::highlight_def (cyclomatic 61) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:451 — ide::syntax_highlighting::highlight::highlight_def has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::inlay_hints::adjustment::hints (cyclomatic 53) src/tools/rust-analyzer/crates/ide/src/inlay_hints/adjustment.rs:23 — ide::inlay_hints::adjustment::hints has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::syntax_highlighting::traverse (cyclomatic 47) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs:226 — ide::syntax_highlighting::traverse has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::syntax_highlighting::highlight::punctuation (cyclomatic 40) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:93 — ide::syntax_highlighting::highlight::punctuation has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::inlay_hints::lifetime::hints_ (cyclomatic 34) src/tools/rust-analyzer/crates/ide/src/inlay_hints/lifetime.rs:194 — ide::inlay_hints::lifetime::hints_ has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::folding_ranges::folding_ranges (cyclomatic 31) src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs:61 — ide::folding_ranges::folding_ranges has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::inlay_hints::closing_brace::hints (cyclomatic 31) src/tools/rust-analyzer/crates/ide/src/inlay_hints/closing_brace.rs:21 — ide::inlay_hints::closing_brace::hints has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::hover::hover_offset (cyclomatic 30) src/tools/rust-analyzer/crates/ide/src/hover.rs:159 — ide::hover::hover_offset has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::moniker::def_to_kind (cyclomatic 30) src/tools/rust-analyzer/crates/ide/src/moniker.rs:183 — ide::moniker::def_to_kind has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::syntax_highlighting::highlight::highlight_name_ref (cyclomatic 30) src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs:258 — ide::syntax_highlighting::highlight::highlight_name_ref has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::file_structure::structure_node (cyclomatic 26) src/tools/rust-analyzer/crates/ide/src/file_structure.rs:82 — ide::file_structure::structure_node has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::hover::render::render_memory_layout (cyclomatic 26) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:1165 — ide::hover::render::render_memory_layout has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::inlay_hints::hints (cyclomatic 26) src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs:207 — ide::inlay_hints::hints has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::goto_type_definition::goto_type_definition (cyclomatic 25) src/tools/rust-analyzer/crates/ide/src/goto_type_definition.rs:16 — ide::goto_type_definition::goto_type_definition has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::signature_help::signature_help_for_call (cyclomatic 25) src/tools/rust-analyzer/crates/ide/src/signature_help.rs:159 — ide::signature_help::signature_help_for_call has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::annotations::annotations (cyclomatic 24) src/tools/rust-analyzer/crates/ide/src/annotations.rs:58 — ide::annotations::annotations has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::doc_links::filename_and_frag_for_def (cyclomatic 24) src/tools/rust-analyzer/crates/ide/src/doc_links.rs:647 — ide::doc_links::filename_and_frag_for_def has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::rename::transform_method_call_into_assoc_fn (cyclomatic 24) src/tools/rust-analyzer/crates/ide/src/rename.rs:627 — ide::rename::transform_method_call_into_assoc_fn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::highlight_related::highlight_references (cyclomatic 23) src/tools/rust-analyzer/crates/ide/src/highlight_related.rs:152 — ide::highlight_related::highlight_references has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::goto_definition::goto_definition (cyclomatic 22) src/tools/rust-analyzer/crates/ide/src/goto_definition.rs:58 — ide::goto_definition::goto_definition has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::inlay_hints::bind_pat::hints (cyclomatic 22) src/tools/rust-analyzer/crates/ide/src/inlay_hints/bind_pat.rs:22 — ide::inlay_hints::bind_pat::hints has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::join_lines::remove_newline (cyclomatic 22) src/tools/rust-analyzer/crates/ide/src/join_lines.rs:82 — ide::join_lines::remove_newline has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide::hover::render::literal (cyclomatic 21) src/tools/rust-analyzer/crates/ide/src/hover/render.rs:849 — ide::hover::render::literal has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide::typing::on_eq_typed (cyclomatic 20) src/tools/rust-analyzer/crates/ide/src/typing.rs:219 — ide::typing::on_eq_typed has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (assign_expr, let_stmt, assign_to_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • + 15 more in this group — see findings.md.
D2 · Cognitive Complexity · libm · ×39
  • libm::math::pow::pow (cognitive 127) library/compiler-builtins/libm/src/math/pow.rs:94 — libm::math::pow::pow has cognitive complexity 127 (threshold 15). Drivers by points: if/else 63 (122 pts), boolean chains 5 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::rem_pio2_large::rem_pio2_large (cognitive 91) library/compiler-builtins/libm/src/math/rem_pio2_large.rs:227 — libm::math::rem_pio2_large::rem_pio2_large has cognitive complexity 91 (threshold 15). Drivers by points: loops 20 (44 pts), if/else 20 (41 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 48). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • libm::math::exp2m1f::cr_exp2m1f (cognitive 80) library/compiler-builtins/libm/src/math/exp2m1f.rs:18 — libm::math::exp2m1f::cr_exp2m1f has cognitive complexity 80 (threshold 15). Drivers by points: if/else 27 (79 pts), boolean chains 1 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • libm::math::powf::powf (cognitive 76) library/compiler-builtins/libm/src/math/powf.rs:50 — libm::math::powf::powf has cognitive complexity 76 (threshold 15). Drivers by points: if/else 46 (70 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::generic::fma::fma_round (cognitive 50) library/compiler-builtins/libm/src/math/generic/fma.rs:11 — libm::math::generic::fma::fma_round has cognitive complexity 50 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::jn::jn (cognitive 47) library/compiler-builtins/libm/src/math/jn.rs:43 — libm::math::jn::jn has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (27 pts), loops 6 (16 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::lgamma_r::lgamma_r (cognitive 41) library/compiler-builtins/libm/src/math/lgamma_r.rs:171 — libm::math::lgamma_r::lgamma_r has cognitive complexity 41 (threshold 15). Drivers by points: if/else 27 (37 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::lgammaf_r::lgammaf_r (cognitive 40) library/compiler-builtins/libm/src/math/lgammaf_r.rs:106 — libm::math::lgammaf_r::lgammaf_r has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27 (37 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::remquo::remquo (cognitive 39) library/compiler-builtins/libm/src/math/remquo.rs:2 — libm::math::remquo::remquo has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (25 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • libm::math::remquof::remquof (cognitive 39) library/compiler-builtins/libm/src/math/remquof.rs:2 — libm::math::remquof::remquof has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (25 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • libm::math::cbrt::cbrt_round (cognitive 38) library/compiler-builtins/libm/src/math/cbrt.rs:16 — libm::math::cbrt::cbrt_round has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • libm::math::jnf::jnf (cognitive 38) library/compiler-builtins/libm/src/math/jnf.rs:20 — libm::math::jnf::jnf has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (23 pts), loops 6 (14 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::rem_pio2::rem_pio2 (cognitive 38) library/compiler-builtins/libm/src/math/rem_pio2.rs:45 — libm::math::rem_pio2::rem_pio2 has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 2, boolean chains 1 (nesting depth added 14). Of this number, 35 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::expm1::expm1 (cognitive 34) library/compiler-builtins/libm/src/math/expm1.rs:32 — libm::math::expm1::expm1 has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (34 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::expm1f::expm1f (cognitive 34) library/compiler-builtins/libm/src/math/expm1f.rs:35 — libm::math::expm1f::expm1f has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (34 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::exp2m1::cr_exp2m1 (cognitive 33) library/compiler-builtins/libm/src/math/exp2m1.rs:22 — libm::math::exp2m1::cr_exp2m1 has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::tanf::tanf (cognitive 28) library/compiler-builtins/libm/src/math/tanf.rs:31 — libm::math::tanf::tanf has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (28 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::atan2::atan2 (cognitive 27) library/compiler-builtins/libm/src/math/atan2.rs:51 — libm::math::atan2::atan2 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • libm::math::atan2f::atan2f (cognitive 27) library/compiler-builtins/libm/src/math/atan2f.rs:27 — libm::math::atan2f::atan2f has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • libm::math::sincosf::sincosf (cognitive 27) library/compiler-builtins/libm/src/math/sincosf.rs:30 — libm::math::sincosf::sincosf has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::sinf::sinf (cognitive 25) library/compiler-builtins/libm/src/math/sinf.rs:31 — libm::math::sinf::sinf has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::atan::atan (cognitive 24) library/compiler-builtins/libm/src/math/atan.rs:67 — libm::math::atan::atan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (24 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::atanf::atanf (cognitive 24) library/compiler-builtins/libm/src/math/atanf.rs:45 — libm::math::atanf::atanf has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (24 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm::math::generic::scalbn::scalbn (cognitive 24) library/compiler-builtins/libm/src/math/generic/scalbn.rs:20 — libm::math::generic::scalbn::scalbn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (24 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • libm::math::support::hex_float::parse_hex (cognitive 24) library/compiler-builtins/libm/src/math/support/hex_float.rs:223 — libm::math::support::hex_float::parse_hex has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 3 (7 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 14 more in this group — see findings.md.
D1 · Cyclomatic Complexity · rustdoc · ×38
  • rustdoc::html::render::search_index::build_index (cyclomatic 84) REDACTED:1267 — rustdoc::html::render::search_index::build_index has cyclomatic complexity 84 (threshold 15). Of this number, 54 points are the body's own statements and 30 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::print_item::item_trait (cyclomatic 62) src/librustdoc/html/render/print_item.rs:646 — rustdoc::html::render::print_item::item_trait has cyclomatic complexity 62 (threshold 15). Of this number, 58 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::markdown::markdown_links (cyclomatic 49) src/librustdoc/html/markdown.rs:1793 — rustdoc::html::markdown::markdown_links has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::doctest::run_test (cyclomatic 46) src/librustdoc/doctest.rs:607 — rustdoc::doctest::run_test has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::clean::clean_middle_ty (cyclomatic 44) src/librustdoc/clean/mod.rs:2182 — rustdoc::clean::clean_middle_ty has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::doctest::make::parse_source (cyclomatic 43) src/librustdoc/doctest/make.rs:463 — rustdoc::doctest::make::parse_source has cyclomatic complexity 43 (threshold 15). Of this number, 30 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::print_item::item_module (cyclomatic 43) src/librustdoc/html/render/print_item.rs:254 — rustdoc::html::render::print_item::item_module has cyclomatic complexity 43 (threshold 15). Of this number, 25 points are the body's own statements and 18 belong to 3 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::passes::collect_intra_doc_links::resolution_failure (cyclomatic 42) src/librustdoc/passes/collect_intra_doc_links.rs:2093 — rustdoc::passes::collect_intra_doc_links::resolution_failure has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::print_item::print_item (cyclomatic 41) src/librustdoc/html/render/print_item.rs:77 — rustdoc::html::render::print_item::print_item has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::passes::lint::html_tags::visit_item (cyclomatic 38) src/librustdoc/passes/lint/html_tags.rs:19 — rustdoc::passes::lint::html_tags::visit_item has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::format::fmt_type (cyclomatic 35) src/librustdoc/html/format.rs:1116 — rustdoc::html::format::fmt_type has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::html::render::search_index::simplify_fn_type (cyclomatic 34) REDACTED:2118 — rustdoc::html::render::search_index::simplify_fn_type has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::render_impl::doc_impl_item (cyclomatic 33) src/librustdoc/html/render/mod.rs:1887 — rustdoc::html::render::render_impl::doc_impl_item has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rustdoc::html::render::render_impl) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustdoc::clean::inline::build_impl (cyclomatic 32) src/librustdoc/clean/inline.rs:472 — rustdoc::clean::inline::build_impl has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::clean::clean_middle_assoc_item (cyclomatic 29) src/librustdoc/clean/mod.rs:1393 — rustdoc::clean::clean_middle_assoc_item has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::passes::lint::unescaped_backticks::visit_item (cyclomatic 29) src/librustdoc/passes/lint/unescaped_backticks.rs:15 — rustdoc::passes::lint::unescaped_backticks::visit_item has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::main_args (cyclomatic 27) src/librustdoc/lib.rs:816 — rustdoc::main_args has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::print_item::compare_names (cyclomatic 27) src/librustdoc/html/render/print_item.rs:2222 — rustdoc::html::render::print_item::compare_names has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::html::render::render_impl (cyclomatic 26) src/librustdoc/html/render/mod.rs:1866 — rustdoc::html::render::render_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rustdoc::html::render::render_impl::doc_impl_item) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustdoc::clean::cfg::extract_cfg_from_attrs (cyclomatic 25) src/librustdoc/clean/cfg.rs:838 — rustdoc::clean::cfg::extract_cfg_from_attrs has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rustdoc::clean::cfg::human_readable_target_os (cyclomatic 53) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustdoc::clean::clean_generics (cyclomatic 24) src/librustdoc/clean/mod.rs:756 — rustdoc::clean::clean_generics has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::clean::first_non_private (cyclomatic 24) src/librustdoc/clean/mod.rs:1659 — rustdoc::clean::first_non_private has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::html::render::print_item::render_struct_fields (cyclomatic 23) src/librustdoc/html/render/print_item.rs:2541 — rustdoc::html::render::print_item::render_struct_fields has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustdoc::clean::clean_ty (cyclomatic 21) src/librustdoc/clean/mod.rs:1925 — rustdoc::clean::clean_ty has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustdoc::clean::auto_trait::clean_region_outlives_constraints (cyclomatic 20) src/librustdoc/clean/auto_trait.rs:224 — rustdoc::clean::auto_trait::clean_region_outlives_constraints has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 13 more in this group — see findings.md.
D2 · Cognitive Complexity · rustfmt_nightly · ×38
  • rustfmt_nightly::lists::write_list (cognitive 122) src/tools/rustfmt/src/lists.rs:264 — rustfmt_nightly::lists::write_list has cognitive complexity 122 (threshold 15). Drivers by points: if/else 41 (93 pts), boolean chains 19, loops 2 (6 pts), match/switch 2 (4 pts) (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustfmt_nightly::items::rewrite_fn_base (cognitive 97) src/tools/rustfmt/src/items.rs:2483 — rustfmt_nightly::items::rewrite_fn_base has cognitive complexity 97 (threshold 15). Drivers by points: if/else 41 (77 pts), boolean chains 13, match/switch 4 (7 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::macros::rewrite_macro_inner (cognitive 58) src/tools/rustfmt/src/macros.rs:193 — rustfmt_nightly::macros::rewrite_macro_inner has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (30 pts), match/switch 10 (20 pts), boolean chains 8 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::expr::format_expr (cognitive 46) src/tools/rustfmt/src/expr.rs:86 — rustfmt_nightly::expr::format_expr has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (37 pts), match/switch 5 (8 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::matches::rewrite_match_body (cognitive 41) src/tools/rustfmt/src/matches.rs:397 — rustfmt_nightly::matches::rewrite_match_body has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 9, match/switch 4 (5 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustfmt_nightly::items::format_trait (cognitive 37) src/tools/rustfmt/src/items.rs:1173 — rustfmt_nightly::items::format_trait has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::parse::macros::parse_macro_args (cognitive 37) src/tools/rustfmt/src/parse/macros/mod.rs:100 — rustfmt_nightly::parse::macros::parse_macro_args has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (25 pts), match/switch 2 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustfmt_nightly::types::join_bounds_inner (cognitive 37) src/tools/rustfmt/src/types.rs:1171 — rustfmt_nightly::types::join_bounds_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (23 pts), match/switch 7 (8 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustfmt_nightly::comment::identify_comment (cognitive 36) src/tools/rustfmt/src/comment.rs:255 — rustfmt_nightly::comment::identify_comment has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::string::break_string (cognitive 33) src/tools/rustfmt/src/string.rs:229 — rustfmt_nightly::string::break_string has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 3 (6 pts), loops 3, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::parse::macros::parse_macro_arg (cognitive 32) src/tools/rustfmt/src/parse/macros/mod.rs:24 — rustfmt_nightly::parse::macros::parse_macro_arg has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::items::format_impl (cognitive 29) src/tools/rustfmt/src/items.rs:807 — rustfmt_nightly::items::format_impl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5, match/switch 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::sort::version_sort (cognitive 28) src/tools/rustfmt/src/sort.rs:136 — rustfmt_nightly::sort::version_sort has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustfmt_nightly::string::rewrite_string (cognitive 28) src/tools/rustfmt/src/string.rs:64 — rustfmt_nightly::string::rewrite_string has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::bin::main::format (cognitive 27) src/tools/rustfmt/src/bin/main.rs:341 — rustfmt_nightly::bin::main::format has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::comment::combine_strs_with_missing_comments (cognitive 27) src/tools/rustfmt/src/comment.rs:154 — rustfmt_nightly::comment::combine_strs_with_missing_comments has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustfmt_nightly::parse::macros::cfg_if::parse_cfg_if_inner (cognitive 24) src/tools/rustfmt/src/parse/macros/cfg_if.rs:23 — rustfmt_nightly::parse::macros::cfg_if::parse_cfg_if_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::rustfmt_diff::make_diff (cognitive 24) src/tools/rustfmt/src/rustfmt_diff.rs:180 — rustfmt_nightly::rustfmt_diff::make_diff has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::items::format_struct_struct (cognitive 23) src/tools/rustfmt/src/items.rs:1447 — rustfmt_nightly::items::format_struct_struct has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustfmt_nightly::matches::rewrite_match (cognitive 23) src/tools/rustfmt/src/matches.rs:73 — rustfmt_nightly::matches::rewrite_match has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustfmt_nightly::items::rewrite_ty (cognitive 22) src/tools/rustfmt/src/items.rs:1767 — rustfmt_nightly::items::rewrite_ty has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (20 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::patterns::rewrite_struct_pat (cognitive 22) src/tools/rustfmt/src/patterns.rs:344 — rustfmt_nightly::patterns::rewrite_struct_pat has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::format_code_block (cognitive 21) src/tools/rustfmt/src/lib.rs:346 — rustfmt_nightly::format_code_block has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (nesting depth added 8). Of this number, 18 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::imports::merge_use_trees_inner (cognitive 21) src/tools/rustfmt/src/imports.rs:847 — rustfmt_nightly::imports::merge_use_trees_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustfmt_nightly::items::format_impl_ref_and_type (cognitive 21) src/tools/rustfmt/src/items.rs:958 — rustfmt_nightly::items::format_impl_ref_and_type has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 3 (5 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 13 more in this group — see findings.md.
D17 · Explicit Debt · XxxComment · ×35
  • XxxComment src/tools/rust-analyzer/crates/test-fixture/src/lib.rs:1056 — // XXX Currently replaces any literals with an empty string, but supporting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs:142 — // XXX: Why input included WHITESPACE? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs:298 — /// XXX: remove the tempdir last — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:3631 — // XXX: check alias first, to work around the VS Code where it pre-fills the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:3659 — // XXX: check alias first, to work around the VS Code where it pre-fills the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:211 — // XXX: drop order is significant — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:770 — // XXX: we iterate subtrees in reverse to guarantee — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:878 — // XXX: we iterate subtrees in reverse to guarantee — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs:414 — // XXX: maybe should check if ctx is async — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs:195 — // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
  • XxxComment src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs:107 — // XXX: For parity with Rust bug #22519, this does not complete Ty::AssocType.
  • XxxComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs:59 — // XXX: We don't currently provide this assist for struct definitions inside macros, but if we — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:202 — // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs:245 — // XXX: SyntaxEditor cannot insert after deleted element — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs:357 — // XXX: Perhaps we can extract a let statement to improve — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs:490 — // XXX: Use descend pat for sema analysis — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs:55 — // XXX: The recursion limit for `Autoderef` is currently 20, so `Vec::contains()` shouldn't — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:256 — // XXX: only look at source_map if we do have missing fields — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:342 — // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:432 — // XXX: Only look at sources if we do have incorrect names. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:522 — // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:593 — // XXX: only look at sources if we do have incorrect names — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs:114 — // XXX(iDawer): Collecting pattern adjustments feels imprecise to me. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs:186 — // XXX(iDawer): field lookup is inefficient — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs:80 — /// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 10 more in this group — see findings.md.
D2 · Cognitive Complexity · MirBorrowckCtxt · ×34
  • MirBorrowckCtxt::report_mutability_error (cognitive 151) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:62 — MirBorrowckCtxt::report_mutability_error has cognitive complexity 151 (threshold 15). Drivers by points: if/else 47 (110 pts), match/switch 10 (27 pts), loops 2 (10 pts), boolean chains 4 (nesting depth added 88). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::explain_captures (cognitive 145) compiler/rustc_borrowck/src/diagnostics/mod.rs:1225 — MirBorrowckCtxt::explain_captures has cognitive complexity 145 (threshold 15). Drivers by points: if/else 33 (96 pts), match/switch 7 (26 pts), boolean chains 12, loops 2 (11 pts) (nesting depth added 91). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::was_captured_by_trait_object (cognitive 80) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:821 — MirBorrowckCtxt::was_captured_by_trait_object has cognitive complexity 80 (threshold 15). Drivers by points: if/else 16 (56 pts), match/switch 4 (22 pts), boolean chains 1, loops 1 (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::suggest_make_local_mut (cognitive 67) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1400 — MirBorrowckCtxt::suggest_make_local_mut has cognitive complexity 67 (threshold 15). Drivers by points: if/else 31 (48 pts), boolean chains 10, match/switch 5 (6 pts), loops 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::add_move_hints (cognitive 50) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:734 — MirBorrowckCtxt::add_move_hints has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (33 pts), match/switch 5 (13 pts), boolean chains 4 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::later_use_kind (cognitive 49) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:719 — MirBorrowckCtxt::later_use_kind has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (40 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::describe_place_with_options (cognitive 47) compiler/rustc_borrowck/src/diagnostics/mod.rs:324 — MirBorrowckCtxt::describe_place_with_options has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 2 (7 pts), loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::suggest_map_index_mut_alternatives (cognitive 44) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:667 — MirBorrowckCtxt::suggest_map_index_mut_alternatives has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (31 pts), match/switch 2 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 21). Of this number, 37 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::add_move_error_suggestions (cognitive 37) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:1063 — MirBorrowckCtxt::add_move_error_suggestions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 2, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::note_due_to_edition_2024_opaque_capture_rules (cognitive 37) compiler/rustc_borrowck/src/diagnostics/opaque_types.rs:92 — MirBorrowckCtxt::note_due_to_edition_2024_opaque_capture_rules has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 3 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::explain_impl_static_obligation (cognitive 36) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:424 — MirBorrowckCtxt::explain_impl_static_obligation has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::is_mutable (cognitive 33) compiler/rustc_borrowck/src/lib.rs:2571 — MirBorrowckCtxt::is_mutable has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 9 (28 pts), if/else 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::add_static_impl_trait_suggestion (cognitive 32) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:1006 — MirBorrowckCtxt::add_static_impl_trait_suggestion has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb (cognitive 31) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:196 — MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::propagate_closure_used_mut_upvar (cognitive 28) compiler/rustc_borrowck/src/lib.rs:1653 — MirBorrowckCtxt::propagate_closure_used_mut_upvar has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 4 (9 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::point_at_binding_outside_closure (cognitive 27) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1171 — MirBorrowckCtxt::point_at_binding_outside_closure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (25 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::append_binding_error (cognitive 26) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:173 — MirBorrowckCtxt::append_binding_error has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::add_moved_or_invoked_closure_note (cognitive 24) compiler/rustc_borrowck/src/diagnostics/mod.rs:222 — MirBorrowckCtxt::add_moved_or_invoked_closure_note has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • MirBorrowckCtxt::consume_rvalue (cognitive 24) compiler/rustc_borrowck/src/lib.rs:1475 — MirBorrowckCtxt::consume_rvalue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 5 (9 pts), loops 2 (5 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::visit_after_early_terminator_effect (cognitive 23) compiler/rustc_borrowck/src/lib.rs:882 — MirBorrowckCtxt::visit_after_early_terminator_effect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::check_movable_place (cognitive 23) compiler/rustc_borrowck/src/lib.rs:1899 — MirBorrowckCtxt::check_movable_place has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 2 (8 pts), loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirBorrowckCtxt::show_mutating_upvar (cognitive 22) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1002 — MirBorrowckCtxt::show_mutating_upvar has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (5 pts), loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::expected_fn_found_fn_mut_call (cognitive 21) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1215 — MirBorrowckCtxt::expected_fn_found_fn_mut_call has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::explain_why_borrow_contains_point (cognitive 19) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:588 — MirBorrowckCtxt::explain_why_borrow_contains_point has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirBorrowckCtxt::add_borrow_suggestions (cognitive 19) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:898 — MirBorrowckCtxt::add_borrow_suggestions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • + 9 more in this group — see findings.md.
D2 · Cognitive Complexity · Resolver · ×34
  • Resolver::resolve_path_with_ribs (cognitive 142) compiler/rustc_resolve/src/ident.rs:1878 — Resolver::resolve_path_with_ribs has cognitive complexity 142 (threshold 15). Drivers by points: if/else 42 (104 pts), boolean chains 18, match/switch 5 (15 pts), loops 2 (5 pts) (nesting depth added 75). Of this number, 140 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Resolver::validate_res_from_ribs (cognitive 130) compiler/rustc_resolve/src/ident.rs:1476 — Resolver::validate_res_from_ribs has cognitive complexity 130 (threshold 15). Drivers by points: if/else 28 (90 pts), match/switch 8 (28 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::into_struct_error (cognitive 112) compiler/rustc_resolve/src/diagnostics/impls.rs:799 — Resolver::into_struct_error has cognitive complexity 112 (threshold 15). Drivers by points: if/else 20 (55 pts), match/switch 13 (30 pts), loops 6 (18 pts), boolean chains 9 (nesting depth added 64). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Resolver::report_privacy_error (cognitive 102) compiler/rustc_resolve/src/diagnostics/impls.rs:2683 — Resolver::report_privacy_error has cognitive complexity 102 (threshold 15). Drivers by points: if/else 34 (72 pts), loops 5 (12 pts), match/switch 4 (10 pts), boolean chains 8 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Resolver::lookup_import_candidates_from_module (cognitive 79) compiler/rustc_resolve/src/diagnostics/impls.rs:1669 — Resolver::lookup_import_candidates_from_module has cognitive complexity 79 (threshold 15). Drivers by points: if/else 23 (54 pts), boolean chains 20, match/switch 2 (4 pts), loops 1 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Resolver::report_path_resolution_error (cognitive 78) compiler/rustc_resolve/src/diagnostics/impls.rs:3086 — Resolver::report_path_resolution_error has cognitive complexity 78 (threshold 15). Drivers by points: if/else 43 (63 pts), match/switch 5 (10 pts), boolean chains 5 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::resolve_ident_in_scope (cognitive 64) compiler/rustc_resolve/src/ident.rs:545 — Resolver::resolve_ident_in_scope has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 11 (22 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 30). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Resolver::resolve_path_in_value_ns_with_prefix_info (cognitive 61) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:353 — Resolver::resolve_path_in_value_ns_with_prefix_info has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 5 (11 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::check_unused (cognitive 55) compiler/rustc_resolve/src/check_unused.rs:425 — Resolver::check_unused has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 11, loops 7 (8 pts), match/switch 3 (7 pts) (nesting depth added 21). Of this number, 51 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::visit_scopes (cognitive 48) compiler/rustc_resolve/src/ident.rs:54 — Resolver::visit_scopes has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 11 (24 pts), if/else 6 (14 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 23). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Resolver::throw_unresolved_import_error (cognitive 46) compiler/rustc_resolve/src/diagnostics/impls.rs:145 — Resolver::throw_unresolved_import_error has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (31 pts), loops 4 (6 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::unresolved_macro_suggestions (cognitive 43) compiler/rustc_resolve/src/diagnostics/impls.rs:2019 — Resolver::unresolved_macro_suggestions has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, match/switch 3 (6 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::smart_resolve_macro_path (cognitive 41) compiler/rustc_resolve/src/macros.rs:619 — Resolver::smart_resolve_macro_path has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (30 pts), match/switch 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::maybe_push_ambiguity (cognitive 38) compiler/rustc_resolve/src/ident.rs:829 — Resolver::maybe_push_ambiguity has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 15, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Resolver::resolve_ident_in_module (cognitive 37) compiler/rustc_resolve/src/ident.rs:995 — Resolver::resolve_ident_in_module has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Resolver::finalize_macro_resolutions (cognitive 36) compiler/rustc_resolve/src/macros.rs:891 — Resolver::finalize_macro_resolutions has cognitive complexity 36 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 6 (14 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::try_resolve_visibility (cognitive 34) compiler/rustc_resolve/src/build_reduced_graph.rs:229 — Resolver::try_resolve_visibility has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 4 (9 pts) (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Resolver::resolve_path_in_type_ns_with_prefix_info (cognitive 34) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:183 — Resolver::resolve_path_in_type_ns_with_prefix_info has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 4 (9 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::check_for_module_export_macro (cognitive 32) compiler/rustc_resolve/src/diagnostics/impls.rs:3665 — Resolver::check_for_module_export_macro has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::find_cfg_stripped (cognitive 30) compiler/rustc_resolve/src/diagnostics/impls.rs:3806 — Resolver::find_cfg_stripped has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 13 of the 30 points are its own statements and the rest belongs to one function item inside it that branches (comes_from_same_module_for_glob). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • Resolver::report_conflict (cognitive 27) compiler/rustc_resolve/src/diagnostics/impls.rs:430 — Resolver::report_conflict has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 9 (11 pts), boolean chains 10, if/else 5 (6 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::detect_derive_attribute (cognitive 25) compiler/rustc_resolve/src/diagnostics/impls.rs:2231 — Resolver::detect_derive_attribute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::resolve_ident_in_module_globs_unadjusted (cognitive 25) compiler/rustc_resolve/src/ident.rs:1220 — Resolver::resolve_ident_in_module_globs_unadjusted has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::rename_will_conflict_with_renamed (cognitive 24) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:846 — Resolver::rename_will_conflict_with_renamed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Resolver::ambiguity_diagnostic (cognitive 23) compiler/rustc_resolve/src/diagnostics/impls.rs:2453 — Resolver::ambiguity_diagnostic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 9 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×34
  • Off the main sequence: build_helper — build_helper: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
  • Off the main sequence: declare_clippy_lint — declare_clippy_lint: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: edition — edition: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: paths — paths: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
  • Off the main sequence: profile — profile: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
  • Off the main sequence: rustc_arena — rustc_arena: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: rustc_baked_icu_data — rustc_baked_icu_data: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: rustc_fs_util — rustc_fs_util: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
  • Off the main sequence: rustc_hashes — rustc_hashes: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 15 project(s), so it's rigid to change.
  • Off the main sequence: rustc_lexer — rustc_lexer: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: rustc_llvm — rustc_llvm: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: rustc_tools_util — rustc_tools_util: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: rustc_windows_rc — rustc_windows_rc: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: rustdoc-json-types — rustdoc-json-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: shim_utils — shim_utils: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: util — util: abstractness 1.00, instability 1.00, distance 1.00 — an application entry point, so it is concrete by design — the distance is expected; what is worth checking is that other projects depend on it at all, since a host should be a leaf of the graph.
  • Off the main sequence: rustc_thread_pool — rustc_thread_pool: abstractness 0.09, instability 0.00, distance 0.91 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
  • Off the main sequence: rustc_feature — rustc_feature: abstractness 0.00, instability 0.17, distance 0.83 — zone of pain — concrete and depended on by 15 project(s), so it's rigid to change.
  • Off the main sequence: rustc_structures — rustc_structures: abstractness 0.00, instability 0.19, distance 0.81 — zone of pain — concrete and depended on by 22 project(s), so it's rigid to change.
  • Off the main sequence: rustc_span — rustc_span: abstractness 0.09, instability 0.10, distance 0.81 — zone of pain — concrete and depended on by 55 project(s), so it's rigid to change.
  • Off the main sequence: stdx — stdx: abstractness 0.19, instability 0.00, distance 0.81 — zone of pain — concrete and depended on by 24 project(s), so it's rigid to change.
  • Off the main sequence: rustc_log — rustc_log: abstractness 0.20, instability 0.00, distance 0.80 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: span — span: abstractness 0.05, instability 0.16, distance 0.79 — zone of pain — concrete and depended on by 16 project(s), so it's rigid to change.
  • Off the main sequence: rustc_index — rustc_index: abstractness 0.13, instability 0.09, distance 0.78 — zone of pain — concrete and depended on by 32 project(s), so it's rigid to change.
  • Off the main sequence: rustc_ast — rustc_ast: abstractness 0.07, instability 0.16, distance 0.77 — zone of pain — concrete and depended on by 31 project(s), so it's rigid to change.
  • + 9 more in this group — see findings.md.
D1 · Cyclomatic Complexity · rustc_hir_analysis · ×33
  • rustc_hir_analysis::check::check::check_item_type (cyclomatic 62) compiler/rustc_hir_analysis/src/check/check.rs:762 — rustc_hir_analysis::check::check::check_item_type has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::collect::type_of::type_of (cyclomatic 48) compiler/rustc_hir_analysis/src/collect/type_of.rs:21 — rustc_hir_analysis::collect::type_of::type_of has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_hir_analysis::collect::generics_of::generics_of (cyclomatic 40) compiler/rustc_hir_analysis/src/collect/generics_of.rs:17 — rustc_hir_analysis::collect::generics_of::generics_of has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_hir_analysis::check::check::check_transparent (cyclomatic 28) compiler/rustc_hir_analysis/src/check/check.rs:1779 — rustc_hir_analysis::check::check::check_transparent has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::check::check_impl_items_against_trait (cyclomatic 27) compiler/rustc_hir_analysis/src/check/check.rs:1297 — rustc_hir_analysis::check::check::check_impl_items_against_trait has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::hir_ty_lowering::errors::generics_args_err_extend (cyclomatic 26) compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs:1814 — rustc_hir_analysis::hir_ty_lowering::errors::generics_args_err_extend has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait (cyclomatic 24) compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs:21 — rustc_hir_analysis::check::compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::delegation::create_mapping (cyclomatic 24) compiler/rustc_hir_analysis/src/delegation.rs:179 — rustc_hir_analysis::delegation::create_mapping has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::coherence::orphan::orphan_check_impl (cyclomatic 23) compiler/rustc_hir_analysis/src/coherence/orphan.rs:22 — rustc_hir_analysis::coherence::orphan::orphan_check_impl has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_hir_analysis::collect::clauses_of::const_conditions (cyclomatic 23) compiler/rustc_hir_analysis/src/collect/clauses_of.rs:1053 — rustc_hir_analysis::collect::clauses_of::const_conditions has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_hir_analysis::diagnostics::remove_or_use_generic::suggest_to_remove_or_use_generic (cyclomatic 23) compiler/rustc_hir_analysis/src/diagnostics/remove_or_use_generic.rs:60 — rustc_hir_analysis::diagnostics::remove_or_use_generic::suggest_to_remove_or_use_generic has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_hir_analysis::check::bounds_from_generic_clauses (cyclomatic 22) compiler/rustc_hir_analysis/src/check/mod.rs:392 — rustc_hir_analysis::check::bounds_from_generic_clauses has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::check::check_opaque_precise_captures (cyclomatic 22) compiler/rustc_hir_analysis/src/check/check.rs:573 — rustc_hir_analysis::check::check::check_opaque_precise_captures has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::check::opaque_type_cycle_error (cyclomatic 21) compiler/rustc_hir_analysis/src/check/check.rs:2186 — rustc_hir_analysis::check::check::opaque_type_cycle_error has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::entry::check_main_fn_ty (cyclomatic 21) compiler/rustc_hir_analysis/src/check/entry.rs:26 — rustc_hir_analysis::check::entry::check_main_fn_ty has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_hir_analysis::hir_ty_lowering::errors::prohibit_assoc_item_constraint (cyclomatic 21) compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs:1568 — rustc_hir_analysis::hir_ty_lowering::errors::prohibit_assoc_item_constraint has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::hir_ty_lowering::generics::generic_arg_mismatch_err (cyclomatic 21) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:29 — rustc_hir_analysis::hir_ty_lowering::generics::generic_arg_mismatch_err has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count (cyclomatic 21) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:419 — rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::check::region::resolve_local::record_rvalue_scope_if_borrow_expr (cyclomatic 20) compiler/rustc_hir_analysis/src/check/region.rs:616 — rustc_hir_analysis::check::region::resolve_local::record_rvalue_scope_if_borrow_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_hir_analysis::check::wfcheck::check_gat_where_clauses (cyclomatic 20) compiler/rustc_hir_analysis/src/check/wfcheck.rs:380 — rustc_hir_analysis::check::wfcheck::check_gat_where_clauses has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::coherence::orphan::emit_orphan_check_error (cyclomatic 20) compiler/rustc_hir_analysis/src/coherence/orphan.rs:381 — rustc_hir_analysis::coherence::orphan::emit_orphan_check_error has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::collect::clauses_of::gather_explicit_clauses_of (cyclomatic 20) compiler/rustc_hir_analysis/src/collect/clauses_of.rs:82 — rustc_hir_analysis::collect::clauses_of::gather_explicit_clauses_of has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args (cyclomatic 20) compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs:190 — rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::coherence::builtin::visit_implementation_of_dispatch_from_dyn (cyclomatic 19) compiler/rustc_hir_analysis/src/coherence/builtin.rs:287 — rustc_hir_analysis::coherence::builtin::visit_implementation_of_dispatch_from_dyn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_hir_analysis::collect::item_bounds::remap_gat_vars_and_recurse_into_nested_projections (cyclomatic 19) compiler/rustc_hir_analysis/src/collect/item_bounds.rs:129 — rustc_hir_analysis::collect::item_bounds::remap_gat_vars_and_recurse_into_nested_projections has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 8 more in this group — see findings.md.
D1 · Cyclomatic Complexity · Parser · ×32
  • Parser::expected_one_of_not_found (cyclomatic 59) compiler/rustc_parse/src/parser/diagnostics.rs:348 — Parser::expected_one_of_not_found has cyclomatic complexity 59 (threshold 15). Of this number, 55 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_expr_bottom (cyclomatic 48) compiler/rustc_parse/src/parser/expr.rs:1246 — Parser::parse_expr_bottom has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_ty_common (cyclomatic 40) compiler/rustc_parse/src/parser/ty.rs:273 — Parser::parse_ty_common has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_item_kind (cyclomatic 39) compiler/rustc_parse/src/parser/item.rs:254 — Parser::parse_item_kind has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_pat_with_range_pat (cyclomatic 39) compiler/rustc_parse/src/parser/pat.rs:721 — Parser::parse_pat_with_range_pat has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_fn_front_matter (cyclomatic 35) compiler/rustc_parse/src/parser/function.rs:413 — Parser::parse_fn_front_matter has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::nonterminal_may_begin_with (cyclomatic 29) compiler/rustc_parse/src/parser/nonterminal.rs:22 — Parser::nonterminal_may_begin_with has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Parser::parse_struct_fields (cyclomatic 28) compiler/rustc_parse/src/parser/expr.rs:3634 — Parser::parse_struct_fields has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_path_segment (cyclomatic 27) compiler/rustc_parse/src/parser/path.rs:291 — Parser::parse_path_segment has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_pat_fields (cyclomatic 26) compiler/rustc_parse/src/parser/pat.rs:1669 — Parser::parse_pat_fields has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_item_impl (cyclomatic 24) compiler/rustc_parse/src/parser/item.rs:696 — Parser::parse_item_impl has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::collect_tokens (cyclomatic 23) compiler/rustc_parse/src/parser/attr_wrapper.rs:156 — Parser::collect_tokens has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parse_arm (cyclomatic 23) compiler/rustc_parse/src/parser/expr.rs:3129 — Parser::parse_arm has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_param_general (cyclomatic 22) compiler/rustc_parse/src/parser/function.rs:737 — Parser::parse_param_general has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::format (cyclomatic 22) compiler/rustc_parse_format/src/lib.rs:618 — Parser::format has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::parameter_without_type (cyclomatic 21) compiler/rustc_parse/src/parser/diagnostics.rs:2004 — Parser::parameter_without_type has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::recover_missing_kw_before_item (cyclomatic 20) compiler/rustc_parse/src/parser/item.rs:506 — Parser::recover_missing_kw_before_item has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Parser::maybe_augment_stashed_expr_in_pats_with_suggestions (cyclomatic 20) compiler/rustc_parse/src/parser/pat.rs:511 — Parser::maybe_augment_stashed_expr_in_pats_with_suggestions has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::check_no_chained_comparison (cyclomatic 19) compiler/rustc_parse/src/parser/diagnostics.rs:1340 — Parser::check_no_chained_comparison has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_self_param (cyclomatic 19) compiler/rustc_parse/src/parser/function.rs:880 — Parser::parse_self_param has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Parser::parse_nonterminal (cyclomatic 19) compiler/rustc_parse/src/parser/nonterminal.rs:121 — Parser::parse_nonterminal has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Parser::recover_stmt_ (cyclomatic 18) compiler/rustc_parse/src/parser/diagnostics.rs:1925 — Parser::recover_stmt_ has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_pat_no_top_guard_inner (cyclomatic 18) compiler/rustc_parse/src/parser/pat.rs:165 — Parser::parse_pat_no_top_guard_inner has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Parser::parse_assoc_op_cast (cyclomatic 17) compiler/rustc_parse/src/parser/expr.rs:495 — Parser::parse_assoc_op_cast has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Parser::parse_trait_bound (cyclomatic 17) compiler/rustc_parse/src/parser/ty.rs:1328 — Parser::parse_trait_bound has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • + 7 more in this group — see findings.md.
D1 · Cyclomatic Complexity · rustc_codegen_ssa · ×31
  • rustc_codegen_ssa::debuginfo::type_names::push_debuginfo_type_name (cyclomatic 74) compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs:51 — rustc_codegen_ssa::debuginfo::type_names::push_debuginfo_type_name has cyclomatic complexity 74 (threshold 15). Of this number, 72 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::link_natively (cyclomatic 62) compiler/rustc_codegen_ssa/src/back/link.rs:1232 — rustc_codegen_ssa::back::link::link_natively has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::codegen_attrs::process_builtin_attrs (cyclomatic 56) compiler/rustc_codegen_ssa/src/codegen_attrs.rs:58 — rustc_codegen_ssa::codegen_attrs::process_builtin_attrs has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::raw_dylib::create_elf_raw_dylib_stub (cyclomatic 51) compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs:208 — rustc_codegen_ssa::back::link::raw_dylib::create_elf_raw_dylib_stub has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_ssa::back::write::start_executing_work (cyclomatic 48) compiler/rustc_codegen_ssa/src/back/write.rs:1208 — rustc_codegen_ssa::back::write::start_executing_work has cyclomatic complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::mir::naked_asm::prefix_and_suffix (cyclomatic 44) compiler/rustc_codegen_ssa/src/mir/naked_asm.rs:144 — rustc_codegen_ssa::mir::naked_asm::prefix_and_suffix has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_ssa::back::metadata::elf_e_flags (cyclomatic 40) compiler/rustc_codegen_ssa/src/back/metadata.rs:272 — rustc_codegen_ssa::back::metadata::elf_e_flags has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_ssa::back::write::produce_final_output_artifacts (cyclomatic 34) compiler/rustc_codegen_ssa/src/back/write.rs:504 — rustc_codegen_ssa::back::write::produce_final_output_artifacts has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::link_binary (cyclomatic 32) compiler/rustc_codegen_ssa/src/back/link.rs:303 — rustc_codegen_ssa::back::link::link_binary has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::symbol_export::exported_generic_symbols_provider_local (cyclomatic 31) compiler/rustc_codegen_ssa/src/back/symbol_export.rs:309 — rustc_codegen_ssa::back::symbol_export::exported_generic_symbols_provider_local has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::link_staticlib (cyclomatic 27) compiler/rustc_codegen_ssa/src/back/link.rs:754 — rustc_codegen_ssa::back::link::link_staticlib has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::add_native_libs_from_crate (cyclomatic 27) compiler/rustc_codegen_ssa/src/back/link.rs:3367 — rustc_codegen_ssa::back::link::add_native_libs_from_crate has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::linker::get_linker (cyclomatic 27) compiler/rustc_codegen_ssa/src/back/linker.rs:50 — rustc_codegen_ssa::back::linker::get_linker has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_codegen_ssa::back::link::report_linker_output (cyclomatic 26) compiler/rustc_codegen_ssa/src/back/link.rs:1061 — rustc_codegen_ssa::back::link::report_linker_output has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_ssa::mir::arg_local_refs (cyclomatic 26) compiler/rustc_codegen_ssa/src/mir/mod.rs:451 — rustc_codegen_ssa::mir::arg_local_refs has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::linker_with_args (cyclomatic 24) compiler/rustc_codegen_ssa/src/back/link.rs:2878 — rustc_codegen_ssa::back::link::linker_with_args has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::link_rlib (cyclomatic 22) compiler/rustc_codegen_ssa/src/back/link.rs:545 — rustc_codegen_ssa::back::link::link_rlib has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::add_order_independent_options (cyclomatic 22) compiler/rustc_codegen_ssa/src/back/link.rs:3210 — rustc_codegen_ssa::back::link::add_order_independent_options has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_ssa::back::link::get_apple_sdk_root (cyclomatic 22) compiler/rustc_codegen_ssa/src/back/link.rs:4019 — rustc_codegen_ssa::back::link::get_apple_sdk_root has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_ssa::target_features::from_target_feature_attr (cyclomatic 21) compiler/rustc_codegen_ssa/src/target_features.rs:22 — rustc_codegen_ssa::target_features::from_target_feature_attr has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_ssa::back::link::add_sanitizer_libraries (cyclomatic 20) compiler/rustc_codegen_ssa/src/back/link.rs:1721 — rustc_codegen_ssa::back::link::add_sanitizer_libraries has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_ssa::back::link::add_apple_link_args (cyclomatic 19) compiler/rustc_codegen_ssa/src/back/link.rs:3806 — rustc_codegen_ssa::back::link::add_apple_link_args has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_ssa::mir::codegen_mir (cyclomatic 18) compiler/rustc_codegen_ssa/src/mir/mod.rs:203 — rustc_codegen_ssa::mir::codegen_mir has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_ssa::back::link::linker_and_flavor (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/link.rs:1856 — rustc_codegen_ssa::back::link::linker_and_flavor has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (infer_from, adjust_flavor_to_features). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_codegen_ssa::back::link::exec_linker (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/link.rs:2113 — rustc_codegen_ssa::back::link::exec_linker has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • + 6 more in this group — see findings.md.
D2 · Cognitive Complexity · TypeErrCtxt · ×31
  • TypeErrCtxt::report_selection_error (cognitive 164) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:92 — TypeErrCtxt::report_selection_error has cognitive complexity 164 (threshold 15). Drivers by points: if/else 51 (122 pts), boolean chains 21, match/switch 7 (17 pts), loops 1 (4 pts) (nesting depth added 84). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::note_and_explain_type_err (cognitive 151) compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs:20 — TypeErrCtxt::note_and_explain_type_err has cognitive complexity 151 (threshold 15). Drivers by points: if/else 32 (105 pts), match/switch 9 (20 pts), boolean chains 14, loops 3 (12 pts) (nesting depth added 93). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeErrCtxt::report_similar_impl_candidates (cognitive 146) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2199 — TypeErrCtxt::report_similar_impl_candidates has cognitive complexity 146 (threshold 15). Drivers by points: if/else 69 (117 pts), boolean chains 15, loops 4 (12 pts), match/switch 1 (2 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::maybe_report_ambiguity (cognitive 127) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:206 — TypeErrCtxt::maybe_report_ambiguity has cognitive complexity 127 (threshold 15). Drivers by points: if/else 49 (105 pts), match/switch 5 (13 pts), boolean chains 7, loops 2 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::note_type_err (cognitive 123) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1461 — TypeErrCtxt::note_type_err has cognitive complexity 123 (threshold 15). Drivers by points: if/else 43 (77 pts), match/switch 10 (21 pts), boolean chains 19, loops 3 (6 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::note_error_origin (cognitive 87) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:325 — TypeErrCtxt::note_error_origin has cognitive complexity 87 (threshold 15). Drivers by points: if/else 31 (63 pts), match/switch 5 (13 pts), boolean chains 7, loops 1 (4 pts) (nesting depth added 43). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeErrCtxt::report_fulfillment_errors (cognitive 85) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:141 — TypeErrCtxt::report_fulfillment_errors has cognitive complexity 85 (threshold 15). Drivers by points: if/else 11 (44 pts), loops 7 (17 pts), match/switch 6 (17 pts), boolean chains 7 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::compare_generics (cognitive 50) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:978 — TypeErrCtxt::compare_generics has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (33 pts), loops 3 (7 pts), match/switch 2 (7 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::construct_generic_bound_failure (cognitive 50) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:717 — TypeErrCtxt::construct_generic_bound_failure has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (25 pts), match/switch 11 (18 pts), boolean chains 6, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::cmp (cognitive 48) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1127 — TypeErrCtxt::cmp has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 19). Of this number, 42 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::expected_found_str_term (cognitive 42) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2367 — TypeErrCtxt::expected_found_str_term has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (39 pts), boolean chains 2, match/switch 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::suggest_for_all_lifetime_closure (cognitive 42) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:720 — TypeErrCtxt::suggest_for_all_lifetime_closure has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::report_host_effect_error (cognitive 42) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:917 — TypeErrCtxt::report_host_effect_error has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 2 (9 pts), match/switch 1 (6 pts), boolean chains 3 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TypeErrCtxt::cmp_fn_sig (cognitive 39) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:752 — TypeErrCtxt::cmp_fn_sig has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 3 (6 pts), boolean chains 2, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::try_conversion_context (cognitive 39) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1210 — TypeErrCtxt::try_conversion_context has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 9, loops 2, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::report_projection_error (cognitive 32) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1716 — TypeErrCtxt::report_projection_error has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::consider_returning_binding_diag (cognitive 29) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:912 — TypeErrCtxt::consider_returning_binding_diag has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 2 (4 pts), match/switch 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::report_not_const_evaluatable_error (cognitive 27) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:4083 — TypeErrCtxt::report_not_const_evaluatable_error has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::report_concrete_failure (cognitive 26) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:313 — TypeErrCtxt::report_concrete_failure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::should_suggest_as_ref_kind (cognitive 26) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:607 — TypeErrCtxt::should_suggest_as_ref_kind has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 2 (11 pts), if/else 4 (10 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::suggest_function_pointers_impl (cognitive 25) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:462 — TypeErrCtxt::suggest_function_pointers_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::emit_specialized_closure_kind_error (cognitive 24) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1036 — TypeErrCtxt::emit_specialized_closure_kind_error has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TypeErrCtxt::maybe_detailed_projection_msg (cognitive 23) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1957 — TypeErrCtxt::maybe_detailed_projection_msg has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (11 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::type_error_additional_suggestions (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1983 — TypeErrCtxt::type_error_additional_suggestions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeErrCtxt::check_on_type_error_attribute (cognitive 20) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2134 — TypeErrCtxt::check_on_type_error_attribute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 6 more in this group — see findings.md.
D2 · Cognitive Complexity · Builder · ×29
  • Builder::cargo (cognitive 139) src/bootstrap/src/core/builder/cargo.rs:700 — Builder::cargo has cognitive complexity 139 (threshold 15). Drivers by points: if/else 82 (102 pts), boolean chains 19, match/switch 13 (15 pts), loops 3 (nesting depth added 22). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Builder::codegen_inline_asm (cognitive 122) compiler/rustc_codegen_gcc/src/asm.rs:115 — Builder::codegen_inline_asm has cognitive complexity 122 (threshold 15). Drivers by points: if/else 34 (76 pts), match/switch 10 (30 pts), loops 9 (11 pts), boolean chains 5 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::codegen_intrinsic_call (cognitive 121) compiler/rustc_codegen_llvm/src/intrinsic.rs:124 — Builder::codegen_intrinsic_call has cognitive complexity 121 (threshold 15). Drivers by points: if/else 47 (85 pts), match/switch 13 (27 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::codegen_inline_asm (cognitive 117) compiler/rustc_codegen_llvm/src/asm.rs:28 — Builder::codegen_inline_asm has cognitive complexity 117 (threshold 15). Drivers by points: if/else 36 (77 pts), match/switch 9 (20 pts), loops 8 (18 pts), boolean chains 2 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::expr_into_dest (cognitive 80) compiler/rustc_mir_build/src/builder/expr/into.rs:26 — Builder::expr_into_dest has cognitive complexity 80 (threshold 15). Drivers by points: if/else 26 (47 pts), match/switch 13 (30 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 39). Of this number, 75 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::cfi_type_test (cognitive 47) compiler/rustc_codegen_llvm/src/builder.rs:2002 — Builder::cfi_type_test has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::codegen_intrinsic_call (cognitive 40) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:139 — Builder::codegen_intrinsic_call has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 7 (14 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::load_operand (cognitive 38) compiler/rustc_codegen_llvm/src/builder.rs:730 — Builder::load_operand has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 1, match/switch 1 (nesting depth added 16). Of this number, 28 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::choose_bucket_for_candidate (cognitive 30) compiler/rustc_mir_build/src/builder/matches/buckets.rs:120 — Builder::choose_bucket_for_candidate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::dbg_scope_fn (cognitive 28) compiler/rustc_codegen_llvm/src/debuginfo/mod.rs:129 — Builder::dbg_scope_fn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (get_containing_scope, get_function_signature, get_template_parameters). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • Builder::as_rvalue (cognitive 26) compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs:42 — Builder::as_rvalue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Builder::count_zeroes_nonzero (cognitive 25) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:976 — Builder::count_zeroes_nonzero has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 1 (nesting depth added 5). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Builder::gcc_shr (cognitive 24) compiler/rustc_codegen_gcc/src/int.rs:78 — Builder::gcc_shr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::gcc_icmp (cognitive 24) compiler/rustc_codegen_gcc/src/int.rs:473 — Builder::gcc_icmp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::build_exit_tree (cognitive 23) compiler/rustc_mir_build/src/builder/scope.rs:1962 — Builder::build_exit_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::codegen_llvm_intrinsic_call (cognitive 22) compiler/rustc_codegen_llvm/src/intrinsic.rs:894 — Builder::codegen_llvm_intrinsic_call has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3, match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::stmt_expr (cognitive 21) compiler/rustc_mir_build/src/builder/expr/stmt.rs:14 — Builder::stmt_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Builder::args_and_body (cognitive 21) compiler/rustc_mir_build/src/builder/mod.rs:951 — Builder::args_and_body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::check_ptr_call (cognitive 20) compiler/rustc_codegen_gcc/src/builder.rs:206 — Builder::check_ptr_call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::ast_block_stmts (cognitive 20) compiler/rustc_mir_build/src/builder/block.rs:34 — Builder::ast_block_stmts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::shuffle_vector (cognitive 19) compiler/rustc_codegen_gcc/src/builder.rs:2122 — Builder::shuffle_vector has cognitive complexity 19 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 8 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Builder::codegen_llvm_intrinsic_call (cognitive 19) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:555 — Builder::codegen_llvm_intrinsic_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::load_operand (cognitive 18) compiler/rustc_codegen_gcc/src/builder.rs:1089 — Builder::load_operand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Builder::visit_primary_bindings_special (cognitive 18) compiler/rustc_mir_build/src/builder/matches/mod.rs:819 — Builder::visit_primary_bindings_special has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (6 pts), match/switch 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Builder::static_pattern_match_inner (cognitive 17) compiler/rustc_mir_build/src/builder/matches/mod.rs:2921 — Builder::static_pattern_match_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 6 (8 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • + 4 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×29
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:508 — `window.searchState.loadingText` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:727 — `id` is text this program did not author, and it is written into a URL attribute through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:872 — `struct[TEXT_IDX]` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1016 — `text` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1255 — `lines.map((line,index)=>generateLine(index+1)+line).join("\n")` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1355 — `window.NOTABLE_TRAITS[notable_ty]` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1618 — `drloChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1635 — `y` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1636 — `x[1]` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1658 — `x` is text this program did not author, and it is written into the text of an element through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/main.js:1831 — `path` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/scrape-examples.js:91 — `title` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:4989 — `typeName` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:5001 — `obj.displayPath` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:5008 — `desc` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:5129 — `dlroChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5131 — `dlroChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5133 — `dlroChannel` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5139 — `getNakedUrl()` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5140 — `getNakedUrl()` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5141 — `getNakedUrl()` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped REDACTED:5186 — ``Query parser error: "${error.join("")}".`` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:5248 — `c` is text this program did not author, and it is written into a quoted attribute value through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/storage.js:248 — `newHref` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • Untrusted text written into markup unescaped src/librustdoc/html/static/js/storage.js:399 — `currentUrl` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
  • + 4 more in this group — see findings.md.
D2 · Cognitive Complexity · rustc_codegen_llvm · ×28
  • rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cognitive 328) compiler/rustc_codegen_llvm/src/intrinsic.rs:2030 — rustc_codegen_llvm::intrinsic::generic_simd_intrinsic has cognitive complexity 328 (threshold 15). Drivers by points: if/else 138 (215 pts), match/switch 59 (101 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 121). Of this number, 324 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::context::init_module (cognitive 58) compiler/rustc_codegen_llvm/src/context.rs:197 — rustc_codegen_llvm::context::init_module has cognitive complexity 58 (threshold 15). Drivers by points: if/else 32 (41 pts), match/switch 6 (10 pts), boolean chains 6, loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_llvm::attributes::llfn_attrs_from_instance (cognitive 56) compiler/rustc_codegen_llvm/src/attributes.rs:498 — rustc_codegen_llvm::attributes::llfn_attrs_from_instance has cognitive complexity 56 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 3, loops 1 (2 pts), match/switch 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::asm::reg_to_llvm (cognitive 43) compiler/rustc_codegen_llvm/src/asm.rs:728 — rustc_codegen_llvm::asm::reg_to_llvm has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (22 pts), match/switch 6 (18 pts), boolean chains 3 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::back::write::llvm_optimize (cognitive 43) compiler/rustc_codegen_llvm/src/back/write.rs:543 — rustc_codegen_llvm::back::write::llvm_optimize has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 5, loops 3 (4 pts), match/switch 2 (3 pts) (nesting depth added 10). Of this number, 36 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::va_arg::emit_va_arg (cognitive 37) compiler/rustc_codegen_llvm/src/va_arg.rs:1067 — rustc_codegen_llvm::va_arg::emit_va_arg has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 6 (12 pts), boolean chains 4 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::builder::autodiff::match_args_from_caller_to_enzyme (cognitive 36) compiler/rustc_codegen_llvm/src/builder/autodiff.rs:137 — rustc_codegen_llvm::builder::autodiff::match_args_from_caller_to_enzyme has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (9 pts), match/switch 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::back::write::codegen (cognitive 35) compiler/rustc_codegen_llvm/src/back/write.rs:964 — rustc_codegen_llvm::back::write::codegen has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 14). Of this number, 29 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::attributes::instrument_function_attr (cognitive 29) compiler/rustc_codegen_llvm/src/attributes.rs:261 — rustc_codegen_llvm::attributes::instrument_function_attr has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 4 (11 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::callee::get_fn (cognitive 29) compiler/rustc_codegen_llvm/src/callee.rs:19 — rustc_codegen_llvm::callee::get_fn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::builder::autodiff::adjust_activity_to_abi (cognitive 28) compiler/rustc_codegen_llvm/src/builder/autodiff.rs:23 — rustc_codegen_llvm::builder::autodiff::adjust_activity_to_abi has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 3 (11 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::abi::get_attrs (cognitive 27) compiler/rustc_codegen_llvm/src/abi.rs:60 — rustc_codegen_llvm::abi::get_attrs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::base::compile_codegen_unit::module_codegen (cognitive 24) compiler/rustc_codegen_llvm/src/base.rs:83 — rustc_codegen_llvm::base::compile_codegen_unit::module_codegen has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • rustc_codegen_llvm::asm::llvm_fixup_input (cognitive 23) compiler/rustc_codegen_llvm/src/asm.rs:1171 — rustc_codegen_llvm::asm::llvm_fixup_input has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::asm::llvm_fixup_output (cognitive 23) compiler/rustc_codegen_llvm/src/asm.rs:1374 — rustc_codegen_llvm::asm::llvm_fixup_output has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::attributes::sanitize_attrs (cognitive 23) compiler/rustc_codegen_llvm/src/attributes.rs:146 — rustc_codegen_llvm::attributes::sanitize_attrs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::asm::modifier_to_llvm (cognitive 22) compiler/rustc_codegen_llvm/src/asm.rs:915 — rustc_codegen_llvm::asm::modifier_to_llvm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 4 (7 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::back::write::optimize_inner (cognitive 22) compiler/rustc_codegen_llvm/src/back/write.rs:867 — rustc_codegen_llvm::back::write::optimize_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::back::lto::thin_lto (cognitive 21) compiler/rustc_codegen_llvm/src/back/lto.rs:371 — rustc_codegen_llvm::back::lto::thin_lto has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::llvm_util::global_llvm_features (cognitive 21) compiler/rustc_codegen_llvm/src/llvm_util.rs:688 — rustc_codegen_llvm::llvm_util::global_llvm_features has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::consts::check_and_apply_linkage (cognitive 20) compiler/rustc_codegen_llvm/src/consts.rs:190 — rustc_codegen_llvm::consts::check_and_apply_linkage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::llvm_util::configure_llvm (cognitive 19) compiler/rustc_codegen_llvm/src/llvm_util.rs:49 — rustc_codegen_llvm::llvm_util::configure_llvm has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 5, match/switch 3 (4 pts), loops 1 (nesting depth added 1). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_llvm::intrinsic::intrinsic_fn (cognitive 18) compiler/rustc_codegen_llvm/src/intrinsic.rs:1220 — rustc_codegen_llvm::intrinsic::intrinsic_fn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_llvm::type_of::uncached_llvm_type (cognitive 18) compiler/rustc_codegen_llvm/src/type_of.rs:15 — rustc_codegen_llvm::type_of::uncached_llvm_type has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 6 (8 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_llvm::va_arg::emit_x86_64_sysv64_va_arg (cognitive 17) compiler/rustc_codegen_llvm/src/va_arg.rs:546 — rustc_codegen_llvm::va_arg::emit_x86_64_sysv64_va_arg has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 6 (7 pts) (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×27
  • Duplicated block (14 lines × 2) compiler/rustc_ast_lowering/src/expr.rs:1023 — compiler/rustc_ast_lowering/src/expr.rs:1023-1036 | compiler/rustc_ast_lowering/src/expr.rs:1699-1712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_ast_pretty/src/pprust/state.rs:1926 — compiler/rustc_ast_pretty/src/pprust/state.rs:1926-1939 | compiler/rustc_hir_pretty/src/lib.rs:2032-2045 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_cranelift/src/inline_asm.rs:786 — compiler/rustc_codegen_cranelift/src/inline_asm.rs:786-799 | compiler/rustc_codegen_cranelift/src/inline_asm.rs:836-849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs:77 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs:77-90 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1370-1383 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1025 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1025-1038 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1069-1082 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:151 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:151-164 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:245-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:400 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:400-413 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:453-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:1387 — compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:1387-1400 | compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs:158-171 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:742 — compiler/rustc_codegen_llvm/src/intrinsic.rs:742-755 | compiler/rustc_codegen_llvm/src/intrinsic.rs:763-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1360 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1360-1373 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1398-1411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_metadata/src/rmeta/encoder.rs:1005 — compiler/rustc_metadata/src/rmeta/encoder.rs:1005-1018 | compiler/rustc_metadata/src/rmeta/encoder.rs:1085-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_mir_build/src/builder/scope.rs:439 — compiler/rustc_mir_build/src/builder/scope.rs:439-452 | compiler/rustc_mir_build/src/builder/scope.rs:459-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_session/src/options.rs:1518 — compiler/rustc_session/src/options.rs:1518-1531 | compiler/rustc_session/src/options.rs:1570-1583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:366 — compiler/rustc_target/src/callconv/loongarch.rs:366-379 | compiler/rustc_target/src/callconv/riscv.rs:372-385 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) compiler/rustc_trait_selection/src/traits/effects.rs:176 — compiler/rustc_trait_selection/src/traits/effects.rs:176-189 | compiler/rustc_trait_selection/src/traits/effects.rs:272-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_trait_selection/src/traits/fulfill.rs:635 — compiler/rustc_trait_selection/src/traits/fulfill.rs:635-648 | compiler/rustc_trait_selection/src/traits/fulfill.rs:661-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_trait_selection/src/traits/select/mod.rs:2509 — compiler/rustc_trait_selection/src/traits/select/mod.rs:2509-2522 | compiler/rustc_trait_selection/src/traits/select/mod.rs:2578-2591 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) compiler/rustc_ty_utils/src/abi.rs:157 — compiler/rustc_ty_utils/src/abi.rs:157-170 | compiler/rustc_ty_utils/src/abi.rs:193-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) library/alloc/src/boxed/thin.rs:240 — library/alloc/src/boxed/thin.rs:240-253 | library/alloc/src/boxed/thin.rs:283-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) library/alloc/src/collections/linked_list.rs:1462 — library/alloc/src/collections/linked_list.rs:1462-1475 | library/alloc/src/collections/linked_list.rs:1594-1607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) library/compiler-builtins/libm/src/math/jn.rs:49 — library/compiler-builtins/libm/src/math/jn.rs:49-62 | library/compiler-builtins/libm/src/math/jn.rs:260-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) library/compiler-builtins/libm/src/math/log1p.rs:85 — library/compiler-builtins/libm/src/math/log1p.rs:85-98 | library/compiler-builtins/libm/src/math/log1pf.rs:40-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) library/alloc/src/collections/vec_deque/iter.rs:92 — library/alloc/src/collections/vec_deque/iter.rs:92-105 | library/alloc/src/collections/vec_deque/iter_mut.rs:157-170 — before extracting anything, compare `library/alloc/src/collections/vec_deque/iter.rs` and `library/alloc/src/collections/vec_deque/iter_mut.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) library/alloc/src/collections/vec_deque/iter.rs:164 — library/alloc/src/collections/vec_deque/iter.rs:164-177 | library/alloc/src/collections/vec_deque/iter_mut.rs:228-241 — before extracting anything, compare `library/alloc/src/collections/vec_deque/iter.rs` and `library/alloc/src/collections/vec_deque/iter_mut.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) library/alloc/src/rcs/arc.rs:3278 — library/alloc/src/rcs/arc.rs:3278-3291 | library/alloc/src/rcs/rc.rs:3559-3572 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 2 more in this group — see findings.md.
D2 · Cognitive Complexity · rustc_mir_transform · ×26
  • rustc_mir_transform::lint_tail_expr_drop_order::run_lint (cognitive 78) compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:183 — rustc_mir_transform::lint_tail_expr_drop_order::run_lint has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (60 pts), loops 8 (15 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::liveness::find_self_assignments (cognitive 63) compiler/rustc_mir_transform/src/liveness.rs:365 — rustc_mir_transform::liveness::find_self_assignments has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (55 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::ref_prop::compute_replacement (cognitive 46) compiler/rustc_mir_transform/src/ref_prop.rs:149 — rustc_mir_transform::ref_prop::compute_replacement has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 6, loops 3, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::pass_manager::run_passes_inner (cognitive 40) compiler/rustc_mir_transform/src/pass_manager.rs:280 — rustc_mir_transform::pass_manager::run_passes_inner has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::dataflow_const_prop::try_write_constant (cognitive 31) compiler/rustc_mir_transform/src/dataflow_const_prop.rs:777 — rustc_mir_transform::dataflow_const_prop::try_write_constant has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::dead_store_elimination::eliminate (cognitive 31) compiler/rustc_mir_transform/src/dead_store_elimination.rs:34 — rustc_mir_transform::dead_store_elimination::eliminate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::dest_prop::save_as_intervals (cognitive 30) compiler/rustc_mir_transform/src/dest_prop.rs:508 — rustc_mir_transform::dest_prop::save_as_intervals has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 3 (10 pts), loops 4 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::inline::resolve_callsite (cognitive 27) compiler/rustc_mir_transform/src/inline.rs:528 — rustc_mir_transform::inline::resolve_callsite has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_mir_transform::inline::try_inlining (cognitive 27) compiler/rustc_mir_transform/src/inline.rs:600 — rustc_mir_transform::inline::try_inlining has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::coroutine::layout::check_must_not_suspend_ty (cognitive 26) compiler/rustc_mir_transform/src/coroutine/layout.rs:575 — rustc_mir_transform::coroutine::layout::check_must_not_suspend_ty has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::ssa::compute_copy_classes (cognitive 25) compiler/rustc_mir_transform/src/ssa.rs:296 — rustc_mir_transform::ssa::compute_copy_classes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::cross_crate_inline::cross_crate_inlinable (cognitive 24) compiler/rustc_mir_transform/src/cross_crate_inline.rs:18 — rustc_mir_transform::cross_crate_inline::cross_crate_inlinable has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, match/switch 3, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_mir_transform::early_otherwise_branch::verify_candidate_branch (cognitive 24) compiler/rustc_mir_transform/src/early_otherwise_branch.rs:317 — rustc_mir_transform::early_otherwise_branch::verify_candidate_branch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::ffi_unwind_calls::has_ffi_unwind_calls (cognitive 24) compiler/rustc_mir_transform/src/ffi_unwind_calls.rs:15 — rustc_mir_transform::ffi_unwind_calls::has_ffi_unwind_calls has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::inline::inline_call (cognitive 24) compiler/rustc_mir_transform/src/inline.rs:854 — rustc_mir_transform::inline::inline_call has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (19 pts), loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_mir_transform::inline::cycle::process (cognitive 23) compiler/rustc_mir_transform/src/inline/cycle.rs:65 — rustc_mir_transform::inline::cycle::process has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::shim::build_call_shim (cognitive 23) compiler/rustc_mir_transform/src/shim.rs:764 — rustc_mir_transform::shim::build_call_shim has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, match/switch 4 (7 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_mir_transform::promote_consts::promote_candidates (cognitive 22) compiler/rustc_mir_transform/src/promote_consts.rs:1006 — rustc_mir_transform::promote_consts::promote_candidates has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::liveness::check_liveness (cognitive 21) compiler/rustc_mir_transform/src/liveness.rs:54 — rustc_mir_transform::liveness::check_liveness has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::coroutine::create_coroutine_resume_function (cognitive 20) compiler/rustc_mir_transform/src/coroutine/mod.rs:879 — rustc_mir_transform::coroutine::create_coroutine_resume_function has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::jump_threading::simplify_conditions (cognitive 20) compiler/rustc_mir_transform/src/jump_threading.rs:776 — rustc_mir_transform::jump_threading::simplify_conditions has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 2 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rustc_mir_transform::coverage::expansion::build_expn_tree (cognitive 19) compiler/rustc_mir_transform/src/coverage/expansion.rs:101 — rustc_mir_transform::coverage::expansion::build_expn_tree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::inline::check_mir_is_available (cognitive 19) compiler/rustc_mir_transform/src/inline.rs:700 — rustc_mir_transform::inline::check_mir_is_available has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::coverage::spans::extract_refined_covspans (cognitive 17) compiler/rustc_mir_transform/src/coverage/spans.rs:11 — rustc_mir_transform::coverage::spans::extract_refined_covspans has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_transform::early_otherwise_branch::evaluate_candidate (cognitive 16) compiler/rustc_mir_transform/src/early_otherwise_branch.rs:211 — rustc_mir_transform::early_otherwise_branch::evaluate_candidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 1 more in this group — see findings.md.
D2 · Cognitive Complexity · rustc_trait_selection · ×26
  • rustc_trait_selection::error_reporting::infer::nice_region_error::static_impl_trait::suggest_new_region_bound (cognitive 61) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs:137 — rustc_trait_selection::error_reporting::infer::nice_region_error::static_impl_trait::suggest_new_region_bound has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (53 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::error_reporting::infer::region::suggest_precise_capturing (cognitive 53) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:1412 — rustc_trait_selection::error_reporting::infer::region::suggest_precise_capturing has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (35 pts), match/switch 4 (9 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::dyn_compatibility::virtual_call_violations_for_method (cognitive 39) compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs:437 — rustc_trait_selection::traits::dyn_compatibility::virtual_call_violations_for_method has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (27 pts), match/switch 2 (8 pts), boolean chains 3, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::project::assemble_candidates_from_impls (cognitive 36) compiler/rustc_trait_selection/src/traits/project.rs:975 — rustc_trait_selection::traits::project::assemble_candidates_from_impls has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 7 (16 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable (cognitive 32) compiler/rustc_trait_selection/src/traits/const_evaluatable.rs:24 — rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::effects::evaluate_host_effect_from_conditionally_const_item_bounds (cognitive 32) compiler/rustc_trait_selection/src/traits/effects.rs:172 — rustc_trait_selection::traits::effects::evaluate_host_effect_from_conditionally_const_item_bounds has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::try_evaluate_const (cognitive 31) compiler/rustc_trait_selection/src/traits/mod.rs:628 — rustc_trait_selection::traits::try_evaluate_const has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 5 (11 pts), boolean chains 3 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_trait_selection::error_reporting::traits::report_dyn_incompatibility (cognitive 27) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:684 — rustc_trait_selection::error_reporting::traits::report_dyn_incompatibility has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (8 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::error_reporting::traits::call_kind::call_kind (cognitive 27) compiler/rustc_trait_selection/src/error_reporting/traits/call_kind.rs:84 — rustc_trait_selection::error_reporting::traits::call_kind::call_kind has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 7, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_trait_selection::traits::misc::type_allowed_to_implement_const_param_ty (cognitive 27) compiler/rustc_trait_selection/src/traits/misc.rs:92 — rustc_trait_selection::traits::misc::type_allowed_to_implement_const_param_ty has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::misc::all_fields_implement_trait (cognitive 25) compiler/rustc_trait_selection/src/traits/misc.rs:204 — rustc_trait_selection::traits::misc::all_fields_implement_trait has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::diagnostics::impl_trait_overcapture_suggestion (cognitive 24) compiler/rustc_trait_selection/src/diagnostics.rs:1942 — rustc_trait_selection::diagnostics::impl_trait_overcapture_suggestion has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::error_reporting::traits::to_pretty_impl_header (cognitive 24) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:569 — rustc_trait_selection::error_reporting::traits::to_pretty_impl_header has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::effects::evaluate_host_effect_from_item_bounds (cognitive 24) compiler/rustc_trait_selection/src/traits/effects.rs:268 — rustc_trait_selection::traits::effects::evaluate_host_effect_from_item_bounds has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::query::dropck_outlives::compute_dropck_outlives_with_errors (cognitive 24) compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs:105 — rustc_trait_selection::traits::query::dropck_outlives::compute_dropck_outlives_with_errors has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (7 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::outlives_for_liveness::live_args_for_outlives_clause (cognitive 23) compiler/rustc_trait_selection/src/traits/outlives_for_liveness.rs:369 — rustc_trait_selection::traits::outlives_for_liveness::live_args_for_outlives_clause has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::outlives_for_liveness::args_known_to_outlive_opaque_params (cognitive 21) compiler/rustc_trait_selection/src/traits/outlives_for_liveness.rs:189 — rustc_trait_selection::traits::outlives_for_liveness::args_known_to_outlive_opaque_params has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (6 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations_for_assoc_item (cognitive 20) compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs:346 — rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations_for_assoc_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::project::confirm_impl_candidate (cognitive 19) compiler/rustc_trait_selection/src/traits/project.rs:2052 — rustc_trait_selection::traits::project::confirm_impl_candidate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::error_reporting::traits::ambiguity::compute_applicable_impls_for_diagnostics (cognitive 18) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:32 — rustc_trait_selection::error_reporting::traits::ambiguity::compute_applicable_impls_for_diagnostics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::opaque_types::opaque_type_has_defining_use_args (cognitive 18) compiler/rustc_trait_selection/src/opaque_types.rs:66 — rustc_trait_selection::opaque_types::opaque_type_has_defining_use_args has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::specialize::specialization_graph_provider (cognitive 18) compiler/rustc_trait_selection/src/traits/specialize/mod.rs:381 — rustc_trait_selection::traits::specialize::specialization_graph_provider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::util::sizedness_fast_path (cognitive 18) compiler/rustc_trait_selection/src/traits/util.rs:220 — rustc_trait_selection::traits::util::sizedness_fast_path has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::project::project (cognitive 17) compiler/rustc_trait_selection/src/traits/project.rs:691 — rustc_trait_selection::traits::project::project has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_trait_selection::traits::project::assemble_candidates_from_clauses (cognitive 17) compiler/rustc_trait_selection/src/traits/project.rs:920 — rustc_trait_selection::traits::project::assemble_candidates_from_clauses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×26
  • Duplicated block (13 lines × 2) compiler/rustc_attr_parsing/src/attributes/stability.rs:342 — compiler/rustc_attr_parsing/src/attributes/stability.rs:342-354 | compiler/rustc_attr_parsing/src/attributes/stability.rs:407-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:411 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:411-423 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:430-442 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:454 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:454-466 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:468-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1093 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1093-1105 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1135-1147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_gcc/src/asm.rs:506 — compiler/rustc_codegen_gcc/src/asm.rs:506-518 | compiler/rustc_codegen_gcc/src/asm.rs:983-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_gcc/src/int.rs:219 — compiler/rustc_codegen_gcc/src/int.rs:219-231 | compiler/rustc_codegen_gcc/src/int.rs:297-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1346 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1346-1358 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1380-1392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1267 — compiler/rustc_codegen_llvm/src/asm.rs:1267-1279 | compiler/rustc_codegen_llvm/src/asm.rs:1460-1472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_llvm/src/va_arg.rs:710 — compiler/rustc_codegen_llvm/src/va_arg.rs:710-722 | compiler/rustc_codegen_llvm/src/va_arg.rs:732-744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_hir_analysis/src/coherence/builtin.rs:350 — compiler/rustc_hir_analysis/src/coherence/builtin.rs:350-362 | compiler/rustc_hir_analysis/src/coherence/builtin.rs:739-751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_hir_analysis/src/coherence/builtin/coerce_shared.rs:540 — compiler/rustc_hir_analysis/src/coherence/builtin/coerce_shared.rs:540-552 | compiler/rustc_hir_analysis/src/coherence/builtin/coerce_shared.rs:610-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_hir_pretty/src/lib.rs:2054 — compiler/rustc_hir_pretty/src/lib.rs:2054-2066 | compiler/rustc_hir_pretty/src/lib.rs:2094-2106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_infer/src/infer/relate/type_relating.rs:125 — compiler/rustc_infer/src/infer/relate/type_relating.rs:125-137 | compiler/rustc_type_ir/src/relate/solver_relating.rs:148-160 — before extracting anything, compare `compiler/rustc_infer/src/infer/relate/type_relating.rs` and `compiler/rustc_type_ir/src/relate/solver_relating.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) compiler/rustc_middle/src/ty/util.rs:1192 — compiler/rustc_middle/src/ty/util.rs:1192-1204 | compiler/rustc_middle/src/ty/util.rs:1242-1254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:388 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:388-400 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:739-751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_trait_selection/src/solve/normalize.rs:288 — compiler/rustc_trait_selection/src/solve/normalize.rs:288-300 | compiler/rustc_trait_selection/src/solve/normalize.rs:303-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) compiler/rustc_type_ir/src/infer_ctxt.rs:287 — compiler/rustc_type_ir/src/infer_ctxt.rs:287-299 | compiler/rustc_type_ir/src/infer_ctxt.rs:353-365 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) library/alloc/src/rcs/arc.rs:2441 — library/alloc/src/rcs/arc.rs:2441-2453 | library/alloc/src/rcs/rc.rs:2530-2542 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) library/compiler-builtins/libm-test/src/generate/edge_cases.rs:82 — library/compiler-builtins/libm-test/src/generate/edge_cases.rs:82-94 | library/compiler-builtins/libm-test/src/generate/edge_cases.rs:190-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) library/compiler-builtins/libm/src/math/jnf.rs:23 — library/compiler-builtins/libm/src/math/jnf.rs:23-35 | library/compiler-builtins/libm/src/math/jnf.rs:200-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) library/alloc/src/rcs/arc.rs:4850 — library/alloc/src/rcs/arc.rs:4850-4862 | library/alloc/src/rcs/rc.rs:4429-4441 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) library/compiler-builtins/libm/src/math/generic/fmaximum_num.rs:18 — library/compiler-builtins/libm/src/math/generic/fmaximum_num.rs:18-30 | library/compiler-builtins/libm/src/math/generic/fminimum_num.rs:18-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) library/alloc/src/rcs/arc.rs:1554 — library/alloc/src/rcs/arc.rs:1554-1566 | library/alloc/src/rcs/rc.rs:1396-1408 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:202 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:202-214 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:296-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/etc/gdb_trim_paths.py:20 — src/etc/gdb_trim_paths.py:20-34 | src/etc/lldb_trim_paths.py:21-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 1 more in this group — see findings.md.
D1 · Cyclomatic Complexity · rustc_codegen_llvm · ×25
  • rustc_codegen_llvm::intrinsic::generic_simd_intrinsic (cyclomatic 242) compiler/rustc_codegen_llvm/src/intrinsic.rs:2030 — rustc_codegen_llvm::intrinsic::generic_simd_intrinsic has cyclomatic complexity 242 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::asm::reg_to_llvm (cyclomatic 93) compiler/rustc_codegen_llvm/src/asm.rs:728 — rustc_codegen_llvm::asm::reg_to_llvm has cyclomatic complexity 93 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::asm::modifier_to_llvm (cyclomatic 58) compiler/rustc_codegen_llvm/src/asm.rs:915 — rustc_codegen_llvm::asm::modifier_to_llvm has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_llvm::asm::dummy_output_type (cyclomatic 69) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_llvm::context::init_module (cyclomatic 53) compiler/rustc_codegen_llvm/src/context.rs:197 — rustc_codegen_llvm::context::init_module has cyclomatic complexity 53 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_llvm::va_arg::emit_va_arg (cyclomatic 43) compiler/rustc_codegen_llvm/src/va_arg.rs:1067 — rustc_codegen_llvm::va_arg::emit_va_arg has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::llvm_util::to_llvm_features (cyclomatic 36) compiler/rustc_codegen_llvm/src/llvm_util.rs:239 — rustc_codegen_llvm::llvm_util::to_llvm_features has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::attributes::llfn_attrs_from_instance (cyclomatic 35) compiler/rustc_codegen_llvm/src/attributes.rs:498 — rustc_codegen_llvm::attributes::llfn_attrs_from_instance has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::asm::llvm_fixup_output (cyclomatic 33) compiler/rustc_codegen_llvm/src/asm.rs:1374 — rustc_codegen_llvm::asm::llvm_fixup_output has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_llvm::asm::dummy_output_type (cyclomatic 69) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_llvm::asm::llvm_fixup_input (cyclomatic 32) compiler/rustc_codegen_llvm/src/asm.rs:1171 — rustc_codegen_llvm::asm::llvm_fixup_input has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_llvm::asm::dummy_output_type (cyclomatic 69) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_llvm::debuginfo::metadata::build_basic_type_di_node (cyclomatic 31) compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:752 — rustc_codegen_llvm::debuginfo::metadata::build_basic_type_di_node has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::asm::llvm_fixup_output_type (cyclomatic 28) compiler/rustc_codegen_llvm/src/asm.rs:1558 — rustc_codegen_llvm::asm::llvm_fixup_output_type has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_llvm::asm::dummy_output_type (cyclomatic 69) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_llvm::back::write::llvm_optimize (cyclomatic 28) compiler/rustc_codegen_llvm/src/back/write.rs:543 — rustc_codegen_llvm::back::write::llvm_optimize has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::abi::to_llvm_calling_convention (cyclomatic 24) compiler/rustc_codegen_llvm/src/abi.rs:773 — rustc_codegen_llvm::abi::to_llvm_calling_convention has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::back::write::codegen (cyclomatic 24) compiler/rustc_codegen_llvm/src/back/write.rs:964 — rustc_codegen_llvm::back::write::codegen has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::debuginfo::metadata::spanned_type_di_node (cyclomatic 23) compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:450 — rustc_codegen_llvm::debuginfo::metadata::spanned_type_di_node has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::builder::autodiff::match_args_from_caller_to_enzyme (cyclomatic 21) compiler/rustc_codegen_llvm/src/builder/autodiff.rs:137 — rustc_codegen_llvm::builder::autodiff::match_args_from_caller_to_enzyme has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::type_of::uncached_llvm_type (cyclomatic 21) compiler/rustc_codegen_llvm/src/type_of.rs:15 — rustc_codegen_llvm::type_of::uncached_llvm_type has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::base::compile_codegen_unit::module_codegen (cyclomatic 20) compiler/rustc_codegen_llvm/src/base.rs:83 — rustc_codegen_llvm::base::compile_codegen_unit::module_codegen has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_llvm::llvm_util::configure_llvm (cyclomatic 19) compiler/rustc_codegen_llvm/src/llvm_util.rs:49 — rustc_codegen_llvm::llvm_util::configure_llvm has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_codegen_llvm::attributes::sanitize_attrs (cyclomatic 18) compiler/rustc_codegen_llvm/src/attributes.rs:146 — rustc_codegen_llvm::attributes::sanitize_attrs has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::abi::get_attrs (cyclomatic 17) compiler/rustc_codegen_llvm/src/abi.rs:60 — rustc_codegen_llvm::abi::get_attrs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::allocator::codegen (cyclomatic 17) compiler/rustc_codegen_llvm/src/allocator.rs:20 — rustc_codegen_llvm::allocator::codegen has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::attributes::instrument_function_attr (cyclomatic 17) compiler/rustc_codegen_llvm/src/attributes.rs:261 — rustc_codegen_llvm::attributes::instrument_function_attr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_llvm::va_arg::emit_x86_64_sysv64_va_arg (cyclomatic 17) compiler/rustc_codegen_llvm/src/va_arg.rs:546 — rustc_codegen_llvm::va_arg::emit_x86_64_sysv64_va_arg has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_llvm::callee::get_fn (cyclomatic 16) compiler/rustc_codegen_llvm/src/callee.rs:19 — rustc_codegen_llvm::callee::get_fn has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalContextExt · ×25
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 158) src/tools/miri/src/shims/unix/foreign_items.rs:111 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 158 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 108) src/tools/miri/src/shims/windows/foreign_items.rs:131 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 108 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 45) src/tools/miri/src/shims/unix/macos/foreign_items.rs:24 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 44) src/tools/miri/src/shims/math.rs:12 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::open (cyclomatic 40) src/tools/miri/src/shims/unix/fs.rs:455 — EvalContextExt::open has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::emulate_x86_sse2_intrinsic (cyclomatic 37) src/tools/miri/src/intrinsics/x86/sse2.rs:12 — EvalContextExt::emulate_x86_sse2_intrinsic has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_math_intrinsic (cyclomatic 35) src/tools/miri/src/intrinsics/math.rs:92 — EvalContextExt::emulate_math_intrinsic has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 35) src/tools/miri/src/shims/unix/linux/foreign_items.rs:27 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_aarch64_intrinsic (cyclomatic 34) src/tools/miri/src/intrinsics/aarch64.rs:9 — EvalContextExt::emulate_aarch64_intrinsic has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::CreateFileW (cyclomatic 34) src/tools/miri/src/shims/windows/fs.rs:109 — EvalContextExt::CreateFileW has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::emulate_x86_avx_intrinsic (cyclomatic 31) src/tools/miri/src/intrinsics/x86/avx.rs:12 — EvalContextExt::emulate_x86_avx_intrinsic has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_x86_sse42_intrinsic (cyclomatic 30) src/tools/miri/src/intrinsics/x86/sse42.rs:277 — EvalContextExt::emulate_x86_sse42_intrinsic has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::emulate_x86_avx2_intrinsic (cyclomatic 28) src/tools/miri/src/intrinsics/x86/avx2.rs:11 — EvalContextExt::emulate_x86_avx2_intrinsic has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_x86_sse_intrinsic (cyclomatic 25) src/tools/miri/src/intrinsics/x86/sse.rs:12 — EvalContextExt::emulate_x86_sse_intrinsic has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_x86_intrinsic (cyclomatic 24) src/tools/miri/src/intrinsics/x86/mod.rs:28 — EvalContextExt::emulate_x86_intrinsic has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 24) src/tools/miri/src/shims/unix/solarish/foreign_items.rs:19 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_simd_intrinsic (cyclomatic 23) src/tools/miri/src/intrinsics/simd.rs:13 — EvalContextExt::emulate_simd_intrinsic has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_x86_avx512_intrinsic (cyclomatic 21) src/tools/miri/src/intrinsics/x86/avx512.rs:11 — EvalContextExt::emulate_x86_avx512_intrinsic has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::emulate_x86_sse41_intrinsic (cyclomatic 18) src/tools/miri/src/intrinsics/x86/sse41.rs:8 — EvalContextExt::emulate_x86_sse41_intrinsic has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • EvalContextExt::fcntl (cyclomatic 18) src/tools/miri/src/shims/unix/fd.rs:228 — EvalContextExt::fcntl has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::emulate_foreign_item_inner (cyclomatic 18) src/tools/miri/src/shims/unix/freebsd/foreign_items.rs:16 — EvalContextExt::emulate_foreign_item_inner has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EvalContextExt::epoll_ctl (cyclomatic 18) src/tools/miri/src/shims/unix/linux_like/epoll.rs:78 — EvalContextExt::epoll_ctl has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::emulate_x86_bmi_intrinsic (cyclomatic 16) src/tools/miri/src/intrinsics/x86/bmi.rs:8 — EvalContextExt::emulate_x86_bmi_intrinsic has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • EvalContextExt::set_generic_socket_option (cyclomatic 16) src/tools/miri/src/shims/unix/socket.rs:876 — EvalContextExt::set_generic_socket_option has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextExt::get_generic_socket_option (cyclomatic 16) src/tools/miri/src/shims/unix/socket.rs:1053 — EvalContextExt::get_generic_socket_option has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LateResolutionVisitor · ×25
  • LateResolutionVisitor::add_missing_lifetime_specifiers_label (cyclomatic 66) compiler/rustc_resolve/src/late/diagnostics.rs:4403 — LateResolutionVisitor::add_missing_lifetime_specifiers_label has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::smart_resolve_context_dependent_help (cyclomatic 62) compiler/rustc_resolve/src/late/diagnostics.rs:2431 — LateResolutionVisitor::smart_resolve_context_dependent_help has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::try_lookup_name_relaxed (cyclomatic 41) compiler/rustc_resolve/src/late/diagnostics.rs:1016 — LateResolutionVisitor::try_lookup_name_relaxed has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::resolve_expr (cyclomatic 38) compiler/rustc_resolve/src/late.rs:5461 — LateResolutionVisitor::resolve_expr has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LateResolutionVisitor::suggest_assoc_type_from_bounds (cyclomatic 36) compiler/rustc_resolve/src/late/diagnostics.rs:208 — LateResolutionVisitor::suggest_assoc_type_from_bounds has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::make_base_error (cyclomatic 34) compiler/rustc_resolve/src/late/diagnostics.rs:383 — LateResolutionVisitor::make_base_error has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::smart_resolve_path_fragment (cyclomatic 31) compiler/rustc_resolve/src/late.rs:4828 — LateResolutionVisitor::smart_resolve_path_fragment has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::resolve_item (cyclomatic 29) compiler/rustc_resolve/src/late.rs:2963 — LateResolutionVisitor::resolve_item has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LateResolutionVisitor::resolve_elided_lifetimes_in_path (cyclomatic 28) compiler/rustc_resolve/src/late.rs:2313 — LateResolutionVisitor::resolve_elided_lifetimes_in_path has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • LateResolutionVisitor::with_const_and_generic_param_rib (cyclomatic 28) compiler/rustc_resolve/src/late.rs:3240 — LateResolutionVisitor::with_const_and_generic_param_rib has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • LateResolutionVisitor::suggest_using_enum_variant (cyclomatic 27) compiler/rustc_resolve/src/late/diagnostics.rs:3470 — LateResolutionVisitor::suggest_using_enum_variant has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::lookup_assoc_candidate (cyclomatic 24) compiler/rustc_resolve/src/late/diagnostics.rs:3115 — LateResolutionVisitor::lookup_assoc_candidate has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • LateResolutionVisitor::detect_missing_turbofish (cyclomatic 22) compiler/rustc_resolve/src/late/diagnostics.rs:1773 — LateResolutionVisitor::detect_missing_turbofish has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::suggest_introducing_lifetime_filtered (cyclomatic 20) compiler/rustc_resolve/src/late/diagnostics.rs:4186 — LateResolutionVisitor::suggest_introducing_lifetime_filtered has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::resolve_lifetime (cyclomatic 19) compiler/rustc_resolve/src/late.rs:1907 — LateResolutionVisitor::resolve_lifetime has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LateResolutionVisitor::resolve_qpath (cyclomatic 19) compiler/rustc_resolve/src/late.rs:5175 — LateResolutionVisitor::resolve_qpath has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LateResolutionVisitor::smart_resolve_report_errors (cyclomatic 18) compiler/rustc_resolve/src/late/diagnostics.rs:665 — LateResolutionVisitor::smart_resolve_report_errors has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LateResolutionVisitor::lookup_typo_candidate (cyclomatic 18) compiler/rustc_resolve/src/late/diagnostics.rs:3229 — LateResolutionVisitor::lookup_typo_candidate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::suggest_adding_generic_parameter (cyclomatic 18) compiler/rustc_resolve/src/late/diagnostics.rs:3840 — LateResolutionVisitor::suggest_adding_generic_parameter has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::resolve_anonymous_lifetime (cyclomatic 18) compiler/rustc_resolve/src/late.rs:2019 — LateResolutionVisitor::resolve_anonymous_lifetime has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LateResolutionVisitor::resolve_fn_params (cyclomatic 18) compiler/rustc_resolve/src/late.rs:2627 — LateResolutionVisitor::resolve_fn_params has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LateResolutionVisitor::suggest_changing_type_to_const_param (cyclomatic 17) compiler/rustc_resolve/src/late/diagnostics.rs:2104 — LateResolutionVisitor::suggest_changing_type_to_const_param has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LateResolutionVisitor::resolve_doc_links (cyclomatic 17) compiler/rustc_resolve/src/late.rs:5748 — LateResolutionVisitor::resolve_doc_links has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LateResolutionVisitor::restrict_assoc_type_in_where_clause (cyclomatic 16) compiler/rustc_resolve/src/late/diagnostics.rs:2247 — LateResolutionVisitor::restrict_assoc_type_in_where_clause has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LateResolutionVisitor::detect_and_suggest_const_parameter_error (cyclomatic 16) compiler/rustc_resolve/src/late/diagnostics.rs:3678 — LateResolutionVisitor::detect_and_suggest_const_parameter_error has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ide_assists · ×25
  • ide_assists::handlers::inline_call::inline (cyclomatic 45) src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs:349 — ide_assists::handlers::inline_call::inline has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_variable::extract_variable (cyclomatic 36) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs:74 — ide_assists::handlers::extract_variable::extract_variable has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn (cyclomatic 32) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_closure_to_fn.rs:54 — ide_assists::handlers::convert_closure_to_fn::convert_closure_to_fn has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::add_missing_match_arms::add_missing_match_arms (cyclomatic 30) src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs:41 — ide_assists::handlers::add_missing_match_arms::add_missing_match_arms has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::unwrap_return_type::unwrap_return_type (cyclomatic 28) src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_return_type.rs:40 — ide_assists::handlers::unwrap_return_type::unwrap_return_type has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::add_turbo_fish::add_turbo_fish (cyclomatic 22) src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_turbo_fish.rs:31 — ide_assists::handlers::add_turbo_fish::add_turbo_fish has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_function::extract_function (cyclomatic 20) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:67 — ide_assists::handlers::extract_function::extract_function has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_type_alias::collect_used_generics (cyclomatic 20) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_type_alias.rs:110 — ide_assists::handlers::extract_type_alias::collect_used_generics has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_assists::handlers::inline_type_alias::create_replacement (cyclomatic 20) src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_type_alias.rs:320 — ide_assists::handlers::inline_type_alias::create_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::remove_dbg::compute_dbg_replacement (cyclomatic 20) src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_dbg.rs:72 — ide_assists::handlers::remove_dbg::compute_dbg_replacement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_assists::utils::gen_trait_fn_body::gen_partial_eq (cyclomatic 20) src/tools/rust-analyzer/crates/ide-assists/src/utils/gen_trait_fn_body.rs:414 — ide_assists::utils::gen_trait_fn_body::gen_partial_eq has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents (cyclomatic 19) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_let_else_to_match.rs:124 — ide_assists::handlers::convert_let_else_to_match::remove_mut_and_collect_idents has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::apply_demorgan::apply_demorgan (cyclomatic 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/apply_demorgan.rs:40 — ide_assists::handlers::apply_demorgan::apply_demorgan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_module::extract_module (cyclomatic 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:56 — ide_assists::handlers::extract_module::extract_module has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::generate_new::generate_new (cyclomatic 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_new.rs:36 — ide_assists::handlers::generate_new::generate_new has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::unwrap_branch::unwrap_branch (cyclomatic 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_branch.rs:32 — ide_assists::handlers::unwrap_branch::unwrap_branch has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_assists::handlers::wrap_return_type::wrap_return_type (cyclomatic 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs:43 — ide_assists::handlers::wrap_return_type::wrap_return_type has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::auto_import::relevance_score (cyclomatic 17) src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs:258 — ide_assists::handlers::auto_import::relevance_score has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_assists::handlers::convert_bool_to_enum::replace_usages (cyclomatic 17) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_bool_to_enum.rs:212 — ide_assists::handlers::convert_bool_to_enum::replace_usages has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_function::make_body (cyclomatic 17) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:1800 — ide_assists::handlers::extract_function::make_body has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: FunctionBody::external_control_flow (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter (cyclomatic 17) src/tools/rust-analyzer/crates/ide-assists/src/handlers/toggle_macro_delimiter.rs:29 — ide_assists::handlers::toggle_macro_delimiter::toggle_macro_delimiter has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params (cyclomatic 16) src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_closure_to_fn.rs:351 — ide_assists::handlers::convert_closure_to_fn::compute_closure_type_params has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string (cyclomatic 16) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs:31 — ide_assists::handlers::extract_expressions_from_format_string::extract_expressions_from_format_string has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::generate_delegate_methods::generate_delegate_methods (cyclomatic 16) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_delegate_methods.rs:51 — ide_assists::handlers::generate_delegate_methods::generate_delegate_methods has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive (cyclomatic 16) src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs:38 — ide_assists::handlers::wrap_unwrap_cfg_attr::attempt_get_derive has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×25
  • Duplicated block (15 lines × 2) compiler/rustc_ast_pretty/src/pprust/state.rs:1235 — compiler/rustc_ast_pretty/src/pprust/state.rs:1235-1249 | compiler/rustc_hir_pretty/src/lib.rs:357-371 — before extracting anything, compare `compiler/rustc_ast_pretty/src/pprust/state.rs` and `compiler/rustc_hir_pretty/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) compiler/rustc_builtin_macros/src/deriving/clone.rs:115 — compiler/rustc_builtin_macros/src/deriving/clone.rs:115-131 | compiler/rustc_builtin_macros/src/deriving/eq.rs:52-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_gcc/src/int.rs:196 — compiler/rustc_codegen_gcc/src/int.rs:196-210 | compiler/rustc_codegen_gcc/src/int.rs:280-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:182 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:182-196 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2224-2238 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2351 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2351-2365 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2375-2389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_ssa/src/back/link.rs:225 — compiler/rustc_codegen_ssa/src/back/link.rs:225-239 | compiler/rustc_codegen_ssa/src/back/link.rs:257-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:452 — compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:452-466 | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:476-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:823 — compiler/rustc_const_eval/src/const_eval/machine.rs:823-837 | compiler/rustc_const_eval/src/const_eval/machine.rs:864-878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_hir_analysis/src/check/check.rs:1122 — compiler/rustc_hir_analysis/src/check/check.rs:1122-1136 | compiler/rustc_hir_analysis/src/check/check.rs:1139-1153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_macros/src/type_foldable.rs:68 — compiler/rustc_macros/src/type_foldable.rs:68-82 | compiler/rustc_type_ir_macros/src/lib.rs:77-91 — before extracting anything, compare `compiler/rustc_macros/src/type_foldable.rs` and `compiler/rustc_type_ir_macros/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) compiler/rustc_metadata/src/rmeta/encoder.rs:1365 — compiler/rustc_metadata/src/rmeta/encoder.rs:1365-1379 | compiler/rustc_metadata/src/rmeta/encoder.rs:1440-1454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_middle/src/ty/util.rs:1207 — compiler/rustc_middle/src/ty/util.rs:1207-1221 | compiler/rustc_middle/src/ty/util.rs:1257-1271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_mir_transform/src/check_enums.rs:27 — compiler/rustc_mir_transform/src/check_enums.rs:27-41 | compiler/rustc_mir_transform/src/check_pointers.rs:62-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:663 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:663-677 | compiler/rustc_trait_selection/src/traits/project.rs:1931-1945 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) compiler/rustc_resolve/src/ident.rs:1133 — compiler/rustc_resolve/src/ident.rs:1133-1147 | compiler/rustc_resolve/src/ident.rs:1175-1189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/alloc/src/boxed/thin.rs:258 — library/alloc/src/boxed/thin.rs:258-272 | library/alloc/src/boxed/thin.rs:302-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/compiler-builtins/libm/src/math/exp2m1.rs:642 — library/compiler-builtins/libm/src/math/exp2m1.rs:642-656 | library/compiler-builtins/libm/src/math/exp2m1.rs:678-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/std/src/os/xous/ffi.rs:96 — library/std/src/os/xous/ffi.rs:96-110 | library/std/src/os/xous/ffi.rs:381-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/std/src/os/xous/ffi.rs:160 — library/std/src/os/xous/ffi.rs:160-174 | library/std/src/os/xous/ffi.rs:479-493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/std/src/os/xous/ffi.rs:470 — library/std/src/os/xous/ffi.rs:470-484 | library/std/src/os/xous/ffi.rs:514-528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/std/src/sync/mpmc/array.rs:384 — library/std/src/sync/mpmc/array.rs:384-398 | library/std/src/sync/mpmc/list.rs:435-449 — before extracting anything, compare `library/std/src/sync/mpmc/array.rs` and `library/std/src/sync/mpmc/list.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) library/alloc/src/rcs/arc.rs:1583 — library/alloc/src/rcs/arc.rs:1583-1597 | library/alloc/src/rcs/rc.rs:1425-1439 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) library/compiler-builtins/libm/src/math/arch/x86/fma.rs:112 — library/compiler-builtins/libm/src/math/arch/x86/fma.rs:112-126 | library/compiler-builtins/libm/src/math/arch/x86/fma.rs:132-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) library/compiler-builtins/libm/src/math/arch/x86/fma.rs:72 — library/compiler-builtins/libm/src/math/arch/x86/fma.rs:72-86 | library/compiler-builtins/libm/src/math/arch/x86/fma.rs:92-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:202 — compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:202-216 | compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs:176-190 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs` and `compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · Resolver · ×23
  • Resolver::into_struct_error (cyclomatic 76) compiler/rustc_resolve/src/diagnostics/impls.rs:799 — Resolver::into_struct_error has cyclomatic complexity 76 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Resolver::resolve_path_with_ribs (cyclomatic 63) compiler/rustc_resolve/src/ident.rs:1878 — Resolver::resolve_path_with_ribs has cyclomatic complexity 63 (threshold 15). Of this number, 61 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::visit_scopes (cyclomatic 52) compiler/rustc_resolve/src/ident.rs:54 — Resolver::visit_scopes has cyclomatic complexity 52 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Resolver::validate_res_from_ribs (cyclomatic 51) compiler/rustc_resolve/src/ident.rs:1476 — Resolver::validate_res_from_ribs has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::report_privacy_error (cyclomatic 46) compiler/rustc_resolve/src/diagnostics/impls.rs:2683 — Resolver::report_privacy_error has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::resolve_ident_in_scope (cyclomatic 44) compiler/rustc_resolve/src/ident.rs:545 — Resolver::resolve_ident_in_scope has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Resolver::lookup_import_candidates_from_module (cyclomatic 42) compiler/rustc_resolve/src/diagnostics/impls.rs:1669 — Resolver::lookup_import_candidates_from_module has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::report_path_resolution_error (cyclomatic 42) compiler/rustc_resolve/src/diagnostics/impls.rs:3086 — Resolver::report_path_resolution_error has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::resolve_path_in_value_ns_with_prefix_info (cyclomatic 41) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:353 — Resolver::resolve_path_in_value_ns_with_prefix_info has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::check_unused (cyclomatic 36) compiler/rustc_resolve/src/check_unused.rs:425 — Resolver::check_unused has cyclomatic complexity 36 (threshold 15). Of this number, 32 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::unresolved_macro_suggestions (cyclomatic 35) compiler/rustc_resolve/src/diagnostics/impls.rs:2019 — Resolver::unresolved_macro_suggestions has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::report_conflict (cyclomatic 34) compiler/rustc_resolve/src/diagnostics/impls.rs:430 — Resolver::report_conflict has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Resolver::maybe_push_ambiguity (cyclomatic 31) compiler/rustc_resolve/src/ident.rs:829 — Resolver::maybe_push_ambiguity has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Resolver::throw_unresolved_import_error (cyclomatic 30) compiler/rustc_resolve/src/diagnostics/impls.rs:145 — Resolver::throw_unresolved_import_error has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::smart_resolve_macro_path (cyclomatic 28) compiler/rustc_resolve/src/macros.rs:619 — Resolver::smart_resolve_macro_path has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::resolve_path_in_type_ns_with_prefix_info (cyclomatic 22) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:183 — Resolver::resolve_path_in_type_ns_with_prefix_info has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::finalize_macro_resolutions (cyclomatic 21) compiler/rustc_resolve/src/macros.rs:891 — Resolver::finalize_macro_resolutions has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Resolver::resolve_ident_in_module (cyclomatic 20) compiler/rustc_resolve/src/ident.rs:995 — Resolver::resolve_ident_in_module has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::add_scope_set_candidates (cyclomatic 18) compiler/rustc_resolve/src/diagnostics/impls.rs:1531 — Resolver::add_scope_set_candidates has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Resolver::ambiguity_diagnostic (cyclomatic 18) compiler/rustc_resolve/src/diagnostics/impls.rs:2453 — Resolver::ambiguity_diagnostic has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Resolver::check_for_module_export_macro (cyclomatic 18) compiler/rustc_resolve/src/diagnostics/impls.rs:3665 — Resolver::check_for_module_export_macro has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::resolve_ident_in_module_globs_unadjusted (cyclomatic 18) compiler/rustc_resolve/src/ident.rs:1220 — Resolver::resolve_ident_in_module_globs_unadjusted has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Resolver::single_import_can_define_name (cyclomatic 16) compiler/rustc_resolve/src/ident.rs:1406 — Resolver::single_import_can_define_name has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · ide_completion · ×23
  • ide_completion::context::analysis::classify_name_ref (cognitive 172) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:966 — ide_completion::context::analysis::classify_name_ref has cognitive complexity 172 (threshold 15). Drivers by points: if/else 48 (80 pts), match/switch 32 (67 pts), boolean chains 16, loops 2 (9 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::expr::complete_expr_path (cognitive 127) src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs:47 — ide_completion::completions::expr::complete_expr_path has cognitive complexity 127 (threshold 15). Drivers by points: if/else 37 (83 pts), match/switch 13 (32 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::context::analysis::expected_type_and_name (cognitive 63) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:590 — ide_completion::context::analysis::expected_type_and_name has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 11 (23 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::postfix::complete_postfix (cognitive 61) src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs:33 — ide_completion::completions::postfix::complete_postfix has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (36 pts), match/switch 10 (15 pts), boolean chains 10 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::context::analysis::expand (cognitive 58) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:172 — ide_completion::context::analysis::expand has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (45 pts), match/switch 4 (6 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ide_completion::completions::type::complete_type_path (cognitive 50) src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs:12 — ide_completion::completions::type::complete_type_path has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 8 (16 pts), loops 2 (6 pts) (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::completions::use_::complete_use_path (cognitive 42) src/tools/rust-analyzer/crates/ide-completion/src/completions/use_.rs:13 — ide_completion::completions::use_::complete_use_path has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 4 (9 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::completions::item_list::add_keywords (cognitive 36) src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs:75 — ide_completion::completions::item_list::add_keywords has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::render::function::add_call_parens (cognitive 35) src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs:213 — ide_completion::render::function::add_call_parens has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (12 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::context::analysis::analyze (cognitive 33) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:442 — ide_completion::context::analysis::analyze has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 8, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::attribute::complete_attribute_path (cognitive 28) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs:70 — ide_completion::completions::attribute::complete_attribute_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 4 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ide_completion::completions::pattern::complete_pattern_path (cognitive 27) src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs:129 — ide_completion::completions::pattern::complete_pattern_path has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 3 (9 pts), loops 1 (3 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::completions::pattern::complete_pattern (cognitive 22) src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs:13 — ide_completion::completions::pattern::complete_pattern has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (8 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::item_list::trait_impl::get_transformed_fn (cognitive 21) src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list/trait_impl.rs:321 — ide_completion::completions::item_list::trait_impl::get_transformed_fn has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::render::function::render (cognitive 19) src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs:50 — ide_completion::render::function::render has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ide_completion::completions::attribute::cfg::complete_cfg (cognitive 18) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs:12 — ide_completion::completions::attribute::cfg::complete_cfg has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::mod_::complete_mod (cognitive 18) src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs:15 — ide_completion::completions::mod_::complete_mod has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::attribute::derive::complete_derive_path (cognitive 17) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/derive.rs:13 — ide_completion::completions::attribute::derive::complete_derive_path has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::completions::postfix::format_like::add_format_like_completions (cognitive 17) src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix/format_like.rs:44 — ide_completion::completions::postfix::format_like::add_format_like_completions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::expr::complete_expr (cognitive 16) src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs:459 — ide_completion::completions::expr::complete_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::completions::fn_param::fill_fn_params (cognitive 16) src/tools/rust-analyzer/crates/ide-completion/src/completions/fn_param.rs:80 — ide_completion::completions::fn_param::fill_fn_params has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_completion::completions::item_list::trait_impl::add_type_alias_impl (cognitive 16) src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list/trait_impl.rs:403 — ide_completion::completions::item_list::trait_impl::add_type_alias_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_completion::render::render_resolution_path (cognitive 16) src/tools/rust-analyzer/crates/ide-completion/src/render.rs:408 — ide_completion::render::render_resolution_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalContextExt · ×23
  • EvalContextExt::open (cognitive 64) src/tools/miri/src/shims/unix/fs.rs:455 — EvalContextExt::open has cognitive complexity 64 (threshold 15). Drivers by points: if/else 39 (56 pts), match/switch 4 (5 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::CreateFileW (cognitive 54) src/tools/miri/src/shims/windows/fs.rs:109 — EvalContextExt::CreateFileW has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (42 pts), boolean chains 7, match/switch 2 (4 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::emulate_foreign_item_inner (cognitive 51) src/tools/miri/src/shims/windows/foreign_items.rs:131 — EvalContextExt::emulate_foreign_item_inner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (36 pts), match/switch 8 (13 pts), boolean chains 2 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_x86_sse42_intrinsic (cognitive 40) src/tools/miri/src/intrinsics/x86/sse42.rs:277 — EvalContextExt::emulate_x86_sse42_intrinsic has cognitive complexity 40 (threshold 15). Drivers by points: if/else 20 (31 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::_umtx_op (cognitive 37) src/tools/miri/src/shims/unix/freebsd/sync.rs:37 — EvalContextExt::_umtx_op has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (34 pts), boolean chains 2, match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_aarch64_intrinsic (cognitive 34) src/tools/miri/src/intrinsics/aarch64.rs:9 — EvalContextExt::emulate_aarch64_intrinsic has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (10 pts), match/switch 3 (5 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_foreign_item_inner (cognitive 28) src/tools/miri/src/shims/unix/foreign_items.rs:111 — EvalContextExt::emulate_foreign_item_inner has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::epoll_ctl (cognitive 28) src/tools/miri/src/shims/unix/linux_like/epoll.rs:78 — EvalContextExt::epoll_ctl has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::set_generic_socket_option (cognitive 24) src/tools/miri/src/shims/unix/socket.rs:876 — EvalContextExt::set_generic_socket_option has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::emulate_x86_bmi_intrinsic (cognitive 23) src/tools/miri/src/intrinsics/x86/bmi.rs:8 — EvalContextExt::emulate_x86_bmi_intrinsic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • EvalContextExt::emulate_math_intrinsic (cognitive 22) src/tools/miri/src/intrinsics/math.rs:92 — EvalContextExt::emulate_math_intrinsic has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 5 (10 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_simd_intrinsic (cognitive 22) src/tools/miri/src/intrinsics/simd.rs:13 — EvalContextExt::emulate_simd_intrinsic has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 2 (6 pts), loops 3 (6 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::host_error_to_errnum (cognitive 22) src/tools/miri/src/shims/io_error.rs:346 — EvalContextExt::host_error_to_errnum has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::lookup_exported_symbol (cognitive 20) src/tools/miri/src/shims/foreign_items.rs:114 — EvalContextExt::lookup_exported_symbol has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::fcntl (cognitive 20) src/tools/miri/src/shims/unix/fd.rs:228 — EvalContextExt::fcntl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::convert_path (cognitive 19) src/tools/miri/src/shims/os_str.rs:263 — EvalContextExt::convert_path has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 3). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (unix_to_windows, windows_to_unix). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • EvalContextExt::emulate_foreign_item_inner (cognitive 19) src/tools/miri/src/shims/unix/freebsd/foreign_items.rs:16 — EvalContextExt::emulate_foreign_item_inner has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::get_generic_socket_option (cognitive 19) src/tools/miri/src/shims/unix/socket.rs:1053 — EvalContextExt::get_generic_socket_option has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • EvalContextExt::try_errnum_to_io_error (cognitive 18) src/tools/miri/src/shims/io_error.rs:387 — EvalContextExt::try_errnum_to_io_error has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExt::emulate_x86_avx_intrinsic (cognitive 17) src/tools/miri/src/intrinsics/x86/avx.rs:12 — EvalContextExt::emulate_x86_avx_intrinsic has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_x86_sse2_intrinsic (cognitive 17) src/tools/miri/src/intrinsics/x86/sse2.rs:12 — EvalContextExt::emulate_x86_sse2_intrinsic has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::call_llvm_intrinsic (cognitive 16) src/tools/miri/src/intrinsics/mod.rs:153 — EvalContextExt::call_llvm_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalContextExt::emulate_x86_sse41_intrinsic (cognitive 16) src/tools/miri/src/intrinsics/x86/sse41.rs:8 — EvalContextExt::emulate_x86_sse41_intrinsic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D1 · Cyclomatic Complexity · TypeErrCtxt · ×22
  • TypeErrCtxt::report_selection_error (cyclomatic 90) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:92 — TypeErrCtxt::report_selection_error has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::note_and_explain_type_err (cyclomatic 81) compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs:20 — TypeErrCtxt::note_and_explain_type_err has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::note_type_err (cyclomatic 76) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1461 — TypeErrCtxt::note_type_err has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::report_similar_impl_candidates (cyclomatic 71) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2199 — TypeErrCtxt::report_similar_impl_candidates has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::maybe_report_ambiguity (cyclomatic 63) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:206 — TypeErrCtxt::maybe_report_ambiguity has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::note_error_origin (cyclomatic 43) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:325 — TypeErrCtxt::note_error_origin has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::report_fulfillment_errors (cyclomatic 38) compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:141 — TypeErrCtxt::report_fulfillment_errors has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::construct_generic_bound_failure (cyclomatic 36) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:717 — TypeErrCtxt::construct_generic_bound_failure has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeErrCtxt::cmp (cyclomatic 30) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1127 — TypeErrCtxt::cmp has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::try_conversion_context (cyclomatic 29) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1210 — TypeErrCtxt::try_conversion_context has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::cmp_fn_sig (cyclomatic 25) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:752 — TypeErrCtxt::cmp_fn_sig has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::report_concrete_failure (cyclomatic 25) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:313 — TypeErrCtxt::report_concrete_failure has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • TypeErrCtxt::compare_generics (cyclomatic 23) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:978 — TypeErrCtxt::compare_generics has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::report_projection_error (cyclomatic 22) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1716 — TypeErrCtxt::report_projection_error has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: TypeErrCtxt::fuzzy_match_tys::type_category (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • TypeErrCtxt::consider_returning_binding_diag (cyclomatic 20) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:912 — TypeErrCtxt::consider_returning_binding_diag has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::emit_specialized_closure_kind_error (cyclomatic 20) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1036 — TypeErrCtxt::emit_specialized_closure_kind_error has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: TypeErrCtxt::fuzzy_match_tys::type_category (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • TypeErrCtxt::suggest_function_pointers_impl (cyclomatic 19) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:462 — TypeErrCtxt::suggest_function_pointers_impl has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::type_error_additional_suggestions (cyclomatic 18) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:1983 — TypeErrCtxt::type_error_additional_suggestions has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeErrCtxt::annotate_source_of_ambiguity (cyclomatic 18) compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:822 — TypeErrCtxt::annotate_source_of_ambiguity has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • TypeErrCtxt::report_host_effect_error (cyclomatic 17) compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:917 — TypeErrCtxt::report_host_effect_error has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: TypeErrCtxt::fuzzy_match_tys::type_category (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • TypeErrCtxt::suggest_await_on_expect_found (cyclomatic 16) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:165 — TypeErrCtxt::suggest_await_on_expect_found has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeErrCtxt::suggest_for_all_lifetime_closure (cyclomatic 16) compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs:720 — TypeErrCtxt::suggest_for_all_lifetime_closure has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · libm · ×21
  • libm::math::pow::pow (cyclomatic 58) library/compiler-builtins/libm/src/math/pow.rs:94 — libm::math::pow::pow has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::powf::powf (cyclomatic 45) library/compiler-builtins/libm/src/math/powf.rs:50 — libm::math::powf::powf has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::rem_pio2_large::rem_pio2_large (cyclomatic 44) library/compiler-builtins/libm/src/math/rem_pio2_large.rs:227 — libm::math::rem_pio2_large::rem_pio2_large has cyclomatic complexity 44 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • libm::math::lgamma_r::lgamma_r (cyclomatic 28) library/compiler-builtins/libm/src/math/lgamma_r.rs:171 — libm::math::lgamma_r::lgamma_r has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::lgammaf_r::lgammaf_r (cyclomatic 27) library/compiler-builtins/libm/src/math/lgammaf_r.rs:106 — libm::math::lgammaf_r::lgammaf_r has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::atan2::atan2 (cyclomatic 25) library/compiler-builtins/libm/src/math/atan2.rs:51 — libm::math::atan2::atan2 has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • libm::math::atan2f::atan2f (cyclomatic 25) library/compiler-builtins/libm/src/math/atan2f.rs:27 — libm::math::atan2f::atan2f has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • libm::math::generic::fma::fma_round (cyclomatic 24) library/compiler-builtins/libm/src/math/generic/fma.rs:11 — libm::math::generic::fma::fma_round has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::jn::jn (cyclomatic 24) library/compiler-builtins/libm/src/math/jn.rs:43 — libm::math::jn::jn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::remquo::remquo (cyclomatic 24) library/compiler-builtins/libm/src/math/remquo.rs:2 — libm::math::remquo::remquo has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • libm::math::remquof::remquof (cyclomatic 24) library/compiler-builtins/libm/src/math/remquof.rs:2 — libm::math::remquof::remquof has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • libm::math::jnf::jnf (cyclomatic 20) library/compiler-builtins/libm/src/math/jnf.rs:20 — libm::math::jnf::jnf has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::rem_pio2::rem_pio2 (cyclomatic 20) library/compiler-builtins/libm/src/math/rem_pio2.rs:45 — libm::math::rem_pio2::rem_pio2 has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::exp2m1f::cr_exp2m1f (cyclomatic 19) library/compiler-builtins/libm/src/math/exp2m1f.rs:18 — libm::math::exp2m1f::cr_exp2m1f has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::expm1::expm1 (cyclomatic 18) library/compiler-builtins/libm/src/math/expm1.rs:32 — libm::math::expm1::expm1 has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::expm1f::expm1f (cyclomatic 18) library/compiler-builtins/libm/src/math/expm1f.rs:35 — libm::math::expm1f::expm1f has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::sincosf::sincosf (cyclomatic 18) library/compiler-builtins/libm/src/math/sincosf.rs:30 — libm::math::sincosf::sincosf has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::cbrt::cbrt_round (cyclomatic 17) library/compiler-builtins/libm/src/math/cbrt.rs:16 — libm::math::cbrt::cbrt_round has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::math::exp2m1::cr_exp2m1 (cyclomatic 17) library/compiler-builtins/libm/src/math/exp2m1.rs:22 — libm::math::exp2m1::cr_exp2m1 has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm::configure::emit (cyclomatic 16) library/compiler-builtins/libm/configure.rs:104 — libm::configure::emit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • libm::math::jn::yn (cyclomatic 16) library/compiler-builtins/libm/src/math/jn.rs:253 — libm::math::jn::yn has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rustc_codegen_cranelift · ×21
  • rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call (cognitive 176) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:21 — rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call has cognitive complexity 176 (threshold 15). Drivers by points: if/else 54 (101 pts), match/switch 24 (44 pts), loops 14 (28 pts), boolean chains 3 (nesting depth added 81). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call (cognitive 100) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:386 — rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call has cognitive complexity 100 (threshold 15). Drivers by points: if/else 36 (61 pts), match/switch 24 (38 pts), boolean chains 1 (nesting depth added 39). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::base::codegen_fn_body (cognitive 92) compiler/rustc_codegen_cranelift/src/base.rs:286 — rustc_codegen_cranelift::base::codegen_fn_body has cognitive complexity 92 (threshold 15). Drivers by points: if/else 27 (69 pts), loops 4 (11 pts), match/switch 3 (9 pts), boolean chains 3 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::base::codegen_stmt (cognitive 75) compiler/rustc_codegen_cranelift/src/base.rs:610 — rustc_codegen_cranelift::base::codegen_stmt has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (42 pts), match/switch 11 (30 pts), loops 1 (3 pts) (nesting depth added 44). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call (cognitive 68) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:10 — rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 11 (24 pts), match/switch 9 (18 pts) (nesting depth added 32). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::constant::mir_operand_get_const_val (cognitive 50) compiler/rustc_codegen_cranelift/src/constant.rs:499 — rustc_codegen_cranelift::constant::mir_operand_get_const_val has cognitive complexity 50 (threshold 15). Drivers by points: match/switch 7 (31 pts), if/else 3 (14 pts), loops 2 (5 pts) (nesting depth added 38). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::global_asm::codegen_global_asm_inner (cognitive 45) compiler/rustc_codegen_cranelift/src/global_asm.rs:91 — rustc_codegen_cranelift::global_asm::codegen_global_asm_inner has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 4 (14 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::abi::codegen_fn_prelude (cognitive 40) compiler/rustc_codegen_cranelift/src/abi/mod.rs:259 — rustc_codegen_cranelift::abi::codegen_fn_prelude has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 4 (7 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::abi::codegen_terminator_call (cognitive 40) compiler/rustc_codegen_cranelift/src/abi/mod.rs:426 — rustc_codegen_cranelift::abi::codegen_terminator_call has cognitive complexity 40 (threshold 15). Drivers by points: if/else 33 (47 pts), match/switch 6 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rustc_codegen_cranelift::abi::codegen_terminator_call::adjust_call_for_c_variadic) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_codegen_cranelift::constant::codegen_const_value (cognitive 38) compiler/rustc_codegen_cranelift/src/constant.rs:98 — rustc_codegen_cranelift::constant::codegen_const_value has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 4 (10 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::cast::clif_int_or_float_cast (cognitive 36) compiler/rustc_codegen_cranelift/src/cast.rs:31 — rustc_codegen_cranelift::cast::clif_int_or_float_cast has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 7, match/switch 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::scripts::filter_profile::main (cognitive 35) compiler/rustc_codegen_cranelift/scripts/filter_profile.rs:20 — rustc_codegen_cranelift::scripts::filter_profile::main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::inline_asm::codegen_inline_asm_terminator (cognitive 30) compiler/rustc_codegen_cranelift/src/inline_asm.rs:42 — rustc_codegen_cranelift::inline_asm::codegen_inline_asm_terminator has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::codegen_f16_f128::codegen_cast (cognitive 29) compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs:163 — rustc_codegen_cranelift::codegen_f16_f128::codegen_cast has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call (cognitive 27) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:10 — rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 8 (15 pts), loops 5 (10 pts), boolean chains 2 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_cranelift::value_and_place::assert_assignable (cognitive 26) compiler/rustc_codegen_cranelift/src/value_and_place.rs:844 — rustc_codegen_cranelift::value_and_place::assert_assignable has cognitive complexity 26 (threshold 15). Drivers by points: loops 7 (14 pts), match/switch 7 (11 pts), if/else 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rustc_codegen_cranelift::abi::codegen_terminator_call::adjust_call_for_c_variadic (cognitive 22) compiler/rustc_codegen_cranelift/src/abi/mod.rs:643 — rustc_codegen_cranelift::abi::codegen_terminator_call::adjust_call_for_c_variadic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rustc_codegen_cranelift::abi::codegen_terminator_call) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_codegen_cranelift::discriminant::codegen_get_discriminant (cognitive 22) compiler/rustc_codegen_cranelift/src/discriminant.rs:76 — rustc_codegen_cranelift::discriminant::codegen_get_discriminant has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 7 (10 pts) (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • rustc_codegen_cranelift::build_isa (cognitive 19) compiler/rustc_codegen_cranelift/src/lib.rs:272 — rustc_codegen_cranelift::build_isa has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (15 pts), match/switch 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_cranelift::constant::define_all_allocs (cognitive 19) compiler/rustc_codegen_cranelift/src/constant.rs:370 — rustc_codegen_cranelift::constant::define_all_allocs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_cranelift::abi::codegen_call_with_unwind_action (cognitive 16) compiler/rustc_codegen_cranelift/src/abi/mod.rs:843 — rustc_codegen_cranelift::abi::codegen_call_with_unwind_action has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 5 (8 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InferenceContext · ×21
  • InferenceContext::infer_expr_inner (cognitive 96) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:317 — InferenceContext::infer_expr_inner has cognitive complexity 96 (threshold 15). Drivers by points: if/else 27 (50 pts), match/switch 15 (33 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::resolve_variant (cognitive 79) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2248 — InferenceContext::resolve_variant has cognitive complexity 79 (threshold 15). Drivers by points: if/else 28 (60 pts), match/switch 7 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 39). Of this number, 77 points are the body's own statements and 2 belong to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • InferenceContext::check_record_expr_fields (cognitive 57) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:968 — InferenceContext::check_record_expr_fields has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 3 (7 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::check_call_arguments (cognitive 48) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1920 — InferenceContext::check_call_arguments has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 5 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::try_find_coercion_lub (cognitive 40) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:926 — InferenceContext::try_find_coercion_lub has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (20 pts), match/switch 6 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • InferenceContext::analyze_closure (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:229 — InferenceContext::analyze_closure has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 3 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::infer_ref_pat (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1356 — InferenceContext::infer_ref_pat has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::infer_mut_expr_without_adjust (cognitive 38) src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs:55 — InferenceContext::infer_mut_expr_without_adjust has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 4 (8 pts), loops 2 (4 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • InferenceContext::compute_min_captures (cognitive 31) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:724 — InferenceContext::compute_min_captures has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 5 (11 pts), loops 4 (7 pts) (nesting depth added 17). Of this number, 29 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::deduce_closure_signature_from_predicates (cognitive 30) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure.rs:421 — InferenceContext::deduce_closure_signature_from_predicates has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::resolve_value_path_inner (cognitive 26) src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs:146 — InferenceContext::resolve_value_path_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (13 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::resolve_all (cognitive 26) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:1635 — InferenceContext::resolve_all has cognitive complexity 26 (threshold 15). Drivers by points: loops 15 (25 pts), if/else 1 (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • InferenceContext::infer_pat_inner (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:377 — InferenceContext::infer_pat_inner has cognitive complexity 25 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 4 (7 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::infer_mut_expr (cognitive 24) src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs:21 — InferenceContext::infer_mut_expr has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 3 (12 pts), if/else 3 (10 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • InferenceContext::compute_definition_site_hidden_types (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/opaques.rs:67 — InferenceContext::compute_definition_site_hidden_types has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::calculate_diverging_fallback (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs:233 — InferenceContext::calculate_diverging_fallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 5 (8 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::check_record_pat_fields (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1154 — InferenceContext::check_record_pat_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::struct_tail_with_normalize (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2053 — InferenceContext::struct_tail_with_normalize has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 3 (6 pts), loops 1 (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • InferenceContext::infer_method_call (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1773 — InferenceContext::infer_method_call has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (5 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • InferenceContext::infer_tuple_struct_pat (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1046 — InferenceContext::infer_tuple_struct_pat has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 4 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceContext::try_index_step (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/infer/place_op.rs:106 — InferenceContext::try_index_step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · core · ×21
  • core::str::validations::run_utf8_validation (cognitive 55) library/core/src/str/validations.rs:126 — core::str::validations::run_utf8_validation has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 3 (11 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::dec2flt::decimal_seq::parse_decimal_seq (cognitive 42) library/core/src/num/imp/dec2flt/decimal_seq.rs:222 — core::num::imp::dec2flt::decimal_seq::parse_decimal_seq has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • core::num::imp::flt2dec::strategy::dragon::format_exact (cognitive 40) library/core/src/num/imp/flt2dec/strategy/dragon.rs:296 — core::num::imp::flt2dec::strategy::dragon::format_exact has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::flt2dec::strategy::grisu::max_pow10_no_more_than (cognitive 29) library/core/src/num/imp/flt2dec/strategy/grisu.rs:134 — core::num::imp::flt2dec::strategy::grisu::max_pow10_no_more_than has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (29 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::fmt::num::exp_u128 (cognitive 27) library/core/src/fmt/num.rs:620 — core::fmt::num::exp_u128 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (6 pts), boolean chains 3, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u32, core::fmt::num::imp::exp_u64) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u64 (cognitive 27) library/core/src/fmt/num.rs:607 — core::fmt::num::imp::exp_u64 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (6 pts), boolean chains 3, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u32, core::fmt::num::imp::exp_u64, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u32 (cognitive 27) library/core/src/fmt/num.rs:617 — core::fmt::num::imp::exp_u32 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (6 pts), boolean chains 3, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u64, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u64 (cognitive 27) library/core/src/fmt/num.rs:618 — core::fmt::num::imp::exp_u64 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (6 pts), boolean chains 3, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u32, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::write (cognitive 26) library/core/src/fmt/mod.rs:1631 — core::fmt::write has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::flt2dec::strategy::grisu::format_exact_opt (cognitive 26) library/core/src/num/imp/flt2dec/strategy/grisu.rs:473 — core::num::imp::flt2dec::strategy::grisu::format_exact_opt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, loops 2 (nesting depth added 6). Of this number, 14 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::dec2flt::slow::parse_long_mantissa (cognitive 25) library/core/src/num/imp/dec2flt/slow.rs:27 — core::num::imp::dec2flt::slow::parse_long_mantissa has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 3, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::str::pattern::simd_contains (cognitive 23) library/core/src/str/pattern.rs:1894 — core::str::pattern::simd_contains has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::slice::rotate::ptr_rotate_gcd (cognitive 21) library/core/src/slice/rotate.rs:121 — core::slice::rotate::ptr_rotate_gcd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::slice::rotate::ptr_rotate_swap (cognitive 21) library/core/src/slice/rotate.rs:230 — core::slice::rotate::ptr_rotate_swap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::slice::sort::select::partition_at_index_loop (cognitive 21) library/core/src/slice/sort/select.rs:66 — core::slice::sort::select::partition_at_index_loop has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::flt2dec::digits_to_dec_str (cognitive 17) library/core/src/num/imp/flt2dec/mod.rs:177 — core::num::imp::flt2dec::digits_to_dec_str has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::flt2dec::strategy::dragon::format_shortest (cognitive 17) library/core/src/num/imp/flt2dec/strategy/dragon.rs:136 — core::num::imp::flt2dec::strategy::dragon::format_shortest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • core::num::imp::flt2dec::strategy::grisu::format_shortest_opt (cognitive 17) library/core/src/num/imp/flt2dec/strategy/grisu.rs:167 — core::num::imp::flt2dec::strategy::grisu::format_shortest_opt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 3 (nesting depth added 3). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (round_and_weed). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • core::slice::sort::unstable::quicksort::partition_hoare_branchy_cyclic (cognitive 17) library/core/src/slice/sort/unstable/quicksort.rs:154 — core::slice::sort::unstable::quicksort::partition_hoare_branchy_cyclic has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • core::num::imp::dec2flt::parse::parse_partial_number (cognitive 16) library/core/src/num/imp/dec2flt/parse.rs:104 — core::num::imp::dec2flt::parse::parse_partial_number has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • core::ptr::align_offset (cognitive 16) library/core/src/ptr/mod.rs:2287 — core::ptr::align_offset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_target · ×21
  • rustc_target::callconv::mips64::classify_arg (cognitive 54) compiler/rustc_target/src/callconv/mips64.rs:107 — rustc_target::callconv::mips64::classify_arg has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (39 pts), loops 2 (10 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_target::callconv::x86_64::compute_abi_info (cognitive 35) compiler/rustc_target/src/callconv/x86_64.rs:177 — rustc_target::callconv::x86_64::compute_abi_info has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • rustc_target::callconv::loongarch::should_use_fp_conv_helper (cognitive 33) compiler/rustc_target/src/callconv/loongarch.rs:33 — rustc_target::callconv::loongarch::should_use_fp_conv_helper has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 4 (13 pts), loops 2 (6 pts) (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_target::callconv::riscv::should_use_fp_conv_helper (cognitive 33) compiler/rustc_target/src/callconv/riscv.rs:39 — rustc_target::callconv::riscv::should_use_fp_conv_helper has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 4 (13 pts), loops 2 (6 pts) (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_target::callconv::sparc64::classify (cognitive 32) compiler/rustc_target/src/callconv/sparc64.rs:27 — rustc_target::callconv::sparc64::classify has cognitive complexity 32 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 4 (11 pts), loops 1 (4 pts) (nesting depth added 21). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_target::callconv::loongarch::classify_arg (cognitive 30) compiler/rustc_target/src/callconv/loongarch.rs:278 — rustc_target::callconv::loongarch::classify_arg has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::riscv::classify_arg (cognitive 30) compiler/rustc_target/src/callconv/riscv.rs:283 — rustc_target::callconv::riscv::classify_arg has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::x86_win32::compute_abi_info (cognitive 26) compiler/rustc_target/src/callconv/x86_win32.rs:6 — rustc_target::callconv::x86_win32::compute_abi_info has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, match/switch 1 (4 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::x86_win64::compute_abi_info (cognitive 24) compiler/rustc_target/src/callconv/x86_win64.rs:8 — rustc_target::callconv::x86_win64::compute_abi_info has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::powerpc64::classify (cognitive 21) compiler/rustc_target/src/callconv/powerpc64.rs:91 — rustc_target::callconv::powerpc64::classify has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_target::callconv::xtensa::classify_arg_ty (cognitive 21) compiler/rustc_target/src/callconv/xtensa.rs:40 — rustc_target::callconv::xtensa::classify_arg_ty has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_target::callconv::s390x::classify_arg (cognitive 20) compiler/rustc_target/src/callconv/s390x.rs:55 — rustc_target::callconv::s390x::classify_arg has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_target::callconv::x86::classify_ret (cognitive 20) compiler/rustc_target/src/callconv/x86.rs:53 — rustc_target::callconv::x86::classify_ret has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::mips64::classify_ret (cognitive 19) compiler/rustc_target/src/callconv/mips64.rs:48 — rustc_target::callconv::mips64::classify_ret has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::x86_64::classify_arg (cognitive 19) compiler/rustc_target/src/callconv/x86_64.rs:29 — rustc_target::callconv::x86_64::classify_arg has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 5 (12 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: one other method here (rustc_target::callconv::x86_64::classify_arg::classify) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_target::callconv::sparc64::classify_arg (cognitive 18) compiler/rustc_target/src/callconv/sparc64.rs:105 — rustc_target::callconv::sparc64::classify_arg has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (7 pts), if/else 5 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::callconv::x86::fill_inregs (cognitive 18) compiler/rustc_target/src/callconv/x86.rs:188 — rustc_target::callconv::x86::fill_inregs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_target::asm::amdgpu::fill_reg_map (cognitive 17) compiler/rustc_target/src/asm/amdgpu.rs:377 — rustc_target::asm::amdgpu::fill_reg_map has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 4 (8 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rustc_target::callconv::x86::classify_arg (cognitive 16) compiler/rustc_target/src/callconv/x86.rs:101 — rustc_target::callconv::x86::classify_arg has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (contains_vector). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_target::callconv::x86_64::classify_arg::classify (cognitive 16) compiler/rustc_target/src/callconv/x86_64.rs:37 — rustc_target::callconv::x86_64::classify_arg::classify has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (6 pts), if/else 3 (5 pts), match/switch 3 (5 pts) (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: one other method here (rustc_target::callconv::x86_64::classify_arg) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_target::target_features::feature_to_arch_names (cognitive 16) compiler/rustc_target/src/target_features.rs:1095 — rustc_target::target_features::feature_to_arch_names has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D3 · God Classes · TooManyFunctions · ×21
  • TooManyFunctions: core_arch::s390x::vector library/stdarch/crates/core_arch/src/s390x/vector.rs:442 — TooManyFunctions — 200 free functions. The bar is 30 free functions; this is 170 over it, 6.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::powerpc::altivec::sealed library/stdarch/crates/core_arch/src/powerpc/altivec.rs:459 — TooManyFunctions — 198 free functions. The bar is 30 free functions; this is 168 over it, 6.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::s390x::vector::sealed library/stdarch/crates/core_arch/src/s390x/vector.rs:862 — TooManyFunctions — 143 free functions. The bar is 30 free functions; this is 113 over it, 4.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: libm_test::builtins_wrapper library/compiler-builtins/libm-test/src/builtins_wrapper.rs:101 — TooManyFunctions — 141 free functions. The bar is 30 free functions; this is 111 over it, 4.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: musl_math_sys library/compiler-builtins/crates/musl-math-sys/src/lib.rs:150 — TooManyFunctions — 130 free functions. The bar is 30 free functions; this is 100 over it, 4.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::powerpc::altivec library/stdarch/crates/core_arch/src/powerpc/altivec.rs:3323 — TooManyFunctions — 110 free functions. The bar is 30 free functions; this is 80 over it, 3.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: rustfmt_nightly::utils src/tools/rustfmt/src/utils.rs:19 — TooManyFunctions — 55 free functions. The bar is 30 free functions; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::amdgpu library/stdarch/crates/core_arch/src/amdgpu/mod.rs:187 — TooManyFunctions — 53 free functions. The bar is 30 free functions; this is 23 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: rustc_codegen_llvm::llvm compiler/rustc_codegen_llvm/src/llvm/mod.rs:37 — TooManyFunctions — 49 free functions. The bar is 30 free functions; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::x86::avx512cd library/stdarch/crates/core_arch/src/x86/avx512cd.rs:15 — TooManyFunctions — 42 free functions. The bar is 30 free functions; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::riscv_shared library/stdarch/crates/core_arch/src/riscv_shared/mod.rs:46 — TooManyFunctions — 41 free functions. The bar is 30 free functions; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::x86::avx512bf16 library/stdarch/crates/core_arch/src/x86/avx512bf16.rs:41 — TooManyFunctions — 38 free functions. The bar is 30 free functions; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: bootstrap::utils::helpers src/bootstrap/src/utils/helpers.rs:72 — TooManyFunctions — 37 free functions. The bar is 30 free functions; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core::ptr library/core/src/ptr/mod.rs:549 — TooManyFunctions — 34 free functions. The bar is 30 free functions; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::loongarch64::lsx::portable library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs:10 — TooManyFunctions — 34 free functions. The bar is 30 free functions; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: rustc_incremental::persist::fs compiler/rustc_incremental/src/persist/fs.rs:134 — TooManyFunctions — 32 free functions. The bar is 30 free functions; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::x86::fma library/stdarch/crates/core_arch/src/x86/fma.rs:37 — TooManyFunctions — 32 free functions. The bar is 30 free functions; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: y::utils compiler/rustc_codegen_cranelift/build_system/utils.rs:162 — TooManyFunctions — 31 free functions, declared across 2 files: src/utils.rs (27), build_system/utils.rs (4). The bar is 30 free functions; this is 1 over it, 1.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core::intrinsics::mir library/core/src/intrinsics/mir.rs:333 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: core_arch::aarch64::neon library/stdarch/crates/core_arch/src/aarch64/neon/mod.rs:101 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: clippy_utils::source src/tools/clippy/clippy_utils/src/source.rs:240 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D2 · Cognitive Complexity · clippy_utils · ×20
  • clippy_utils::is_never_expr (cognitive 64) src/tools/clippy/clippy_utils/src/lib.rs:3002 — clippy_utils::is_never_expr has cognitive complexity 64 (threshold 15). Drivers by points: if/else 25 (44 pts), loops 4 (11 pts), boolean chains 5, match/switch 2 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::capture_local_usage (cognitive 33) src/tools/clippy/clippy_utils/src/lib.rs:830 — clippy_utils::capture_local_usage has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (18 pts), if/else 4 (8 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 19). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::mir::reachable_while_storage_live (cognitive 29) src/tools/clippy/clippy_utils/src/mir/mod.rs:70 — clippy_utils::mir::reachable_while_storage_live has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::paths::local_item_child_by_name (cognitive 28) src/tools/clippy/clippy_utils/src/paths.rs:287 — clippy_utils::paths::local_item_child_by_name has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::ast_utils::eq_expr (cognitive 27) src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:145 — clippy_utils::ast_utils::eq_expr has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 25, if/else 1, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • clippy_utils::is_default_equivalent_call (cognitive 26) src/tools/clippy/clippy_utils/src/lib.rs:571 — clippy_utils::is_default_equivalent_call has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, match/switch 1 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • clippy_utils::ty::type_certainty::path_segment_certainty (cognitive 25) src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs:218 — clippy_utils::ty::type_certainty::path_segment_certainty has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::eager_or_lazy::expr_eagerness (cognitive 24) src/tools/clippy/clippy_utils/src/eager_or_lazy.rs:117 — clippy_utils::eager_or_lazy::expr_eagerness has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, match/switch 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::ty::contains_ty_adt_constructor_opaque::contains_ty_adt_constructor_opaque_inner (cognitive 23) src/tools/clippy/clippy_utils/src/ty/mod.rs:95 — clippy_utils::ty::contains_ty_adt_constructor_opaque::contains_ty_adt_constructor_opaque_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::is_body_identity_function (cognitive 22) src/tools/clippy/clippy_utils/src/lib.rs:1794 — clippy_utils::is_body_identity_function has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::can_move_expr_to_closure (cognitive 21) src/tools/clippy/clippy_utils/src/lib.rs:925 — clippy_utils::can_move_expr_to_closure has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 3 (6 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::expr_use_sites (cognitive 20) src/tools/clippy/clippy_utils/src/lib.rs:2679 — clippy_utils::expr_use_sites has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::eager_or_lazy::fn_eagerness (cognitive 19) src/tools/clippy/clippy_utils/src/eager_or_lazy.rs:51 — clippy_utils::eager_or_lazy::fn_eagerness has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 3 (6 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • clippy_utils::qualify_min_const_fn::check_terminator (cognitive 18) src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs:334 — clippy_utils::qualify_min_const_fn::check_terminator has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 pts), loops 1 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::ty::type_certainty::expr_type_certainty (cognitive 18) src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs:32 — clippy_utils::ty::type_certainty::expr_type_certainty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::maybe_get_relative_path (cognitive 17) src/tools/clippy/clippy_utils/src/lib.rs:3298 — clippy_utils::maybe_get_relative_path has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_utils::ast_utils::eq_item_kind (cognitive 17) src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:308 — clippy_utils::ast_utils::eq_item_kind has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 14, match/switch 2 (3 pts) (nesting depth added 1). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::qualify_min_const_fn::check_ty (cognitive 17) src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs:76 — clippy_utils::qualify_min_const_fn::check_ty has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 1 (5 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • clippy_utils::visitors::for_each_unconsumed_temporary::helper (cognitive 17) src/tools/clippy/clippy_utils/src/visitors.rs:679 — clippy_utils::visitors::for_each_unconsumed_temporary::helper has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 3 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • clippy_utils::str_utils::camel_case_start_from_idx (cognitive 16) src/tools/clippy/clippy_utils/src/str_utils.rs:100 — clippy_utils::str_utils::camel_case_start_from_idx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · rustc_codegen_cranelift · ×19
  • rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call (cyclomatic 202) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:21 — rustc_codegen_cranelift::intrinsics::simd::codegen_simd_intrinsic_call has cyclomatic complexity 202 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call (cyclomatic 167) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:386 — rustc_codegen_cranelift::intrinsics::codegen_regular_intrinsic_call has cyclomatic complexity 167 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call (cyclomatic 101) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:10 — rustc_codegen_cranelift::intrinsics::llvm_x86::codegen_x86_llvm_intrinsic_call has cyclomatic complexity 101 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call (cyclomatic 82) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:10 — rustc_codegen_cranelift::intrinsics::llvm_aarch64::codegen_aarch64_llvm_intrinsic_call has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::base::codegen_stmt (cyclomatic 51) compiler/rustc_codegen_cranelift/src/base.rs:610 — rustc_codegen_cranelift::base::codegen_stmt has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::base::codegen_fn_body (cyclomatic 45) compiler/rustc_codegen_cranelift/src/base.rs:286 — rustc_codegen_cranelift::base::codegen_fn_body has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::abi::codegen_terminator_call (cyclomatic 37) compiler/rustc_codegen_cranelift/src/abi/mod.rs:426 — rustc_codegen_cranelift::abi::codegen_terminator_call has cyclomatic complexity 37 (threshold 15). Of this number, 26 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::value_and_place::assert_assignable (cyclomatic 31) compiler/rustc_codegen_cranelift/src/value_and_place.rs:844 — rustc_codegen_cranelift::value_and_place::assert_assignable has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::codegen_f16_f128::codegen_cast (cyclomatic 29) compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs:163 — rustc_codegen_cranelift::codegen_f16_f128::codegen_cast has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::cast::clif_int_or_float_cast (cyclomatic 26) compiler/rustc_codegen_cranelift/src/cast.rs:31 — rustc_codegen_cranelift::cast::clif_int_or_float_cast has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::common::clif_type_from_ty (cyclomatic 23) compiler/rustc_codegen_cranelift/src/common.rs:49 — rustc_codegen_cranelift::common::clif_type_from_ty has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::constant::mir_operand_get_const_val (cyclomatic 23) compiler/rustc_codegen_cranelift/src/constant.rs:499 — rustc_codegen_cranelift::constant::mir_operand_get_const_val has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::inline_asm::codegen_inline_asm_terminator (cyclomatic 23) compiler/rustc_codegen_cranelift/src/inline_asm.rs:42 — rustc_codegen_cranelift::inline_asm::codegen_inline_asm_terminator has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::scripts::filter_profile::main (cyclomatic 22) compiler/rustc_codegen_cranelift/scripts/filter_profile.rs:20 — rustc_codegen_cranelift::scripts::filter_profile::main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::constant::codegen_const_value (cyclomatic 21) compiler/rustc_codegen_cranelift/src/constant.rs:98 — rustc_codegen_cranelift::constant::codegen_const_value has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_cranelift::num::codegen_float_binop (cyclomatic 20) compiler/rustc_codegen_cranelift/src/num.rs:348 — rustc_codegen_cranelift::num::codegen_float_binop has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::num::codegen_int_binop (cyclomatic 18) compiler/rustc_codegen_cranelift/src/num.rs:136 — rustc_codegen_cranelift::num::codegen_int_binop has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_cranelift::build_isa (cyclomatic 17) compiler/rustc_codegen_cranelift/src/lib.rs:272 — rustc_codegen_cranelift::build_isa has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_codegen_cranelift::abi::codegen_fn_prelude (cyclomatic 17) compiler/rustc_codegen_cranelift/src/abi/mod.rs:259 — rustc_codegen_cranelift::abi::codegen_fn_prelude has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · bootstrap · ×19
  • bootstrap::core::sanity::check (cognitive 107) src/bootstrap/src/core/sanity.rs:82 — bootstrap::core::sanity::check has cognitive complexity 107 (threshold 15). Drivers by points: if/else 32 (68 pts), boolean chains 20, loops 5 (13 pts), match/switch 3 (6 pts) (nesting depth added 47). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • bootstrap::core::config::toml::rust::check_incompatible_options_for_ci_rustc (cognitive 74) src/bootstrap/src/core/config/toml/rust.rs:256 — bootstrap::core::config::toml::rust::check_incompatible_options_for_ci_rustc has cognitive complexity 74 (threshold 15). Drivers by points: if/else 44 (73 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::config::toml::llvm::check_incompatible_options_for_ci_llvm (cognitive 64) src/bootstrap/src/core/config/toml/llvm.rs:49 — bootstrap::core::config::toml::llvm::check_incompatible_options_for_ci_llvm has cognitive complexity 64 (threshold 15). Drivers by points: if/else 43 (64 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::build_steps::llvm::configure_cmake (cognitive 61) src/bootstrap/src/core/build_steps/llvm.rs:883 — bootstrap::core::build_steps::llvm::configure_cmake has cognitive complexity 61 (threshold 15). Drivers by points: if/else 43 (51 pts), boolean chains 7, loops 2, match/switch 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • bootstrap::bin::rustc::main (cognitive 59) src/bootstrap/src/bin/rustc.rs:31 — bootstrap::bin::rustc::main has cognitive complexity 59 (threshold 15). Drivers by points: if/else 31 (39 pts), boolean chains 10, loops 3 (6 pts), match/switch 3 (4 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • bootstrap::core::build_steps::format::format (cognitive 56) src/bootstrap/src/core/build_steps/format.rs:146 — bootstrap::core::build_steps::format::format has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 6 (13 pts), match/switch 4 (12 pts), boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::build_steps::compile::run_cargo (cognitive 38) src/bootstrap/src/core/build_steps/compile.rs:2676 — bootstrap::core::build_steps::compile::run_cargo has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 4 (8 pts), boolean chains 4, loops 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::utils::cc_detect::default_compiler (cognitive 30) src/bootstrap/src/utils/cc_detect.rs:169 — bootstrap::utils::cc_detect::default_compiler has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • bootstrap::core::build_steps::dist::maybe_install_llvm (cognitive 26) src/bootstrap/src/core/build_steps/dist.rs:2508 — bootstrap::core::build_steps::dist::maybe_install_llvm has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::build_steps::compile::copy_self_contained_objects (cognitive 24) src/bootstrap/src/core/build_steps/compile.rs:376 — bootstrap::core::build_steps::compile::copy_self_contained_objects has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • bootstrap::core::build_steps::compile::std_cargo (cognitive 24) src/bootstrap/src/core/build_steps/compile.rs:521 — bootstrap::core::build_steps::compile::std_cargo has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run (cognitive 24) src/bootstrap/src/core/builder/cli_paths.rs:21 — bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 6 (8 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::build_steps::compile::rustc_cargo_env (cognitive 23) src/bootstrap/src/core/build_steps/compile.rs:1315 — bootstrap::core::build_steps::compile::rustc_cargo_env has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • bootstrap::cli_main::main (cognitive 22) src/bootstrap/src/cli_main.rs:30 — bootstrap::cli_main::main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::core::build_steps::tool::prepare_tool_cargo (cognitive 20) src/bootstrap/src/core/build_steps/tool.rs:198 — bootstrap::core::build_steps::tool::prepare_tool_cargo has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • bootstrap::core::build_steps::compile::rustc_llvm_env (cognitive 19) src/bootstrap/src/core/build_steps/compile.rs:1437 — bootstrap::core::build_steps::compile::rustc_llvm_env has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • bootstrap::core::download::unpack (cognitive 19) src/bootstrap/src/core/download.rs:935 — bootstrap::core::download::unpack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::download::download_component (cognitive 18) src/bootstrap/src/core/download.rs:798 — bootstrap::core::download::download_component has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • bootstrap::core::build_steps::dist::copy_src_dirs::filter_fn (cognitive 16) src/bootstrap/src/core/build_steps/dist.rs:1091 — bootstrap::core::build_steps::dist::copy_src_dirs::filter_fn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ide_db · ×19
  • ide_db::syntax_helpers::format_string::lex_format_specifiers (cognitive 101) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string.rs:45 — ide_db::syntax_helpers::format_string::lex_format_specifiers has cognitive complexity 101 (threshold 15). Drivers by points: if/else 18 (62 pts), match/switch 7 (29 pts), boolean chains 7, loops 3 (nesting depth added 66). Of this number, 92 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ide_db::imports::insert_use::guess_granularity_from_scope (cognitive 41) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:340 — ide_db::imports::insert_use::guess_granularity_from_scope has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 6, match/switch 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::rename::source_edit_from_def (cognitive 41) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:673 — ide_db::rename::source_edit_from_def has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ide_db::prime_caches::parallel_prime_caches (cognitive 40) src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs:31 — ide_db::prime_caches::parallel_prime_caches has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 8 (14 pts), match/switch 6 (8 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::traits::diff_assoc_items (cognitive 33) src/tools/rust-analyzer/crates/ide-db/src/traits.rs:56 — ide_db::traits::diff_assoc_items has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cognitive 30) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44 — ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::imports::merge_imports::recursive_normalize (cognitive 29) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:292 — ide_db::imports::merge_imports::recursive_normalize has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::imports::merge_imports::version_sort::version_sort (cognitive 28) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:978 — ide_db::imports::merge_imports::version_sort::version_sort has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_db::syntax_helpers::node_ext::walk_patterns_in_expr (cognitive 25) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs:116 — ide_db::syntax_helpers::node_ext::walk_patterns_in_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::rename::source_edit_from_name_ref (cognitive 24) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:578 — ide_db::rename::source_edit_from_name_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::imports::merge_imports::recursive_merge (cognitive 23) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:120 — ide_db::imports::merge_imports::recursive_merge has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::symbol_index::resolve_path_to_modules (cognitive 23) src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs:290 — ide_db::symbol_index::resolve_path_to_modules has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::syntax_helpers::tree_diff::diff::go (cognitive 23) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/tree_diff.rs:79 — ide_db::syntax_helpers::tree_diff::diff::go has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (6 pts), loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::imports::insert_use::insert_use_with_editor_ (cognitive 22) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:425 — ide_db::imports::insert_use::insert_use_with_editor_ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker (cognitive 21) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs:69 — ide_db::syntax_helpers::node_ext::preorder_expr_with_ctx_checker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cognitive 19) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:214 — ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_db::rust_doc::format_docs_ (cognitive 19) src/tools/rust-analyzer/crates/ide-db/src/rust_doc.rs:40 — ide_db::rust_doc::format_docs_ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_db::rename::rename_field_constructors (cognitive 16) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:425 — ide_db::rename::rename_field_constructors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 5 (7 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ide_db::syntax_helpers::node_ext::for_each_tail_expr (cognitive 16) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs:283 — ide_db::syntax_helpers::node_ext::for_each_tail_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D1 · Cyclomatic Complexity · Builder · ×18
  • Builder::codegen_intrinsic_call (cyclomatic 127) compiler/rustc_codegen_llvm/src/intrinsic.rs:124 — Builder::codegen_intrinsic_call has cyclomatic complexity 127 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::cargo (cyclomatic 113) src/bootstrap/src/core/builder/cargo.rs:700 — Builder::cargo has cyclomatic complexity 113 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Builder::codegen_intrinsic_call (cyclomatic 86) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:139 — Builder::codegen_intrinsic_call has cyclomatic complexity 86 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::codegen_inline_asm (cyclomatic 69) compiler/rustc_codegen_llvm/src/asm.rs:28 — Builder::codegen_inline_asm has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Builder::codegen_inline_asm (cyclomatic 68) compiler/rustc_codegen_gcc/src/asm.rs:115 — Builder::codegen_inline_asm has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Builder::expr_into_dest (cyclomatic 66) compiler/rustc_mir_build/src/builder/expr/into.rs:26 — Builder::expr_into_dest has cyclomatic complexity 66 (threshold 15). Of this number, 63 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::as_rvalue (cyclomatic 28) compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs:42 — Builder::as_rvalue has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::choose_bucket_for_candidate (cyclomatic 28) compiler/rustc_mir_build/src/builder/matches/buckets.rs:120 — Builder::choose_bucket_for_candidate has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Builder::gcc_icmp (cyclomatic 24) compiler/rustc_codegen_gcc/src/int.rs:473 — Builder::gcc_icmp has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::cfi_type_test (cyclomatic 23) compiler/rustc_codegen_llvm/src/builder.rs:2002 — Builder::cfi_type_test has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Builder::load_operand (cyclomatic 21) compiler/rustc_codegen_llvm/src/builder.rs:730 — Builder::load_operand has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Builder::static_pattern_match_inner (cyclomatic 20) compiler/rustc_mir_build/src/builder/matches/mod.rs:2921 — Builder::static_pattern_match_inner has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::dbg_scope_fn (cyclomatic 19) compiler/rustc_codegen_llvm/src/debuginfo/mod.rs:129 — Builder::dbg_scope_fn has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (get_function_signature, get_containing_scope, get_template_parameters). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • Builder::visit_primary_bindings_special (cyclomatic 19) compiler/rustc_mir_build/src/builder/matches/mod.rs:819 — Builder::visit_primary_bindings_special has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Builder::as_temp (cyclomatic 18) compiler/rustc_mir_build/src/builder/expr/as_temp.rs:16 — Builder::as_temp has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Builder::stmt_expr (cyclomatic 18) compiler/rustc_mir_build/src/builder/expr/stmt.rs:14 — Builder::stmt_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Builder::gcc_checked_binop (cyclomatic 17) compiler/rustc_codegen_gcc/src/int.rs:321 — Builder::gcc_checked_binop has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Builder::expr_as_place (cyclomatic 16) compiler/rustc_mir_build/src/builder/expr/as_place.rs:416 — Builder::expr_as_place has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D3 · God Classes · TooManyFields · ×18
  • TooManyFields: Config src/bootstrap/src/core/config/config.rs:90 — TooManyFields — 195 stored fields beside 64 methods. The bar is 30 stored fields; this is 165 over it, 6.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Config src/tools/compiletest/src/common.rs:282 — TooManyFields — 94 stored fields beside 27 methods. The bar is 30 stored fields; this is 64 over it, 3.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Args src/tools/compiletest/src/cli.rs:35 — TooManyFields — 90 stored fields. The bar is 30 stored fields; this is 60 over it, 3.00× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: AtHwcap library/std_detect/src/detect/os/linux/aarch64.rs:38 — TooManyFields — 78 stored fields beside 1 method. The bar is 30 stored fields; this is 48 over it, 2.60× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CodegenCx compiler/rustc_codegen_gcc/src/context.rs:39 — TooManyFields — 67 stored fields beside 122 methods. The bar is 30 stored fields; this is 37 over it, 2.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: MiriMachine src/tools/miri/src/machine.rs:511 — TooManyFields — 60 stored fields beside 24 methods. The bar is 30 stored fields; this is 30 over it, 2.00× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: BuiltinCombinedLateLintModPass compiler/rustc_lint/src/lib.rs:218 — TooManyFields — 60 stored fields beside 2 methods. The bar is 30 stored fields; this is 30 over it, 2.00× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TestProps src/tools/compiletest/src/directives.rs:84 — TooManyFields — 51 stored fields beside 6 methods. The bar is 30 stored fields; this is 21 over it, 1.70× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: GlobalState src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:84 — TooManyFields — 49 stored fields beside 51 methods. The bar is 30 stored fields; this is 19 over it, 1.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Options src/librustdoc/config.rs:64 — TooManyFields — 46 stored fields beside 1 method. The bar is 30 stored fields; this is 16 over it, 1.53× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CONTEXT library/std/src/sys/pal/windows/c/windows_sys.rs:408 — TooManyFields — 46 stored fields. The bar is 30 stored fields; this is 16 over it, 1.53× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Flags src/bootstrap/src/core/config/flags.rs:48 — TooManyFields — 38 stored fields beside 2 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: MiriConfig src/tools/miri/src/eval.rs:94 — TooManyFields — 38 stored fields. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: StaticFiles src/librustdoc/html/static_files.rs:57 — TooManyFields — 34 stored fields. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RenderOptions src/librustdoc/config.rs:229 — TooManyFields — 33 stored fields beside 1 method. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ModuleConfig compiler/rustc_codegen_ssa/src/back/write.rs:72 — TooManyFields — 31 stored fields beside 3 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ARM64_NT_CONTEXT_0_0 library/std/src/sys/pal/windows/c/windows_sys.rs:216 — TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ARM64_NT_CONTEXT_0_0 library/std/src/sys/pal/windows/c/windows_sys.rs:288 — TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D1 · Cyclomatic Complexity · MirBorrowckCtxt · ×17
  • MirBorrowckCtxt::report_mutability_error (cyclomatic 68) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:62 — MirBorrowckCtxt::report_mutability_error has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::explain_captures (cyclomatic 50) compiler/rustc_borrowck/src/diagnostics/mod.rs:1225 — MirBorrowckCtxt::explain_captures has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::suggest_make_local_mut (cyclomatic 47) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1400 — MirBorrowckCtxt::suggest_make_local_mut has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::add_move_hints (cyclomatic 24) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:734 — MirBorrowckCtxt::add_move_hints has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::was_captured_by_trait_object (cyclomatic 23) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:821 — MirBorrowckCtxt::was_captured_by_trait_object has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::describe_place_with_options (cyclomatic 22) compiler/rustc_borrowck/src/diagnostics/mod.rs:324 — MirBorrowckCtxt::describe_place_with_options has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::explain_impl_static_obligation (cyclomatic 22) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:424 — MirBorrowckCtxt::explain_impl_static_obligation has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::suggest_map_index_mut_alternatives (cyclomatic 21) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:667 — MirBorrowckCtxt::suggest_map_index_mut_alternatives has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::consume_rvalue (cyclomatic 21) compiler/rustc_borrowck/src/lib.rs:1475 — MirBorrowckCtxt::consume_rvalue has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • MirBorrowckCtxt::add_move_error_suggestions (cyclomatic 19) compiler/rustc_borrowck/src/diagnostics/move_errors.rs:1063 — MirBorrowckCtxt::add_move_error_suggestions has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::later_use_kind (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:719 — MirBorrowckCtxt::later_use_kind has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::give_name_if_anonymous_region_appears_in_output (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/region_name.rs:793 — MirBorrowckCtxt::give_name_if_anonymous_region_appears_in_output has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • MirBorrowckCtxt::visit_after_early_terminator_effect (cyclomatic 18) compiler/rustc_borrowck/src/lib.rs:882 — MirBorrowckCtxt::visit_after_early_terminator_effect has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb (cyclomatic 17) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:196 — MirBorrowckCtxt::suggest_static_lifetime_for_gat_from_hrtb has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirBorrowckCtxt::suggest_deref_closure_return (cyclomatic 17) compiler/rustc_borrowck/src/diagnostics/region_errors.rs:1223 — MirBorrowckCtxt::suggest_deref_closure_return has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • MirBorrowckCtxt::is_mutable (cyclomatic 17) compiler/rustc_borrowck/src/lib.rs:2571 — MirBorrowckCtxt::is_mutable has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • MirBorrowckCtxt::give_name_from_error_region (cyclomatic 16) compiler/rustc_borrowck/src/diagnostics/region_name.rs:284 — MirBorrowckCtxt::give_name_from_error_region has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · rustc_builtin_macros · ×17
  • rustc_builtin_macros::format::make_format_args (cognitive 155) compiler/rustc_builtin_macros/src/format.rs:169 — rustc_builtin_macros::format::make_format_args has cognitive complexity 155 (threshold 15). Drivers by points: if/else 42 (92 pts), match/switch 17 (48 pts), loops 4 (9 pts), boolean chains 6 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::asm::expand_preparsed_asm (cognitive 109) compiler/rustc_builtin_macros/src/asm.rs:265 — rustc_builtin_macros::asm::expand_preparsed_asm has cognitive complexity 109 (threshold 15). Drivers by points: if/else 28 (73 pts), match/switch 8 (26 pts), loops 6 (9 pts), boolean chains 1 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::asm::validate_asm_args (cognitive 70) compiler/rustc_builtin_macros/src/asm.rs:39 — rustc_builtin_macros::asm::validate_asm_args has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (43 pts), match/switch 5 (13 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::autodiff::llvm_enzyme::gen_enzyme_decl (cognitive 70) compiler/rustc_builtin_macros/src/autodiff.rs:610 — rustc_builtin_macros::autodiff::llvm_enzyme::gen_enzyme_decl has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (50 pts), match/switch 5 (10 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::format::report_missing_placeholders (cognitive 70) compiler/rustc_builtin_macros/src/format.rs:734 — rustc_builtin_macros::format::report_missing_placeholders has cognitive complexity 70 (threshold 15). Drivers by points: if/else 27 (55 pts), match/switch 3 (7 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::format::report_invalid_references (cognitive 36) compiler/rustc_builtin_macros/src/format.rs:967 — rustc_builtin_macros::format::report_invalid_references has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 2 (4 pts), boolean chains 3, match/switch 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::autodiff::llvm_enzyme::expand_with_mode (cognitive 35) compiler/rustc_builtin_macros/src/autodiff.rs:204 — rustc_builtin_macros::autodiff::llvm_enzyme::expand_with_mode has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 9 (12 pts), boolean chains 1, loops 1 (nesting depth added 11). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::format_foreign::printf::parse_next_substitution (cognitive 35) compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:315 — rustc_builtin_macros::format_foreign::printf::parse_next_substitution has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 9 (19 pts), if/else 11 (16 pts) (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_builtin_macros::concat_bytes::expand_concat_bytes (cognitive 32) compiler/rustc_builtin_macros/src/concat_bytes.rs:135 — rustc_builtin_macros::concat_bytes::expand_concat_bytes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (9 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::deriving::coerce_pointee::expand_deriving_coerce_pointee (cognitive 32) compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs:19 — rustc_builtin_macros::deriving::coerce_pointee::expand_deriving_coerce_pointee has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 4 (6 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::deriving::debug::show_substructure (cognitive 29) compiler/rustc_builtin_macros/src/deriving/debug.rs:60 — rustc_builtin_macros::deriving::debug::show_substructure has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 2 (4 pts), match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::format::report_redundant_format_arguments (cognitive 26) compiler/rustc_builtin_macros/src/format.rs:895 — rustc_builtin_macros::format::report_redundant_format_arguments has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::format::parse_args (cognitive 25) compiler/rustc_builtin_macros/src/format.rs:71 — rustc_builtin_macros::format::parse_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 3 (6 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::contracts::expand_contract_clause (cognitive 20) compiler/rustc_builtin_macros/src/contracts.rs:47 — rustc_builtin_macros::contracts::expand_contract_clause has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::eii::eii_ (cognitive 19) compiler/rustc_builtin_macros/src/eii.rs:56 — rustc_builtin_macros::eii::eii_ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_builtin_macros::env::expand_env (cognitive 17) compiler/rustc_builtin_macros/src/env.rs:79 — rustc_builtin_macros::env::expand_env has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_builtin_macros::deriving::partial_ord::cmp_body (cognitive 16) compiler/rustc_builtin_macros/src/deriving/partial_ord.rs:137 — rustc_builtin_macros::deriving::partial_ord::cmp_body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · initSearch · ×17
  • initSearch::execQuery::unifyFunctionTypes (cognitive 87) REDACTED:2979 — initSearch::execQuery::unifyFunctionTypes has cognitive complexity 87 (threshold 15). Drivers by points: if/else 22 (50 pts), ternaries 7 (19 pts), boolean chains 12, loops 4 (6 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::innerRunTypeQuery::unpackPostingsList (cognitive 80) REDACTED:4256 — initSearch::execQuery::innerRunTypeQuery::unpackPostingsList has cognitive complexity 80 (threshold 15). Drivers by points: if/else 15 (42 pts), loops 7 (19 pts), boolean chains 12, ternaries 1 (7 pts) (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • initSearch::execQuery::innerRunNameQuery (cognitive 71) REDACTED:3940 — initSearch::execQuery::innerRunNameQuery has cognitive complexity 71 (threshold 15). Drivers by points: if/else 18 (48 pts), loops 8 (17 pts), boolean chains 6 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::transformResults (cognitive 53) REDACTED:2660 — initSearch::execQuery::transformResults has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (38 pts), ternaries 3 (9 pts), boolean chains 5, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::unifyFunctionTypeIsMatchCandidate (cognitive 49) REDACTED:3524 — initSearch::execQuery::unifyFunctionTypeIsMatchCandidate has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 12, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • initSearch::execQuery::formatDisplayTypeSignature::writeFn (cognitive 47) REDACTED:2504 — initSearch::execQuery::formatDisplayTypeSignature::writeFn has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 2 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::buildItemSearchType (cognitive 41) REDACTED:1998 — initSearch::buildItemSearchType has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 7, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::unifyGenericTypes (cognitive 36) REDACTED:3312 — initSearch::execQuery::unifyGenericTypes has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::innerRunTypeQuery (cognitive 35) REDACTED:4182 — initSearch::execQuery::innerRunTypeQuery has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 9 (16 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::parseQuery::parseInput (cognitive 30) REDACTED:1419 — initSearch::parseQuery::parseInput has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::getRow (cognitive 24) REDACTED:1896 — initSearch::getRow has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16, boolean chains 7, if/else 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • initSearch::execQuery::checkPath (cognitive 23) REDACTED:3855 — initSearch::execQuery::checkPath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::getTypeData (cognitive 21) REDACTED:1780 — initSearch::getTypeData has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::execQuery::buildHrefAndPath (cognitive 21) REDACTED:2165 — initSearch::execQuery::buildHrefAndPath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • initSearch::calculate (cognitive 19) REDACTED:199 — initSearch::calculate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 5 (6 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • initSearch::showResults (cognitive 19) REDACTED:5233 — initSearch::showResults has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, ternaries 3 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • initSearch::execQuery::unifyFunctionTypeCheckBindings (cognitive 16) REDACTED:3628 — initSearch::execQuery::unifyFunctionTypeCheckBindings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · ide_completion · ×16
  • ide_completion::context::analysis::classify_name_ref (cyclomatic 152) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:966 — ide_completion::context::analysis::classify_name_ref has cyclomatic complexity 152 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::completions::expr::complete_expr_path (cyclomatic 74) src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs:47 — ide_completion::completions::expr::complete_expr_path has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::context::analysis::expected_type_and_name (cyclomatic 50) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:590 — ide_completion::context::analysis::expected_type_and_name has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::completions::postfix::complete_postfix (cyclomatic 45) src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs:33 — ide_completion::completions::postfix::complete_postfix has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::completions::type::complete_type_path (cyclomatic 41) src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs:12 — ide_completion::completions::type::complete_type_path has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::completions::pattern::complete_pattern (cyclomatic 31) src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs:13 — ide_completion::completions::pattern::complete_pattern has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::context::analysis::expand (cyclomatic 27) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:172 — ide_completion::context::analysis::expand has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::completions::attribute::complete_attribute_path (cyclomatic 25) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs:70 — ide_completion::completions::attribute::complete_attribute_path has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_completion::completions::item_list::add_keywords (cyclomatic 25) src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs:75 — ide_completion::completions::item_list::add_keywords has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::completions::pattern::complete_pattern_path (cyclomatic 25) src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs:129 — ide_completion::completions::pattern::complete_pattern_path has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::render::render_resolution_path (cyclomatic 24) src/tools/rust-analyzer/crates/ide-completion/src/render.rs:408 — ide_completion::render::render_resolution_path has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::completions::use_::complete_use_path (cyclomatic 22) src/tools/rust-analyzer/crates/ide-completion/src/completions/use_.rs:13 — ide_completion::completions::use_::complete_use_path has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::context::analysis::analyze (cyclomatic 22) src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs:442 — ide_completion::context::analysis::analyze has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_completion::completions::complete_name_ref (cyclomatic 18) src/tools/rust-analyzer/crates/ide-completion/src/completions.rs:727 — ide_completion::completions::complete_name_ref has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_completion::render::function::render (cyclomatic 18) src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs:50 — ide_completion::render::function::render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_completion::completions::attribute::cfg::complete_cfg (cyclomatic 16) src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs:12 — ide_completion::completions::attribute::cfg::complete_cfg has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustfmt_nightly · ×16
  • rustfmt_nightly::expr::format_expr (cyclomatic 58) src/tools/rustfmt/src/expr.rs:86 — rustfmt_nightly::expr::format_expr has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustfmt_nightly::lists::write_list (cyclomatic 58) src/tools/rustfmt/src/lists.rs:264 — rustfmt_nightly::lists::write_list has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::items::rewrite_fn_base (cyclomatic 47) src/tools/rustfmt/src/items.rs:2483 — rustfmt_nightly::items::rewrite_fn_base has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::macros::rewrite_macro_inner (cyclomatic 38) src/tools/rustfmt/src/macros.rs:193 — rustfmt_nightly::macros::rewrite_macro_inner has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::matches::rewrite_match_body (cyclomatic 33) src/tools/rustfmt/src/matches.rs:397 — rustfmt_nightly::matches::rewrite_match_body has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustfmt_nightly::types::join_bounds_inner (cyclomatic 28) src/tools/rustfmt/src/types.rs:1171 — rustfmt_nightly::types::join_bounds_inner has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustfmt_nightly::items::format_trait (cyclomatic 24) src/tools/rustfmt/src/items.rs:1173 — rustfmt_nightly::items::format_trait has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::comment::identify_comment (cyclomatic 21) src/tools/rustfmt/src/comment.rs:255 — rustfmt_nightly::comment::identify_comment has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::items::format_impl (cyclomatic 21) src/tools/rustfmt/src/items.rs:807 — rustfmt_nightly::items::format_impl has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::string::break_string (cyclomatic 20) src/tools/rustfmt/src/string.rs:229 — rustfmt_nightly::string::break_string has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::comment::combine_strs_with_missing_comments (cyclomatic 19) src/tools/rustfmt/src/comment.rs:154 — rustfmt_nightly::comment::combine_strs_with_missing_comments has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustfmt_nightly::expr::can_be_overflowed_expr (cyclomatic 18) src/tools/rustfmt/src/expr.rs:1578 — rustfmt_nightly::expr::can_be_overflowed_expr has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustfmt_nightly::comment::comment_style (cyclomatic 17) src/tools/rustfmt/src/comment.rs:114 — rustfmt_nightly::comment::comment_style has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustfmt_nightly::parse::macros::parse_macro_arg (cyclomatic 17) src/tools/rustfmt/src/parse/macros/mod.rs:24 — rustfmt_nightly::parse::macros::parse_macro_arg has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustfmt_nightly::sort::version_sort (cyclomatic 17) src/tools/rustfmt/src/sort.rs:136 — rustfmt_nightly::sort::version_sort has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustfmt_nightly::expr::rewrite_struct_lit (cyclomatic 16) src/tools/rustfmt/src/expr.rs:1809 — rustfmt_nightly::expr::rewrite_struct_lit has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_mir_transform · ×16
  • rustc_mir_transform::lint_tail_expr_drop_order::run_lint (cyclomatic 34) compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:183 — rustc_mir_transform::lint_tail_expr_drop_order::run_lint has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::ref_prop::compute_replacement (cyclomatic 28) compiler/rustc_mir_transform/src/ref_prop.rs:149 — rustc_mir_transform::ref_prop::compute_replacement has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::canonicalization::canonicalize_binary_operands (cyclomatic 27) compiler/rustc_mir_transform/src/canonicalization.rs:6 — rustc_mir_transform::canonicalization::canonicalize_binary_operands has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (needs_swap_operands, projection_rank, needs_swap). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_mir_transform::cross_crate_inline::cross_crate_inlinable (cyclomatic 25) compiler/rustc_mir_transform/src/cross_crate_inline.rs:18 — rustc_mir_transform::cross_crate_inline::cross_crate_inlinable has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_mir_transform::pass_manager::run_passes_inner (cyclomatic 22) compiler/rustc_mir_transform/src/pass_manager.rs:280 — rustc_mir_transform::pass_manager::run_passes_inner has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::liveness::find_self_assignments (cyclomatic 21) compiler/rustc_mir_transform/src/liveness.rs:365 — rustc_mir_transform::liveness::find_self_assignments has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::shim::build_call_shim (cyclomatic 20) compiler/rustc_mir_transform/src/shim.rs:764 — rustc_mir_transform::shim::build_call_shim has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_mir_transform::coroutine::layout::check_must_not_suspend_ty (cyclomatic 19) compiler/rustc_mir_transform/src/coroutine/layout.rs:575 — rustc_mir_transform::coroutine::layout::check_must_not_suspend_ty has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::dataflow_const_prop::try_write_constant (cyclomatic 19) compiler/rustc_mir_transform/src/dataflow_const_prop.rs:777 — rustc_mir_transform::dataflow_const_prop::try_write_constant has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::ffi_unwind_calls::has_ffi_unwind_calls (cyclomatic 19) compiler/rustc_mir_transform/src/ffi_unwind_calls.rs:15 — rustc_mir_transform::ffi_unwind_calls::has_ffi_unwind_calls has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::shim::make_shim (cyclomatic 19) compiler/rustc_mir_transform/src/shim.rs:32 — rustc_mir_transform::shim::make_shim has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_mir_transform::dest_prop::save_as_intervals (cyclomatic 18) compiler/rustc_mir_transform/src/dest_prop.rs:508 — rustc_mir_transform::dest_prop::save_as_intervals has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::dead_store_elimination::eliminate (cyclomatic 16) compiler/rustc_mir_transform/src/dead_store_elimination.rs:34 — rustc_mir_transform::dead_store_elimination::eliminate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::early_otherwise_branch::verify_candidate_branch (cyclomatic 16) compiler/rustc_mir_transform/src/early_otherwise_branch.rs:317 — rustc_mir_transform::early_otherwise_branch::verify_candidate_branch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::inline::try_inlining (cyclomatic 16) compiler/rustc_mir_transform/src/inline.rs:600 — rustc_mir_transform::inline::try_inlining has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_transform::inline::check_mir_is_available (cyclomatic 16) compiler/rustc_mir_transform/src/inline.rs:700 — rustc_mir_transform::inline::check_mir_is_available has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_builtin_macros · ×15
  • rustc_builtin_macros::format::make_format_args (cyclomatic 83) compiler/rustc_builtin_macros/src/format.rs:169 — rustc_builtin_macros::format::make_format_args has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::asm::validate_asm_args (cyclomatic 43) compiler/rustc_builtin_macros/src/asm.rs:39 — rustc_builtin_macros::asm::validate_asm_args has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::asm::expand_preparsed_asm (cyclomatic 40) compiler/rustc_builtin_macros/src/asm.rs:265 — rustc_builtin_macros::asm::expand_preparsed_asm has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::autodiff::llvm_enzyme::gen_enzyme_decl (cyclomatic 38) compiler/rustc_builtin_macros/src/autodiff.rs:610 — rustc_builtin_macros::autodiff::llvm_enzyme::gen_enzyme_decl has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::format::report_missing_placeholders (cyclomatic 32) compiler/rustc_builtin_macros/src/format.rs:734 — rustc_builtin_macros::format::report_missing_placeholders has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::autodiff::llvm_enzyme::expand_with_mode (cyclomatic 31) compiler/rustc_builtin_macros/src/autodiff.rs:204 — rustc_builtin_macros::autodiff::llvm_enzyme::expand_with_mode has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_builtin_macros::format_foreign::printf::parse_next_substitution (cyclomatic 26) compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:315 — rustc_builtin_macros::format_foreign::printf::parse_next_substitution has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_builtin_macros::concat::expand_concat (cyclomatic 21) compiler/rustc_builtin_macros/src/concat.rs:10 — rustc_builtin_macros::concat::expand_concat has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_builtin_macros::format::report_invalid_references (cyclomatic 21) compiler/rustc_builtin_macros/src/format.rs:967 — rustc_builtin_macros::format::report_invalid_references has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::concat_bytes::expand_concat_bytes (cyclomatic 20) compiler/rustc_builtin_macros/src/concat_bytes.rs:135 — rustc_builtin_macros::concat_bytes::expand_concat_bytes has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_builtin_macros::deriving::coerce_pointee::expand_deriving_coerce_pointee (cyclomatic 20) compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs:19 — rustc_builtin_macros::deriving::coerce_pointee::expand_deriving_coerce_pointee has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::deriving::debug::show_substructure (cyclomatic 19) compiler/rustc_builtin_macros/src/deriving/debug.rs:60 — rustc_builtin_macros::deriving::debug::show_substructure has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::define_opaque::expand (cyclomatic 16) compiler/rustc_builtin_macros/src/define_opaque.rs:5 — rustc_builtin_macros::define_opaque::expand has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_builtin_macros::eii::eii_ (cyclomatic 16) compiler/rustc_builtin_macros/src/eii.rs:56 — rustc_builtin_macros::eii::eii_ has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_builtin_macros::env::expand_env (cyclomatic 16) compiler/rustc_builtin_macros/src/env.rs:79 — rustc_builtin_macros::env::expand_env has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · bootstrap · ×15
  • bootstrap::core::sanity::check (cyclomatic 61) src/bootstrap/src/core/sanity.rs:82 — bootstrap::core::sanity::check has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::build_steps::llvm::configure_cmake (cyclomatic 50) src/bootstrap/src/core/build_steps/llvm.rs:883 — bootstrap::core::build_steps::llvm::configure_cmake has cyclomatic complexity 50 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::core::config::toml::rust::check_incompatible_options_for_ci_rustc (cyclomatic 46) src/bootstrap/src/core/config/toml/rust.rs:256 — bootstrap::core::config::toml::rust::check_incompatible_options_for_ci_rustc has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::config::toml::llvm::check_incompatible_options_for_ci_llvm (cyclomatic 44) src/bootstrap/src/core/config/toml/llvm.rs:49 — bootstrap::core::config::toml::llvm::check_incompatible_options_for_ci_llvm has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::bin::rustc::main (cyclomatic 43) src/bootstrap/src/bin/rustc.rs:31 — bootstrap::bin::rustc::main has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::core::build_steps::format::format (cyclomatic 30) src/bootstrap/src/core/build_steps/format.rs:146 — bootstrap::core::build_steps::format::format has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::build_steps::compile::run_cargo (cyclomatic 25) src/bootstrap/src/core/build_steps/compile.rs:2676 — bootstrap::core::build_steps::compile::run_cargo has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::build_steps::compile::rustc_cargo_env (cyclomatic 20) src/bootstrap/src/core/build_steps/compile.rs:1315 — bootstrap::core::build_steps::compile::rustc_cargo_env has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::cli_main::main (cyclomatic 19) src/bootstrap/src/cli_main.rs:30 — bootstrap::cli_main::main has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::core::build_steps::compile::std_cargo (cyclomatic 19) src/bootstrap/src/core/build_steps/compile.rs:521 — bootstrap::core::build_steps::compile::std_cargo has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::build_steps::dist::copy_src_dirs (cyclomatic 18) src/bootstrap/src/core/build_steps/dist.rs:1072 — bootstrap::core::build_steps::dist::copy_src_dirs has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (filter_fn). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • bootstrap::core::build_steps::tool::prepare_tool_cargo (cyclomatic 18) src/bootstrap/src/core/build_steps/tool.rs:198 — bootstrap::core::build_steps::tool::prepare_tool_cargo has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run (cyclomatic 18) src/bootstrap/src/core/builder/cli_paths.rs:21 — bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::utils::cc_detect::default_compiler (cyclomatic 18) src/bootstrap/src/utils/cc_detect.rs:169 — bootstrap::utils::cc_detect::default_compiler has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • bootstrap::core::build_steps::compile::rustc_llvm_env (cyclomatic 17) src/bootstrap/src/core/build_steps/compile.rs:1437 — bootstrap::core::build_steps::compile::rustc_llvm_env has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · tidy · ×15
  • tidy::style::check_file_style (cognitive 137) src/tools/tidy/src/style.rs:327 — tidy::style::check_file_style has cognitive complexity 137 (threshold 15). Drivers by points: if/else 47 (85 pts), boolean chains 46, match/switch 2 (5 pts), loops 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::triagebot::check (cognitive 54) src/tools/tidy/src/triagebot.rs:21 — tidy::triagebot::check has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 6 (15 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • tidy::features::collect_lang_features_in (cognitive 44) src/tools/tidy/src/features.rs:284 — tidy::features::collect_lang_features_in has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (29 pts), match/switch 5 (12 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::deps::check_permitted_dependencies (cognitive 34) src/tools/tidy/src/deps.rs:962 — tidy::deps::check_permitted_dependencies has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::rustdoc_templates::check (cognitive 29) src/tools/tidy/src/rustdoc_templates.rs:15 — tidy::rustdoc_templates::check has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::x_version::check (cognitive 28) src/tools/tidy/src/x_version.rs:8 — tidy::x_version::check has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • tidy::deps::check_license_exceptions (cognitive 25) src/tools/tidy/src/deps.rs:858 — tidy::deps::check_license_exceptions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (5 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::features::check (cognitive 24) src/tools/tidy/src/features.rs:93 — tidy::features::check has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, match/switch 2 (4 pts), loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::error_codes::check_error_codes_tests (cognitive 21) src/tools/tidy/src/error_codes.rs:241 — tidy::error_codes::check_error_codes_tests has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::extra_checks::check (cognitive 21) src/tools/tidy/src/extra_checks/mod.rs:49 — tidy::extra_checks::check has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • tidy::error_codes::check_error_codes_used (cognitive 20) src/tools/tidy/src/error_codes.rs:303 — tidy::error_codes::check_error_codes_used has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::pal::check_cfgs (cognitive 18) src/tools/tidy/src/pal.rs:103 — tidy::pal::check_cfgs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::rustdoc_json::check (cognitive 18) src/tools/tidy/src/rustdoc_json.rs:11 — tidy::rustdoc_json::check has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::deps::check (cognitive 17) src/tools/tidy/src/deps.rs:653 — tidy::deps::check has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tidy::extra_checks::check_cpp_fmt (cognitive 16) src/tools/tidy/src/extra_checks/mod.rs:376 — tidy::extra_checks::check_cpp_fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (2 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rust_analyzer · ×15
  • rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cognitive 135) src/tools/rust-analyzer/crates/rust-analyzer/src/config/patch_old_style.rs:10 — rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cognitive complexity 135 (threshold 15). Drivers by points: loops 41 (82 pts), match/switch 43 (44 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 43). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rust_analyzer::handlers::notification::run_flycheck (cognitive 69) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs:330 — rust_analyzer::handlers::notification::run_flycheck has cognitive complexity 69 (threshold 15). Drivers by points: if/else 11 (36 pts), match/switch 6 (19 pts), loops 3 (11 pts), boolean chains 3 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rust_analyzer::lsp::to_proto::completion_item (cognitive 45) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:291 — rust_analyzer::lsp::to_proto::completion_item has cognitive complexity 45 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 9). Of this number, 43 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rust_analyzer::handlers::request::handle_runnables (cognitive 38) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:1016 — rust_analyzer::handlers::request::handle_runnables has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 6, loops 2 (3 pts), match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::lsp::to_proto::code_lens (cognitive 38) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:1759 — rust_analyzer::lsp::to_proto::code_lens has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cognitive 37) src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281 — rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (7 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::handlers::request::run_rustfmt (cognitive 32) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:2405 — rust_analyzer::handlers::request::run_rustfmt has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 6, match/switch 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits (cognitive 23) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:1197 — rust_analyzer::lsp::to_proto::merge_text_and_snippet_edits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (9 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::handlers::notification::handle_did_save_text_document (cognitive 20) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs:162 — rust_analyzer::handlers::notification::handle_did_save_text_document has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::handlers::request::handle_run_test (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:250 — rust_analyzer::handlers::request::handle_run_test has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (7 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::handlers::request::handle_workspace_symbol (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:676 — rust_analyzer::handlers::request::handle_workspace_symbol has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 6, boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (decide_search_kind_and_scope, exec_query). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rust_analyzer::handlers::request::handle_code_action (cognitive 19) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:1499 — rust_analyzer::handlers::request::handle_code_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::handlers::request::handle_parent_module (cognitive 18) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:931 — rust_analyzer::handlers::request::handle_parent_module has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rust_analyzer::lsp::to_proto::semantic_tokens (cognitive 18) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:749 — rust_analyzer::lsp::to_proto::semantic_tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rust_analyzer::session::run_session (cognitive 16) src/tools/rust-analyzer/crates/rust-analyzer/src/session.rs:37 — rust_analyzer::session::run_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 4, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TestCx · ×15
  • TestCx::check_expected_errors (cognitive 105) src/tools/compiletest/src/runtest.rs:682 — TestCx::check_expected_errors has cognitive complexity 105 (threshold 15). Drivers by points: if/else 30 (72 pts), loops 8 (21 pts), boolean chains 8, match/switch 2 (4 pts) (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TestCx::make_compile_args (cognitive 72) src/tools/compiletest/src/runtest.rs:1652 — TestCx::make_compile_args has cognitive complexity 72 (threshold 15). Drivers by points: if/else 35 (51 pts), boolean chains 11, match/switch 7 (10 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::run_ui_test (cognitive 67) src/tools/compiletest/src/runtest/ui.rs:16 — TestCx::run_ui_test has cognitive complexity 67 (threshold 15). Drivers by points: if/else 35 (57 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::compare_output (cognitive 32) src/tools/compiletest/src/runtest.rs:2823 — TestCx::compare_output has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::run_rmake_test (cognitive 31) src/tools/compiletest/src/runtest/run_make.rs:13 — TestCx::run_rmake_test has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25 (29 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TestCx::run_codegen_units_test (cognitive 30) src/tools/compiletest/src/runtest/codegen_units.rs:8 — TestCx::run_codegen_units_test has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 7). Of this number, 20 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TestCx::load_compare_outputs (cognitive 30) src/tools/compiletest/src/runtest.rs:2436 — TestCx::load_compare_outputs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::run_debuginfo_gdb_test (cognitive 26) src/tools/compiletest/src/runtest/debuginfo.rs:108 — TestCx::run_debuginfo_gdb_test has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::check_mir_dump (cognitive 24) src/tools/compiletest/src/runtest/mir_opt.rs:28 — TestCx::check_mir_dump has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::show_diff (cognitive 23) src/tools/compiletest/src/runtest.rs:2948 — TestCx::show_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::document_inner (cognitive 22) src/tools/compiletest/src/runtest.rs:1000 — TestCx::document_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::check_rustdoc_test_option (cognitive 19) src/tools/compiletest/src/runtest.rs:2353 — TestCx::check_rustdoc_test_option has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TestCx::build_auxiliary (cognitive 18) src/tools/compiletest/src/runtest.rs:1416 — TestCx::build_auxiliary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TestCx::run_pretty_test (cognitive 17) src/tools/compiletest/src/runtest/pretty.rs:6 — TestCx::run_pretty_test has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TestCx::run_incremental_test (cognitive 16) src/tools/compiletest/src/runtest/incremental.rs:40 — TestCx::run_incremental_test has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · search.initSearch · ×15
  • search.initSearch::unifyFunctionTypes (cognitive 77) REDACTED:2979 — search.initSearch::unifyFunctionTypes has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (50 pts), ternaries 5 (11 pts), boolean chains 10, loops 4 (6 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getNextElem (cognitive 71) REDACTED:594 — search.initSearch::getNextElem has cognitive complexity 71 (threshold 15). Drivers by points: if/else 30 (63 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::transformResults (cognitive 53) REDACTED:2660 — search.initSearch::transformResults has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (38 pts), ternaries 3 (9 pts), boolean chains 5, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::unifyFunctionTypeIsMatchCandidate (cognitive 48) REDACTED:3524 — search.initSearch::unifyFunctionTypeIsMatchCandidate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 11, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::formatDisplayTypeSignature::writeFn (cognitive 47) REDACTED:2504 — search.initSearch::formatDisplayTypeSignature::writeFn has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 2 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getIdentEndPosition (cognitive 43) REDACTED:964 — search.initSearch::getIdentEndPosition has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (37 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getItemsBefore (cognitive 41) REDACTED:440 — search.initSearch::getItemsBefore has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 5, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getNextElem, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::unifyGenericTypes (cognitive 35) REDACTED:3312 — search.initSearch::unifyGenericTypes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::parseInput (cognitive 30) REDACTED:1419 — search.initSearch::parseInput has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::createQueryElement (cognitive 26) REDACTED:806 — search.initSearch::createQueryElement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::checkPath (cognitive 23) REDACTED:3855 — search.initSearch::checkPath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::addTab::addNextResultToOutput (cognitive 23) REDACTED:4965 — search.initSearch::addTab::addNextResultToOutput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (6 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::buildHrefAndPath (cognitive 21) REDACTED:2165 — search.initSearch::buildHrefAndPath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::addTab (cognitive 17) REDACTED:4947 — search.initSearch::addTab has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::unifyFunctionTypeCheckBindings (cognitive 16) REDACTED:3628 — search.initSearch::unifyFunctionTypeCheckBindings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · rustc_middle · ×15
  • rustc_middle::ty::diagnostics::suggest_constraining_type_params (cognitive 73) compiler/rustc_middle/src/ty/diagnostics.rs:287 — rustc_middle::ty::diagnostics::suggest_constraining_type_params has cognitive complexity 73 (threshold 15). Drivers by points: if/else 34 (58 pts), match/switch 6 (12 pts), boolean chains 2, loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::ty::typetree::typetree_from_ty_impl_inner (cognitive 49) compiler/rustc_middle/src/ty/typetree.rs:100 — rustc_middle::ty::typetree::typetree_from_ty_impl_inner has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 5 (17 pts), match/switch 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::mir::pretty::write_scope_tree (cognitive 46) compiler/rustc_middle/src/mir/pretty.rs:411 — rustc_middle::mir::pretty::write_scope_tree has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (37 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::mir::pretty::write_allocation_bytes (cognitive 44) compiler/rustc_middle/src/mir/pretty.rs:1764 — rustc_middle::mir::pretty::write_allocation_bytes has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 4 (13 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::mir::pretty::pretty_print_const_value_tcx (cognitive 32) compiler/rustc_middle/src/mir/pretty.rs:1928 — rustc_middle::mir::pretty::pretty_print_const_value_tcx has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 3 (8 pts), loops 1 (5 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::lint::emit_lint_base::emit_lint_base_impl (cognitive 31) compiler/rustc_middle/src/lint.rs:395 — rustc_middle::lint::emit_lint_base::emit_lint_base_impl has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, loops 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_middle::ty::diagnostics::suggest_changing_unsized_bound (cognitive 30) compiler/rustc_middle/src/ty/diagnostics.rs:186 — rustc_middle::ty::diagnostics::suggest_changing_unsized_bound has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::ty::print::pretty::for_each_def (cognitive 27) compiler/rustc_middle/src/ty/print/pretty.rs:3470 — rustc_middle::ty::print::pretty::for_each_def has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (5 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::thir::visit::walk_expr (cognitive 26) compiler/rustc_middle/src/thir/visit.rs:43 — rustc_middle::thir::visit::walk_expr has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 5 (10 pts), match/switch 2 (4 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_middle::ty::significant_drop_order::true_significant_drop_ty (cognitive 23) compiler/rustc_middle/src/ty/significant_drop_order.rs:14 — rustc_middle::ty::significant_drop_order::true_significant_drop_ty has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::lint::explain_lint_level_source (cognitive 21) compiler/rustc_middle/src/lint.rs:283 — rustc_middle::lint::explain_lint_level_source has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::mir::pretty::write_allocations (cognitive 21) compiler/rustc_middle/src/mir/pretty.rs:1584 — rustc_middle::mir::pretty::write_allocations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (8 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::mir::pretty::write_mir_pretty (cognitive 20) compiler/rustc_middle/src/mir/pretty.rs:317 — rustc_middle::mir::pretty::write_mir_pretty has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::ty::print::pretty::trimmed_def_paths (cognitive 20) compiler/rustc_middle/src/ty/print/pretty.rs:3550 — rustc_middle::ty::print::pretty::trimmed_def_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 3 (6 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_middle::ty::instance::resolve_async_drop_poll (cognitive 16) compiler/rustc_middle/src/ty/instance.rs:464 — rustc_middle::ty::instance::resolve_async_drop_poll has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · std · ×15
  • std::sys::backtrace::_print_fmt (cognitive 43) library/std/src/sys/backtrace.rs:54 — std::sys::backtrace::_print_fmt has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 4 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • std::sys::random::linux::getrandom (cognitive 33) library/std/src/sys/random/linux.rs:72 — std::sys::random::linux::getrandom has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (8 pts), loops 2 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::thread_local::guard::windows::enable (cognitive 28) library/std/src/sys/thread_local/guard/windows.rs:110 — std::sys::thread_local::guard::windows::enable has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • std::sys::personality::dwarf::eh::find_eh_action (cognitive 26) library/std/src/sys/personality/dwarf/eh.rs:77 — std::sys::personality::dwarf::eh::find_eh_action has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::path::windows_prefix::parse_prefix (cognitive 25) library/std/src/sys/path/windows_prefix.rs:62 — std::sys::path::windows_prefix::parse_prefix has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::args::windows::parse_lp_cmd_line (cognitive 22) library/std/src/sys/args/windows.rs:54 — std::sys::args::windows::parse_lp_cmd_line has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (7 pts), boolean chains 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::args::windows::append_bat_arg (cognitive 22) library/std/src/sys/args/windows.rs:219 — std::sys::args::windows::append_bat_arg has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::fs::windows::rename_inner (cognitive 21) library/std/src/sys/fs/windows.rs:1329 — std::sys::fs::windows::rename_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (21 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • std::sys::io::kernel_copy::linux::copy_regular_files (cognitive 21) library/std/src/sys/io/kernel_copy/linux.rs:678 — std::sys::io::kernel_copy::linux::copy_regular_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 4 (7 pts), boolean chains 1, loops 1 (nesting depth added 11). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::args::windows::append_arg (cognitive 20) library/std/src/sys/args/windows.rs:173 — std::sys::args::windows::append_arg has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::process::windows::child_pipe::child_pipe (cognitive 20) library/std/src/sys/process/windows/child_pipe.rs:57 — std::sys::process::windows::child_pipe::child_pipe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • std::sys::io::error::sgx::decode_error_kind (cognitive 19) library/std/src/sys/io/error/sgx.rs:14 — std::sys::io::error::sgx::decode_error_kind has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • std::sys::process::uefi::output (cognitive 17) library/std/src/sys/process/uefi.rs:148 — std::sys::process::uefi::output has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • std::sys::process::windows::search_paths (cognitive 17) library/std/src/sys/process/windows.rs:544 — std::sys::process::windows::search_paths has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std::sys::args::uefi::parse_lp_cmd_line (cognitive 16) library/std/src/sys/args/uefi.rs:42 — std::sys::args::uefi::parse_lp_cmd_line has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (6 pts), if/else 3 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×15
  • Duplicated block (16 lines × 2) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:743 — compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:743-758 | compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:789-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1030 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1030-1045 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1118-1133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:222 — compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:222-237 | compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:290-305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_mir_build/src/builder/scope.rs:566 — compiler/rustc_mir_build/src/builder/scope.rs:566-581 | compiler/rustc_mir_build/src/builder/scope.rs:619-634 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_mir_dataflow/src/framework/fmt.rs:85 — compiler/rustc_mir_dataflow/src/framework/fmt.rs:85-100 | compiler/rustc_mir_dataflow/src/framework/fmt.rs:112-127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_mir_transform/src/validate.rs:296 — compiler/rustc_mir_transform/src/validate.rs:296-311 | compiler/rustc_mir_transform/src/validate.rs:1509-1524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_trait_selection/src/traits/specialize/mod.rs:191 — compiler/rustc_trait_selection/src/traits/specialize/mod.rs:191-206 | compiler/rustc_trait_selection/src/traits/specialize/mod.rs:319-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_ty_utils/src/assoc.rs:232 — compiler/rustc_ty_utils/src/assoc.rs:232-247 | compiler/rustc_ty_utils/src/assoc.rs:298-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) library/compiler-builtins/libm/src/math/erf.rs:291 — library/compiler-builtins/libm/src/math/erf.rs:291-306 | library/compiler-builtins/libm/src/math/erff.rs:203-218 — before extracting anything, compare `library/compiler-builtins/libm/src/math/erf.rs` and `library/compiler-builtins/libm/src/math/erff.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) library/compiler-builtins/libm/src/math/j0f.rs:115 — library/compiler-builtins/libm/src/math/j0f.rs:115-130 | library/compiler-builtins/libm/src/math/j1f.rs:115-130 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0f.rs` and `library/compiler-builtins/libm/src/math/j1f.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) library/compiler-builtins/libm/src/math/jn.rs:185 — library/compiler-builtins/libm/src/math/jn.rs:185-200 | library/compiler-builtins/libm/src/math/jnf.rs:128-143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16 lines × 2) library/core/src/slice/sort/shared/smallsort.rs:424 — library/core/src/slice/sort/shared/smallsort.rs:424-439 | library/core/src/slice/sort/shared/smallsort.rs:473-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) library/alloc/src/rcs/arc.rs:4968 — library/alloc/src/rcs/arc.rs:4968-4983 | library/alloc/src/rcs/rc.rs:4547-4562 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:402 — compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:402-417 | compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:435-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) compiler/rustc_codegen_cranelift/example/mini_core.rs:634 — compiler/rustc_codegen_cranelift/example/mini_core.rs:634-649 | compiler/rustc_codegen_gcc/example/mini_core.rs:643-658 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/mini_core.rs` and `compiler/rustc_codegen_gcc/example/mini_core.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · rustc_target · ×14
  • rustc_target::callconv::loongarch::classify_arg (cyclomatic 24) compiler/rustc_target/src/callconv/loongarch.rs:278 — rustc_target::callconv::loongarch::classify_arg has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_target::callconv::riscv::classify_arg (cyclomatic 24) compiler/rustc_target/src/callconv/riscv.rs:283 — rustc_target::callconv::riscv::classify_arg has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_target::callconv::mips64::classify_arg (cyclomatic 23) compiler/rustc_target/src/callconv/mips64.rs:107 — rustc_target::callconv::mips64::classify_arg has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_target::callconv::x86_64::classify_arg (cyclomatic 21) compiler/rustc_target/src/callconv/x86_64.rs:29 — rustc_target::callconv::x86_64::classify_arg has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function item inside it that branches (classify). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_target::callconv::x86_64::compute_abi_info (cyclomatic 21) compiler/rustc_target/src/callconv/x86_64.rs:177 — rustc_target::callconv::x86_64::compute_abi_info has cyclomatic complexity 21 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • rustc_target::callconv::s390x::classify_arg (cyclomatic 20) compiler/rustc_target/src/callconv/s390x.rs:55 — rustc_target::callconv::s390x::classify_arg has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_target::callconv::loongarch::should_use_fp_conv_helper (cyclomatic 19) compiler/rustc_target/src/callconv/loongarch.rs:33 — rustc_target::callconv::loongarch::should_use_fp_conv_helper has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_target::callconv::sparc64::classify (cyclomatic 19) compiler/rustc_target/src/callconv/sparc64.rs:27 — rustc_target::callconv::sparc64::classify has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_target::callconv::x86_win64::compute_abi_info (cyclomatic 19) compiler/rustc_target/src/callconv/x86_win64.rs:8 — rustc_target::callconv::x86_win64::compute_abi_info has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_target::callconv::powerpc64::classify (cyclomatic 18) compiler/rustc_target/src/callconv/powerpc64.rs:91 — rustc_target::callconv::powerpc64::classify has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_target::callconv::riscv::should_use_fp_conv_helper (cyclomatic 18) compiler/rustc_target/src/callconv/riscv.rs:39 — rustc_target::callconv::riscv::should_use_fp_conv_helper has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_target::callconv::x86_win32::compute_abi_info (cyclomatic 18) compiler/rustc_target/src/callconv/x86_win32.rs:6 — rustc_target::callconv::x86_win32::compute_abi_info has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_target::target_features::feature_to_arch_names (cyclomatic 17) compiler/rustc_target/src/target_features.rs:1095 — rustc_target::target_features::feature_to_arch_names has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Target::rust_target_features (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_target::callconv::sparc64::classify_arg (cyclomatic 16) compiler/rustc_target/src/callconv/sparc64.rs:105 — rustc_target::callconv::sparc64::classify_arg has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · FunctionCx · ×14
  • FunctionCx::codegen_call_terminator (cognitive 113) compiler/rustc_codegen_ssa/src/mir/block.rs:960 — FunctionCx::codegen_call_terminator has cognitive complexity 113 (threshold 15). Drivers by points: if/else 33 (71 pts), match/switch 12 (29 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::codegen_intrinsic_call (cognitive 78) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:56 — FunctionCx::codegen_intrinsic_call has cognitive complexity 78 (threshold 15). Drivers by points: if/else 31 (49 pts), match/switch 10 (20 pts), boolean chains 9 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::codegen_rvalue_operand (cognitive 59) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:496 — FunctionCx::codegen_rvalue_operand has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (39 pts), match/switch 8 (17 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionCx::compute_per_local_var_debug_info (cognitive 48) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:554 — FunctionCx::compute_per_local_var_debug_info has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (37 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::codegen_rvalue (cognitive 47) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:101 — FunctionCx::codegen_rvalue has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (37 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionCx::codegen_argument (cognitive 46) compiler/rustc_codegen_ssa/src/mir/block.rs:1964 — FunctionCx::codegen_argument has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 9 (16 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FunctionCx::codegen_scalar_binop (cognitive 40) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:888 — FunctionCx::codegen_scalar_binop has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (39 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionCx::retag_operand (cognitive 37) compiler/rustc_codegen_ssa/src/mir/retag.rs:428 — FunctionCx::retag_operand has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (8 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionCx::debug_introduce_local (cognitive 36) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:310 — FunctionCx::debug_introduce_local has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 5 (9 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::codegen_statement (cognitive 35) compiler/rustc_codegen_ssa/src/mir/statement.rs:12 — FunctionCx::codegen_statement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (30 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FunctionCx::codegen_switchint_terminator (cognitive 33) compiler/rustc_codegen_ssa/src/mir/block.rs:428 — FunctionCx::codegen_switchint_terminator has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 7, match/switch 2 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::clear_variant_dependent_padding (cognitive 25) compiler/rustc_codegen_ssa/src/mir/block.rs:1828 — FunctionCx::clear_variant_dependent_padding has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionCx::lib_call (cognitive 17) compiler/rustc_codegen_cranelift/src/abi/mod.rs:144 — FunctionCx::lib_call has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • FunctionCx::retag_place (cognitive 16) compiler/rustc_codegen_ssa/src/mir/retag.rs:519 — FunctionCx::retag_place has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 1 (4 pts), match/switch 2 (4 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · hir_def · ×14
  • hir_def::expr_store::lower::path::lower_path (cognitive 72) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/path.rs:41 — hir_def::expr_store::lower::path::lower_path has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (47 pts), match/switch 7 (19 pts), boolean chains 5, loops 1 (nesting depth added 34). Of this number, 71 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::hir::format_args::parse (cognitive 54) src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs:172 — hir_def::hir::format_args::parse has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 10 (25 pts), loops 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::attrs::match_attr_flags (cognitive 46) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:131 — hir_def::attrs::match_attr_flags has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 11 (31 pts), if/else 6 (13 pts), boolean chains 2 (nesting depth added 27). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_def::attrs::parse_repr_tt (cognitive 42) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:1272 — hir_def::attrs::parse_repr_tt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 4 (16 pts), boolean chains 2, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::expr_store::lower::lower_body (cognitive 34) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:70 — hir_def::expr_store::lower::lower_body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 4 (9 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::expr_store::pretty::print_generic_params (cognitive 29) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:368 — hir_def::expr_store::pretty::print_generic_params has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::attrs::docs::get_horizontal_trim (cognitive 27) src/tools/rust-analyzer/crates/hir-def/src/attrs/docs.rs:511 — hir_def::attrs::docs::get_horizontal_trim has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::find_path::find_path_for_module (cognitive 25) src/tools/rust-analyzer/crates/hir-def/src/find_path.rs:177 — hir_def::find_path::find_path_for_module has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::find_path::find_local_import_locations (cognitive 25) src/tools/rust-analyzer/crates/hir-def/src/find_path.rs:577 — hir_def::find_path::find_local_import_locations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::expr_store::pretty::print_where_clauses (cognitive 24) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:328 — hir_def::expr_store::pretty::print_where_clauses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (7 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_def::lang_item::crate_lang_items (cognitive 23) src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs:38 — hir_def::lang_item::crate_lang_items has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 3 (11 pts), loops 4 (8 pts), if/else 4 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_def::expr_store::lower::lower_function (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:377 — hir_def::expr_store::lower::lower_function has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (11 pts), if/else 5 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_def::attrs::docs::extend_with_attrs (cognitive 18) src/tools/rust-analyzer/crates/hir-def/src/attrs/docs.rs:649 — hir_def::attrs::docs::extend_with_attrs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_def::find_path::find_in_sysroot (cognitive 16) src/tools/rust-analyzer/crates/hir-def/src/find_path.rs:387 — hir_def::find_path::find_in_sysroot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×14
  • Duplicated block (7 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:61 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:61-67 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:96-102 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:132-138 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:379 — compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:379-385 | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:397-403 | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:418-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2827 — compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2827-2833 | compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2856-2862 | compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2889-2895 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_next_trait_solver/src/placeholder.rs:259 — compiler/rustc_next_trait_solver/src/placeholder.rs:259-265 | compiler/rustc_next_trait_solver/src/placeholder.rs:287-293 | compiler/rustc_next_trait_solver/src/placeholder.rs:318-324 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:392 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:392-398 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:573-579 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:743-749 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:408 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:408-414 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:588-594 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:759-765 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_target/src/callconv/s390x.rs:121 — compiler/rustc_target/src/callconv/s390x.rs:121-127 | compiler/rustc_target/src/callconv/x86.rs:86-92 | compiler/rustc_target/src/callconv/x86_win64.rs:17-23 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) compiler/rustc_type_ir_macros/src/lib.rs:94 — compiler/rustc_type_ir_macros/src/lib.rs:94-100 | compiler/rustc_type_ir_macros/src/lib.rs:135-141 | compiler/rustc_type_ir_macros/src/lib.rs:241-247 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) library/compiler-builtins/libm/src/math/log10.rs:83 — library/compiler-builtins/libm/src/math/log10.rs:83-89 | library/compiler-builtins/libm/src/math/log1p.rs:133-139 | library/compiler-builtins/libm/src/math/log2.rs:80-86 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10.rs` and `library/compiler-builtins/libm/src/math/log2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) library/compiler-builtins/libm/src/math/log10f.rs:75 — library/compiler-builtins/libm/src/math/log10f.rs:75-81 | library/compiler-builtins/libm/src/math/log1pf.rs:88-94 | library/compiler-builtins/libm/src/math/log2f.rs:72-78 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10f.rs` and `library/compiler-builtins/libm/src/math/log2f.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) library/std/src/sync/mpmc/array.rs:137 — library/std/src/sync/mpmc/array.rs:137-143 | library/std/src/sync/mpmc/array.rs:221-227 | library/std/src/sync/mpmc/array.rs:507-513 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:563 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:563-569 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:605-613 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:641-647 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:776 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:776-782 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:883-889 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:734-756 — before extracting anything, compare `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs` and `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) compiler/rustc_mir_build/src/thir/print.rs:816 — compiler/rustc_mir_build/src/thir/print.rs:816-823 | compiler/rustc_mir_build/src/thir/print.rs:838-845 | compiler/rustc_mir_build/src/thir/print.rs:848-854 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · initSearch · ×13
  • initSearch::execQuery::unifyFunctionTypes (cyclomatic 47) REDACTED:2979 — initSearch::execQuery::unifyFunctionTypes has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::innerRunTypeQuery::unpackPostingsList (cyclomatic 37) REDACTED:4256 — initSearch::execQuery::innerRunTypeQuery::unpackPostingsList has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::innerRunNameQuery (cyclomatic 34) REDACTED:3940 — initSearch::execQuery::innerRunNameQuery has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::unifyFunctionTypeIsMatchCandidate (cyclomatic 33) REDACTED:3524 — initSearch::execQuery::unifyFunctionTypeIsMatchCandidate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::buildItemSearchType (cyclomatic 31) REDACTED:1998 — initSearch::buildItemSearchType has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::formatDisplayTypeSignature::writeFn (cyclomatic 27) REDACTED:2504 — initSearch::execQuery::formatDisplayTypeSignature::writeFn has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::getRow (cyclomatic 25) REDACTED:1896 — initSearch::getRow has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • initSearch::execQuery::unifyGenericTypes (cyclomatic 23) REDACTED:3312 — initSearch::execQuery::unifyGenericTypes has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::transformResults (cyclomatic 22) REDACTED:2660 — initSearch::execQuery::transformResults has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::buildHrefAndPath (cyclomatic 18) REDACTED:2165 — initSearch::execQuery::buildHrefAndPath has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • initSearch::calculate (cyclomatic 17) REDACTED:199 — initSearch::calculate has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::parseQuery::parseInput (cyclomatic 17) REDACTED:1419 — initSearch::parseQuery::parseInput has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • initSearch::execQuery::innerRunTypeQuery (cyclomatic 17) REDACTED:4182 — initSearch::execQuery::innerRunTypeQuery has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ide_db · ×13
  • ide_db::syntax_helpers::format_string::lex_format_specifiers (cyclomatic 40) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string.rs:45 — ide_db::syntax_helpers::format_string::lex_format_specifiers has cyclomatic complexity 40 (threshold 15). Of this number, 35 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_db::syntax_helpers::format_string_exprs::parse_format_exprs (cyclomatic 29) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs:44 — ide_db::syntax_helpers::format_string_exprs::parse_format_exprs has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_db::prime_caches::parallel_prime_caches (cyclomatic 27) src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs:31 — ide_db::prime_caches::parallel_prime_caches has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ide_db::imports::insert_use::guess_granularity_from_scope (cyclomatic 23) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:340 — ide_db::imports::insert_use::guess_granularity_from_scope has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_db::imports::import_assets::filter_by_definition_kind (cyclomatic 19) src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs:553 — ide_db::imports::import_assets::filter_by_definition_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_db::imports::import_assets::validate_resolvable (cyclomatic 19) src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs:660 — ide_db::imports::import_assets::validate_resolvable has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_db::imports::insert_use::insert_use_with_alias_option_with_editor (cyclomatic 19) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:214 — ide_db::imports::insert_use::insert_use_with_alias_option_with_editor has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_db::syntax_helpers::node_ext::for_each_tail_expr (cyclomatic 19) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs:283 — ide_db::syntax_helpers::node_ext::for_each_tail_expr has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_db::traits::diff_assoc_items (cyclomatic 19) src/tools/rust-analyzer/crates/ide-db/src/traits.rs:56 — ide_db::traits::diff_assoc_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_db::imports::merge_imports::recursive_normalize (cyclomatic 17) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:292 — ide_db::imports::merge_imports::recursive_normalize has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ide_db::imports::merge_imports::version_sort::version_sort (cyclomatic 17) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:978 — ide_db::imports::merge_imports::version_sort::version_sort has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_db::syntax_helpers::tree_diff::diff (cyclomatic 17) src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/tree_diff.rs:51 — ide_db::syntax_helpers::tree_diff::diff has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (go, syntax_element_eq). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • ide_db::imports::merge_imports::use_tree_cmp (cyclomatic 16) src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs:521 — ide_db::imports::merge_imports::use_tree_cmp has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · hir_ty · ×13
  • hir_ty::layout::layout_of_ty_query (cognitive 75) src/tools/rust-analyzer/crates/hir-ty/src/layout.rs:162 — hir_ty::layout::layout_of_ty_query has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (54 pts), match/switch 9 (21 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::lower::path::substs_from_args_and_bindings (cognitive 50) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:1152 — hir_ty::lower::path::substs_from_args_and_bindings has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 3 (10 pts), match/switch 3 (9 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::lower::resolve_type_param_assoc_type_shorthand (cognitive 48) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2114 — hir_ty::lower::resolve_type_param_assoc_type_shorthand has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::next_solver::consts::valtree::allocation_to_const (cognitive 46) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs:73 — hir_ty::next_solver::consts::valtree::allocation_to_const has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (38 pts), match/switch 4 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cognitive 33) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2373 — hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::mir::lower::mir_body_for_closure_query (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1998 — hir_ty::mir::lower::mir_body_for_closure_query has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::next_solver::util::sizedness_fast_path (cognitive 20) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/util.rs:731 — hir_ty::next_solver::util::sizedness_fast_path has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::lower::generic_predicates (cognitive 18) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2778 — hir_ty::lower::generic_predicates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::drop::has_drop_glue_impl (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/drop.rs:52 — hir_ty::drop::has_drop_glue_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::dyn_compatibility::virtual_call_violations_for_method (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/dyn_compatibility.rs:315 — hir_ty::dyn_compatibility::virtual_call_violations_for_method has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • hir_ty::lower::path::check_generic_args_len (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:1059 — hir_ty::lower::path::check_generic_args_len has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, match/switch 3 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::traits::check_orphan_rules (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/traits.rs:334 — hir_ty::traits::check_orphan_rules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ty::consteval::literal_ty (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs:127 — hir_ty::consteval::literal_ty has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7 (16 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · parser · ×13
  • parser::grammar::expressions::atom::parse_asm_expr (cognitive 39) src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs:349 — parser::grammar::expressions::atom::parse_asm_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::expressions::atom::builtin_expr (cognitive 34) src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs:256 — parser::grammar::expressions::atom::builtin_expr has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::items::opt_item (cognitive 31) src/tools/rust-analyzer/crates/parser/src/grammar/items.rs:109 — parser::grammar::items::opt_item has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 13, match/switch 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • parser::grammar::expressions::expr_bp (cognitive 24) src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs:248 — parser::grammar::expressions::expr_bp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::params::param (cognitive 23) src/tools/rust-analyzer/crates/parser/src/grammar/params.rs:95 — parser::grammar::params::param has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • parser::grammar::paths::path_segment (cognitive 23) src/tools/rust-analyzer/crates/parser/src/grammar/paths.rs:87 — parser::grammar::paths::path_segment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::expressions::lhs (cognitive 21) src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs:339 — parser::grammar::expressions::lhs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • parser::grammar::items::adt::record_field_list (cognitive 21) src/tools/rust-analyzer/crates/parser/src/grammar/items/adt.rs:122 — parser::grammar::items::adt::record_field_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to one function item inside it that branches (record_field). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • parser::grammar::params::list_ (cognitive 20) src/tools/rust-analyzer/crates/parser/src/grammar/params.rs:32 — parser::grammar::params::list_ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::event::process (cognitive 17) src/tools/rust-analyzer/crates/parser/src/event.rs:89 — parser::event::process has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), match/switch 2 (6 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::expressions::record_expr_field_list (cognitive 17) src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs:708 — parser::grammar::expressions::record_expr_field_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::expressions::stmt (cognitive 16) src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs:43 — parser::grammar::expressions::stmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parser::grammar::patterns::pattern_single_r (cognitive 16) src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs:66 — parser::grammar::patterns::pattern_single_r has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · InferenceContext · ×12
  • InferenceContext::infer_expr_inner (cyclomatic 84) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:317 — InferenceContext::infer_expr_inner has cyclomatic complexity 84 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InferenceContext::resolve_variant (cyclomatic 48) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:2248 — InferenceContext::resolve_variant has cyclomatic complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • InferenceContext::infer_mut_expr_without_adjust (cyclomatic 40) src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs:55 — InferenceContext::infer_mut_expr_without_adjust has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InferenceContext::infer_pat_inner (cyclomatic 32) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:377 — InferenceContext::infer_pat_inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InferenceContext::try_find_coercion_lub (cyclomatic 29) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:926 — InferenceContext::try_find_coercion_lub has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • InferenceContext::analyze_closure (cyclomatic 26) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:229 — InferenceContext::analyze_closure has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InferenceContext::check_record_expr_fields (cyclomatic 24) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:968 — InferenceContext::check_record_expr_fields has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InferenceContext::check_call_arguments (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs:1920 — InferenceContext::check_call_arguments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InferenceContext::infer_ref_pat (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs:1356 — InferenceContext::infer_ref_pat has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InferenceContext::compute_min_captures (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis.rs:724 — InferenceContext::compute_min_captures has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • InferenceContext::deduce_closure_signature_from_predicates (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure.rs:421 — InferenceContext::deduce_closure_signature_from_predicates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InferenceContext::resolve_all (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:1635 — InferenceContext::resolve_all has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D1 · Cyclomatic Complexity · FunctionCx · ×12
  • FunctionCx::codegen_intrinsic_call (cyclomatic 83) compiler/rustc_codegen_ssa/src/mir/intrinsic.rs:56 — FunctionCx::codegen_intrinsic_call has cyclomatic complexity 83 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FunctionCx::codegen_call_terminator (cyclomatic 59) compiler/rustc_codegen_ssa/src/mir/block.rs:960 — FunctionCx::codegen_call_terminator has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_rvalue_operand (cyclomatic 43) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:496 — FunctionCx::codegen_rvalue_operand has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_scalar_binop (cyclomatic 31) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:888 — FunctionCx::codegen_scalar_binop has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_argument (cyclomatic 29) compiler/rustc_codegen_ssa/src/mir/block.rs:1964 — FunctionCx::codegen_argument has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_rvalue (cyclomatic 28) compiler/rustc_codegen_ssa/src/mir/rvalue.rs:101 — FunctionCx::codegen_rvalue has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::debug_introduce_local (cyclomatic 26) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:310 — FunctionCx::debug_introduce_local has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_statement (cyclomatic 23) compiler/rustc_codegen_ssa/src/mir/statement.rs:12 — FunctionCx::codegen_statement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_switchint_terminator (cyclomatic 21) compiler/rustc_codegen_ssa/src/mir/block.rs:428 — FunctionCx::codegen_switchint_terminator has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::compute_per_local_var_debug_info (cyclomatic 19) compiler/rustc_codegen_ssa/src/mir/debuginfo.rs:554 — FunctionCx::compute_per_local_var_debug_info has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::clear_variant_dependent_padding (cyclomatic 17) compiler/rustc_codegen_ssa/src/mir/block.rs:1828 — FunctionCx::clear_variant_dependent_padding has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionCx::codegen_place (cyclomatic 16) compiler/rustc_codegen_ssa/src/mir/place.rs:338 — FunctionCx::codegen_place has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · clippy_utils · ×12
  • clippy_utils::ast_utils::eq_expr (cyclomatic 63) src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:145 — clippy_utils::ast_utils::eq_expr has cyclomatic complexity 63 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::is_never_expr (cyclomatic 42) src/tools/clippy/clippy_utils/src/lib.rs:3002 — clippy_utils::is_never_expr has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_utils::eager_or_lazy::expr_eagerness (cyclomatic 36) src/tools/clippy/clippy_utils/src/eager_or_lazy.rs:117 — clippy_utils::eager_or_lazy::expr_eagerness has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::ast_utils::eq_item_kind (cyclomatic 32) src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:308 — clippy_utils::ast_utils::eq_item_kind has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::is_default_equivalent_call (cyclomatic 24) src/tools/clippy/clippy_utils/src/lib.rs:571 — clippy_utils::is_default_equivalent_call has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • clippy_utils::capture_local_usage (cyclomatic 22) src/tools/clippy/clippy_utils/src/lib.rs:830 — clippy_utils::capture_local_usage has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::visitors::for_each_unconsumed_temporary::helper (cyclomatic 22) src/tools/clippy/clippy_utils/src/visitors.rs:679 — clippy_utils::visitors::for_each_unconsumed_temporary::helper has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::paths::local_item_child_by_name (cyclomatic 21) src/tools/clippy/clippy_utils/src/paths.rs:287 — clippy_utils::paths::local_item_child_by_name has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: clippy_utils::paths::find_primitive_impls (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • clippy_utils::ty::type_certainty::expr_type_certainty (cyclomatic 20) src/tools/clippy/clippy_utils/src/ty/type_certainty/mod.rs:32 — clippy_utils::ty::type_certainty::expr_type_certainty has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::expr_use_sites (cyclomatic 18) src/tools/clippy/clippy_utils/src/lib.rs:2679 — clippy_utils::expr_use_sites has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • clippy_utils::consts::mir_to_const (cyclomatic 17) src/tools/clippy/clippy_utils/src/consts.rs:1145 — clippy_utils::consts::mir_to_const has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_utils::qualify_min_const_fn::check_rvalue (cyclomatic 16) src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs:130 — clippy_utils::qualify_min_const_fn::check_rvalue has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · search.initSearch · ×12
  • search.initSearch::unifyFunctionTypes (cyclomatic 47) REDACTED:2979 — search.initSearch::unifyFunctionTypes has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getNextElem (cyclomatic 36) REDACTED:594 — search.initSearch::getNextElem has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::unifyFunctionTypeIsMatchCandidate (cyclomatic 33) REDACTED:3524 — search.initSearch::unifyFunctionTypeIsMatchCandidate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getItemsBefore (cyclomatic 28) REDACTED:440 — search.initSearch::getItemsBefore has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getNextElem, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::formatDisplayTypeSignature::writeFn (cyclomatic 27) REDACTED:2504 — search.initSearch::formatDisplayTypeSignature::writeFn has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::unifyGenericTypes (cyclomatic 23) REDACTED:3312 — search.initSearch::unifyGenericTypes has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::getIdentEndPosition (cyclomatic 22) REDACTED:964 — search.initSearch::getIdentEndPosition has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::transformResults (cyclomatic 22) REDACTED:2660 — search.initSearch::transformResults has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::createQueryElement (cyclomatic 20) REDACTED:806 — search.initSearch::createQueryElement has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::buildHrefAndPath (cyclomatic 18) REDACTED:2165 — search.initSearch::buildHrefAndPath has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::parseInput (cyclomatic 17) REDACTED:1419 — search.initSearch::parseInput has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • search.initSearch::showResults (cyclomatic 16) REDACTED:5233 — search.initSearch::showResults has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch, search.initSearch::getItemsBefore, search.initSearch::getNextElem, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · TypeChecker · ×12
  • TypeChecker::visit_rvalue (cognitive 240) compiler/rustc_mir_transform/src/validate.rs:1018 — TypeChecker::visit_rvalue has cognitive complexity 240 (threshold 15). Drivers by points: if/else 66 (196 pts), loops 10 (30 pts), match/switch 5 (9 pts), boolean chains 5 (nesting depth added 154). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeChecker::visit_rvalue (cognitive 116) compiler/rustc_borrowck/src/type_check/mod.rs:992 — TypeChecker::visit_rvalue has cognitive complexity 116 (threshold 15). Drivers by points: if/else 22 (61 pts), match/switch 17 (49 pts), boolean chains 6 (nesting depth added 71). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::visit_projection_elem (cognitive 86) compiler/rustc_mir_transform/src/validate.rs:668 — TypeChecker::visit_projection_elem has cognitive complexity 86 (threshold 15). Drivers by points: if/else 29 (73 pts), match/switch 6 (11 pts), boolean chains 2 (nesting depth added 49). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::visit_terminator (cognitive 36) compiler/rustc_borrowck/src/type_check/mod.rs:739 — TypeChecker::visit_terminator has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::visit_const_operand (cognitive 31) compiler/rustc_borrowck/src/type_check/mod.rs:1735 — TypeChecker::visit_const_operand has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 3 (9 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeChecker::add_generic_reborrow_constraint (cognitive 26) compiler/rustc_borrowck/src/type_check/mod.rs:2484 — TypeChecker::add_generic_reborrow_constraint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeChecker::visit_statement (cognitive 26) compiler/rustc_mir_transform/src/validate.rs:1482 — TypeChecker::visit_statement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::check_iscleanup (cognitive 23) compiler/rustc_borrowck/src/type_check/mod.rs:2081 — TypeChecker::check_iscleanup has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::visit_statement (cognitive 21) compiler/rustc_borrowck/src/type_check/mod.rs:606 — TypeChecker::visit_statement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TypeChecker::check_call_dest (cognitive 19) compiler/rustc_borrowck/src/type_check/mod.rs:1952 — TypeChecker::check_call_dest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeChecker::check_call_inputs (cognitive 18) compiler/rustc_borrowck/src/type_check/mod.rs:2017 — TypeChecker::check_call_inputs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeChecker::add_reborrow_constraint (cognitive 18) compiler/rustc_borrowck/src/type_check/mod.rs:2357 — TypeChecker::add_reborrow_constraint has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 4 (5 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_expand · ×12
  • rustc_expand::mbe::macro_rules::check_matcher_core (cognitive 78) compiler/rustc_expand/src/mbe/macro_rules.rs:1453 — rustc_expand::mbe::macro_rules::check_matcher_core has cognitive complexity 78 (threshold 15). Drivers by points: if/else 15 (47 pts), loops 4 (14 pts), match/switch 3 (13 pts), boolean chains 4 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::mbe::macro_rules::compile_declarative_macro (cognitive 57) compiler/rustc_expand/src/mbe/macro_rules.rs:780 — rustc_expand::mbe::macro_rules::compile_declarative_macro has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (54 pts), boolean chains 2, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::mbe::diagnostics::emit_frag_parse_err (cognitive 54) compiler/rustc_expand/src/mbe/diagnostics.rs:368 — rustc_expand::mbe::diagnostics::emit_frag_parse_err has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (40 pts), loops 3 (10 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::mbe::macro_rules::is_in_follow (cognitive 53) compiler/rustc_expand/src/mbe/macro_rules.rs:1731 — rustc_expand::mbe::macro_rules::is_in_follow has cognitive complexity 53 (threshold 15). Drivers by points: match/switch 13 (44 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 35). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_expand::mbe::quoted::parse_tree (cognitive 43) compiler/rustc_expand/src/mbe/quoted.rs:233 — rustc_expand::mbe::quoted::parse_tree has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 5 (14 pts), boolean chains 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_expand::mbe::diagnostics::failed_to_match_macro (cognitive 33) compiler/rustc_expand/src/mbe/diagnostics.rs:29 — rustc_expand::mbe::diagnostics::failed_to_match_macro has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 5, loops 2 (3 pts), match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::mbe::transcribe::transcribe (cognitive 32) compiler/rustc_expand/src/mbe/transcribe.rs:175 — rustc_expand::mbe::transcribe::transcribe has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (26 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_expand::mbe::transcribe::transcribe_sequence (cognitive 32) compiler/rustc_expand/src/mbe/transcribe.rs:304 — rustc_expand::mbe::transcribe::transcribe_sequence has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_expand::config::features (cognitive 29) compiler/rustc_expand/src/config.rs:47 — rustc_expand::config::features has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::mbe::quoted::parse (cognitive 25) compiler/rustc_expand/src/mbe/quoted.rs:61 — rustc_expand::mbe::quoted::parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_expand::expand::parse_ast_fragment (cognitive 17) compiler/rustc_expand/src/expand.rs:1079 — rustc_expand::expand::parse_ast_fragment has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_expand::mbe::macro_check::check_binders (cognitive 16) compiler/rustc_expand/src/mbe/macro_check.rs:223 — rustc_expand::mbe::macro_check::check_binders has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · State · ×12
  • State::print_pat (cognitive 72) compiler/rustc_hir_pretty/src/lib.rs:2021 — State::print_pat has cognitive complexity 72 (threshold 15). Drivers by points: if/else 30 (68 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 39). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_expr_outer_attr_style (cognitive 62) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:385 — State::print_expr_outer_attr_style has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (41 pts), boolean chains 7, loops 3 (7 pts), match/switch 4 (7 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • State::print_pat (cognitive 53) compiler/rustc_ast_pretty/src/pprust/state.rs:1917 — State::print_pat has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (49 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_item (cognitive 37) compiler/rustc_ast_pretty/src/pprust/state/item.rs:163 — State::print_item has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 3 (7 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • State::print_inline_asm (cognitive 29) compiler/rustc_ast_pretty/src/pprust/state.rs:1762 — State::print_inline_asm has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 5 (11 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • State::print_use_tree (cognitive 25) compiler/rustc_ast_pretty/src/pprust/state/item.rs:890 — State::print_use_tree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_item (cognitive 24) compiler/rustc_hir_pretty/src/lib.rs:594 — State::print_item has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_expr (cognitive 24) compiler/rustc_hir_pretty/src/lib.rs:1564 — State::print_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), match/switch 2 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_inline_asm (cognitive 22) compiler/rustc_hir_pretty/src/lib.rs:1473 — State::print_inline_asm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (9 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • State::print_expr_struct (cognitive 19) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:148 — State::print_expr_struct has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • State::print_type (cognitive 17) compiler/rustc_hir_pretty/src/lib.rs:390 — State::print_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • State::print_fn (cognitive 16) compiler/rustc_hir_pretty/src/lib.rs:2269 — State::print_fn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_attr_parsing · ×12
  • rustc_attr_parsing::check_cfg::unexpected_cfg_name (cognitive 46) compiler/rustc_attr_parsing/src/check_cfg.rs:110 — rustc_attr_parsing::check_cfg::unexpected_cfg_name has cognitive complexity 46 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 12). Of this number, 43 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::attributes::diagnostic::parse_directive_items (cognitive 39) compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs:276 — rustc_attr_parsing::attributes::diagnostic::parse_directive_items has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 4 (10 pts), loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::check_cfg::unexpected_cfg_value (cognitive 30) compiler/rustc_attr_parsing/src/check_cfg.rs:293 — rustc_attr_parsing::check_cfg::unexpected_cfg_value has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_attr_parsing::attributes::cfg::eval_config_entry (cognitive 28) compiler/rustc_attr_parsing/src/attributes/cfg.rs:229 — rustc_attr_parsing::attributes::cfg::eval_config_entry has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_attr_parsing::attributes::proc_macro_attrs::parse_derive_like (cognitive 28) compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:59 — rustc_attr_parsing::attributes::proc_macro_attrs::parse_derive_like has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::attributes::cfg_select::lint_unreachable (cognitive 21) compiler/rustc_attr_parsing/src/attributes/cfg_select.rs:159 — rustc_attr_parsing::attributes::cfg_select::lint_unreachable has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 1 (2 pts), loops 2 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_attr_parsing::attributes::cfg::parse_cfg_entry (cognitive 19) compiler/rustc_attr_parsing/src/attributes/cfg.rs:79 — rustc_attr_parsing::attributes::cfg::parse_cfg_entry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (11 pts), match/switch 4 (8 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_attr_parsing::attributes::crate_level::parse_register_tool (cognitive 19) compiler/rustc_attr_parsing/src/attributes/crate_level.rs:330 — rustc_attr_parsing::attributes::crate_level::parse_register_tool has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::attributes::rustc_internal::parse_cgu_fields (cognitive 19) compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs:254 — rustc_attr_parsing::attributes::rustc_internal::parse_cgu_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::parser::expr_to_lit (cognitive 19) compiler/rustc_attr_parsing/src/parser.rs:408 — rustc_attr_parsing::parser::expr_to_lit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_attr_parsing::validate_attr::emit_malformed_attribute (cognitive 17) compiler/rustc_attr_parsing/src/validate_attr.rs:178 — rustc_attr_parsing::validate_attr::emit_malformed_attribute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_attr_parsing::attributes::stability::parse_unstability (cognitive 16) compiler/rustc_attr_parsing/src/attributes/stability.rs:393 — rustc_attr_parsing::attributes::stability::parse_unstability has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D1 · Cyclomatic Complexity · InterpCx · ×11
  • InterpCx::eval_simd_intrinsic (cyclomatic 141) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:21 — InterpCx::eval_simd_intrinsic has cyclomatic complexity 141 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InterpCx::eval_intrinsic (cyclomatic 95) compiler/rustc_const_eval/src/interpret/intrinsics.rs:172 — InterpCx::eval_intrinsic has cyclomatic complexity 95 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InterpCx::binary_int_op (cyclomatic 60) compiler/rustc_const_eval/src/interpret/operator.rs:97 — InterpCx::binary_int_op has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InterpCx::cast (cyclomatic 25) compiler/rustc_const_eval/src/interpret/cast.rs:23 — InterpCx::cast has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InterpCx::init_stack_frame (cyclomatic 24) compiler/rustc_const_eval/src/interpret/call.rs:469 — InterpCx::init_stack_frame has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InterpCx::eval_atomic_intrinsic (cyclomatic 23) compiler/rustc_const_eval/src/interpret/intrinsics/atomic.rs:14 — InterpCx::eval_atomic_intrinsic has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InterpCx::eval_terminator (cyclomatic 22) compiler/rustc_const_eval/src/interpret/step.rs:537 — InterpCx::eval_terminator has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InterpCx::eval_rvalue_into_place (cyclomatic 21) compiler/rustc_const_eval/src/interpret/step.rs:160 — InterpCx::eval_rvalue_into_place has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InterpCx::layout_compat (cyclomatic 16) compiler/rustc_const_eval/src/interpret/call.rs:295 — InterpCx::layout_compat has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InterpCx::init_fn_call (cyclomatic 16) compiler/rustc_const_eval/src/interpret/call.rs:755 — InterpCx::init_fn_call has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InterpCx::mem_copy_repeatedly (cyclomatic 16) compiler/rustc_const_eval/src/interpret/memory.rs:1490 — InterpCx::mem_copy_repeatedly has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · hir_ty · ×11
  • hir_ty::layout::layout_of_ty_query (cyclomatic 59) src/tools/rust-analyzer/crates/hir-ty/src/layout.rs:162 — hir_ty::layout::layout_of_ty_query has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::next_solver::consts::valtree::allocation_to_const (cyclomatic 40) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs:73 — hir_ty::next_solver::consts::valtree::allocation_to_const has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::consteval::literal_ty (cyclomatic 24) src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs:127 — hir_ty::consteval::literal_ty has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_ty::drop::has_drop_glue_impl (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/drop.rs:52 — hir_ty::drop::has_drop_glue_impl has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_ty::lower::resolve_type_param_assoc_type_shorthand (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2114 — hir_ty::lower::resolve_type_param_assoc_type_shorthand has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::lower::path::substs_from_args_and_bindings (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:1152 — hir_ty::lower::path::substs_from_args_and_bindings has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:2373 — hir_ty::lower::remap_gat_vars_and_recurse_into_nested_projections has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::lower::path::check_generic_args_len (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:1059 — hir_ty::lower::path::check_generic_args_len has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_ty::mir::lower::mir_body_for_closure_query (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1998 — hir_ty::mir::lower::mir_body_for_closure_query has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ty::consteval::intern_const_ref (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs:56 — hir_ty::consteval::intern_const_ref has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_ty::infer::infer_query_with_inspect (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/infer.rs:123 — hir_ty::infer::infer_query_with_inspect has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D1 · Cyclomatic Complexity · rustc_trait_selection · ×11
  • rustc_trait_selection::traits::project::assemble_candidates_from_impls (cyclomatic 28) compiler/rustc_trait_selection/src/traits/project.rs:975 — rustc_trait_selection::traits::project::assemble_candidates_from_impls has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_trait_selection::traits::dyn_compatibility::virtual_call_violations_for_method (cyclomatic 24) compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs:437 — rustc_trait_selection::traits::dyn_compatibility::virtual_call_violations_for_method has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::error_reporting::infer::region::suggest_precise_capturing (cyclomatic 23) compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:1412 — rustc_trait_selection::error_reporting::infer::region::suggest_precise_capturing has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::error_reporting::traits::call_kind::call_kind (cyclomatic 23) compiler/rustc_trait_selection/src/error_reporting/traits/call_kind.rs:84 — rustc_trait_selection::error_reporting::traits::call_kind::call_kind has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable (cyclomatic 22) compiler/rustc_trait_selection/src/traits/const_evaluatable.rs:24 — rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::error_reporting::infer::nice_region_error::static_impl_trait::suggest_new_region_bound (cyclomatic 21) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs:137 — rustc_trait_selection::error_reporting::infer::nice_region_error::static_impl_trait::suggest_new_region_bound has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::traits::try_evaluate_const (cyclomatic 19) compiler/rustc_trait_selection/src/traits/mod.rs:628 — rustc_trait_selection::traits::try_evaluate_const has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::traits::misc::type_allowed_to_implement_const_param_ty (cyclomatic 18) compiler/rustc_trait_selection/src/traits/misc.rs:92 — rustc_trait_selection::traits::misc::type_allowed_to_implement_const_param_ty has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_trait_selection::traits::query::dropck_outlives::dtorck_constraint_for_ty_inner (cyclomatic 18) compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs:255 — rustc_trait_selection::traits::query::dropck_outlives::dtorck_constraint_for_ty_inner has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_trait_selection::traits::project::confirm_async_closure_candidate (cyclomatic 17) compiler/rustc_trait_selection/src/traits/project.rs:1769 — rustc_trait_selection::traits::project::confirm_async_closure_candidate has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations_for_assoc_item (cyclomatic 16) compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs:346 — rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations_for_assoc_item has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · core · ×11
  • core::num::imp::dec2flt::decimal_seq::parse_decimal_seq (cyclomatic 22) library/core/src/num/imp/dec2flt/decimal_seq.rs:222 — core::num::imp::dec2flt::decimal_seq::parse_decimal_seq has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • core::str::validations::run_utf8_validation (cyclomatic 21) library/core/src/str/validations.rs:126 — core::str::validations::run_utf8_validation has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • core::num::imp::flt2dec::strategy::dragon::format_exact (cyclomatic 20) library/core/src/num/imp/flt2dec/strategy/dragon.rs:296 — core::num::imp::flt2dec::strategy::dragon::format_exact has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • core::num::imp::flt2dec::strategy::grisu::format_exact_opt (cyclomatic 20) library/core/src/num/imp/flt2dec/strategy/grisu.rs:473 — core::num::imp::flt2dec::strategy::grisu::format_exact_opt has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • core::escape::escape_ascii (cyclomatic 19) library/core/src/escape.rs:61 — core::escape::escape_ascii has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • core::fmt::num::exp_u128 (cyclomatic 19) library/core/src/fmt/num.rs:620 — core::fmt::num::exp_u128 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u32, core::fmt::num::imp::exp_u64) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u64 (cyclomatic 19) library/core/src/fmt/num.rs:607 — core::fmt::num::imp::exp_u64 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u32, core::fmt::num::imp::exp_u64, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u32 (cyclomatic 19) library/core/src/fmt/num.rs:617 — core::fmt::num::imp::exp_u32 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u64, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::fmt::num::imp::exp_u64 (cyclomatic 19) library/core/src/fmt/num.rs:618 — core::fmt::num::imp::exp_u64 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (core::fmt::num::imp::exp_u64, core::fmt::num::imp::exp_u32, core::fmt::num::exp_u128) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • core::num::imp::dec2flt::slow::parse_long_mantissa (cyclomatic 18) library/core/src/num/imp/dec2flt/slow.rs:27 — core::num::imp::dec2flt::slow::parse_long_mantissa has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • core::str::pattern::simd_contains (cyclomatic 16) library/core/src/str/pattern.rs:1894 — core::str::pattern::simd_contains has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · Evaluator · ×11
  • Evaluator::exec_intrinsic (cognitive 213) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:560 — Evaluator::exec_intrinsic has cognitive complexity 213 (threshold 15). Drivers by points: if/else 86 (177 pts), match/switch 14 (27 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Evaluator::eval_rvalue (cognitive 146) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1029 — Evaluator::eval_rvalue has cognitive complexity 146 (threshold 15). Drivers by points: match/switch 25 (68 pts), if/else 24 (66 pts), loops 4 (12 pts) (nesting depth added 93). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Evaluator::exec_simd_intrinsic (cognitive 45) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs:51 — Evaluator::exec_simd_intrinsic has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 5 (11 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Evaluator::interpret_mir (cognitive 44) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:796 — Evaluator::interpret_mir has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (15 pts), loops 4 (9 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Evaluator::place_addr_and_ty_and_metadata (cognitive 39) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:638 — Evaluator::place_addr_and_ty_and_metadata has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 8 (27 pts), if/else 5 (11 pts), loops 1 (nesting depth added 25). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Evaluator::create_memory_map::rec (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2223 — Evaluator::create_memory_map::rec has cognitive complexity 35 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (13 pts), if/else 3 (7 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Evaluator::exec_extern_c (cognitive 33) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:396 — Evaluator::exec_extern_c has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 4 (7 pts), loops 1 (2 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Evaluator::patch_addresses (cognitive 32) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2396 — Evaluator::patch_addresses has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (15 pts), match/switch 6 (11 pts), if/else 2 (6 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Evaluator::exec_atomic_intrinsic (cognitive 20) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:1511 — Evaluator::exec_atomic_intrinsic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Evaluator::run_drop_glue_deep (cognitive 18) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2952 — Evaluator::run_drop_glue_deep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (6 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Evaluator::unsizing_ptr_from_addr (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1619 — Evaluator::unsizing_ptr_from_addr has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 2 (6 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InterpCx · ×11
  • InterpCx::eval_simd_intrinsic (cognitive 172) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:21 — InterpCx::eval_simd_intrinsic has cognitive complexity 172 (threshold 15). Drivers by points: if/else 36 (83 pts), match/switch 20 (51 pts), loops 18 (36 pts), boolean chains 2 (nesting depth added 96). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • InterpCx::eval_intrinsic (cognitive 62) compiler/rustc_const_eval/src/interpret/intrinsics.rs:172 — InterpCx::eval_intrinsic has cognitive complexity 62 (threshold 15). Drivers by points: if/else 25 (45 pts), match/switch 8 (15 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::binary_int_op (cognitive 61) compiler/rustc_const_eval/src/interpret/operator.rs:97 — InterpCx::binary_int_op has cognitive complexity 61 (threshold 15). Drivers by points: if/else 22 (43 pts), match/switch 7 (12 pts), boolean chains 6 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::init_stack_frame (cognitive 34) compiler/rustc_const_eval/src/interpret/call.rs:469 — InterpCx::init_stack_frame has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 4, loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::read_discriminant (cognitive 27) compiler/rustc_const_eval/src/interpret/discriminant.rs:53 — InterpCx::read_discriminant has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::deref_pointer (cognitive 25) compiler/rustc_const_eval/src/interpret/place.rs:469 — InterpCx::deref_pointer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::init_fn_call (cognitive 24) compiler/rustc_const_eval/src/interpret/call.rs:755 — InterpCx::init_fn_call has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::cast (cognitive 22) compiler/rustc_const_eval/src/interpret/cast.rs:23 — InterpCx::cast has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InterpCx::mem_copy_repeatedly (cognitive 21) compiler/rustc_const_eval/src/interpret/memory.rs:1490 — InterpCx::mem_copy_repeatedly has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • InterpCx::eval_rvalue_into_place (cognitive 21) compiler/rustc_const_eval/src/interpret/step.rs:160 — InterpCx::eval_rvalue_into_place has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • InterpCx::eval_terminator (cognitive 21) compiler/rustc_const_eval/src/interpret/step.rs:537 — InterpCx::eval_terminator has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LoweringContext · ×11
  • LoweringContext::lower_inline_asm (cognitive 131) compiler/rustc_ast_lowering/src/asm.rs:25 — LoweringContext::lower_inline_asm has cognitive complexity 131 (threshold 15). Drivers by points: if/else 35 (86 pts), match/switch 9 (27 pts), loops 6 (11 pts), boolean chains 7 (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_assoc_item_constraint (cognitive 32) compiler/rustc_ast_lowering/src/lib.rs:1232 — LoweringContext::lower_assoc_item_constraint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 5 (12 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_path_segment (cognitive 29) compiler/rustc_ast_lowering/src/path.rs:254 — LoweringContext::lower_path_segment has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4 (12 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_expr_mut (cognitive 27) compiler/rustc_ast_lowering/src/expr.rs:219 — LoweringContext::lower_expr_mut has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (8 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LoweringContext::lower_qpath (cognitive 27) compiler/rustc_ast_lowering/src/path.rs:27 — LoweringContext::lower_qpath has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), match/switch 4 (6 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • LoweringContext::lower_variant_data (cognitive 26) compiler/rustc_ast_lowering/src/item.rs:710 — LoweringContext::lower_variant_data has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LoweringContext::finalize_body_lowering (cognitive 22) compiler/rustc_ast_lowering/src/delegation/mod.rs:363 — LoweringContext::finalize_body_lowering has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 4 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_expr_range (cognitive 21) compiler/rustc_ast_lowering/src/expr.rs:1492 — LoweringContext::lower_expr_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_legacy_const_generics (cognitive 20) compiler/rustc_ast_lowering/src/expr.rs:594 — LoweringContext::lower_legacy_const_generics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoweringContext::lower_ty (cognitive 17) compiler/rustc_ast_lowering/src/lib.rs:1537 — LoweringContext::lower_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 4 (8 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LoweringContext::lower_fn_decl (cognitive 17) compiler/rustc_ast_lowering/src/lib.rs:1938 — LoweringContext::lower_fn_decl has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 5 (6 pts), boolean chains 1 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D1 · Cyclomatic Complexity · rust_analyzer · ×10
  • rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs (cyclomatic 95) src/tools/rust-analyzer/crates/rust-analyzer/src/config/patch_old_style.rs:10 — rust_analyzer::config::patch_old_style::patch_json_for_outdated_configs has cyclomatic complexity 95 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers (cyclomatic 82) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:818 — rust_analyzer::lsp::to_proto::semantic_token_type_and_modifiers has cyclomatic complexity 82 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rust_analyzer::handlers::notification::run_flycheck (cyclomatic 28) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs:330 — rust_analyzer::handlers::notification::run_flycheck has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rust_analyzer::lsp::to_proto::completion_item (cyclomatic 25) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:291 — rust_analyzer::lsp::to_proto::completion_item has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp (cyclomatic 24) src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs:281 — rust_analyzer::diagnostics::flycheck_to_proto::map_rust_diagnostic_to_lsp has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rust_analyzer::handlers::request::handle_runnables (cyclomatic 21) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:1016 — rust_analyzer::handlers::request::handle_runnables has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rust_analyzer::handlers::request::run_rustfmt (cyclomatic 21) src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs:2405 — rust_analyzer::handlers::request::run_rustfmt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rust_analyzer::lsp::completion_item_hash (cyclomatic 17) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp.rs:37 — rust_analyzer::lsp::completion_item_hash has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (hash_completion_relevance). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rust_analyzer::lsp::to_proto::code_lens (cyclomatic 17) src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs:1759 — rust_analyzer::lsp::to_proto::code_lens has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::lsp::to_proto::completion_item_kind (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rust_analyzer::session::run_session (cyclomatic 16) src/tools/rust-analyzer/crates/rust-analyzer/src/session.rs:37 — rust_analyzer::session::run_session has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · DefCollector · ×10
  • DefCollector::resolve_macros (cognitive 75) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1306 — DefCollector::resolve_macros has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (56 pts), match/switch 6 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • DefCollector::record_resolved_import (cognitive 53) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:882 — DefCollector::record_resolved_import has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 6 (16 pts), boolean chains 1 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • DefCollector::build_reduced_graph_for_use_tree (cognitive 43) compiler/rustc_resolve/src/build_reduced_graph.rs:592 — DefCollector::build_reduced_graph_for_use_tree has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 11, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::seed_with_top_level (cognitive 31) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:277 — DefCollector::seed_with_top_level has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 4 (9 pts), boolean chains 3, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::push_res_and_update_glob_vis (cognitive 31) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1202 — DefCollector::push_res_and_update_glob_vis has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 9 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::process_macro_use_imports (cognitive 27) compiler/rustc_resolve/src/build_reduced_graph.rs:1150 — DefCollector::process_macro_use_imports has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::build_reduced_graph_for_item (cognitive 20) compiler/rustc_resolve/src/build_reduced_graph.rs:823 — DefCollector::build_reduced_graph_for_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • DefCollector::update_recursive (cognitive 20) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1111 — DefCollector::update_recursive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (8 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::resolution_loop (cognitive 18) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:420 — DefCollector::resolution_loop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefCollector::build_reduced_graph_for_extern_crate (cognitive 16) compiler/rustc_resolve/src/build_reduced_graph.rs:1000 — DefCollector::build_reduced_graph_for_extern_crate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×10
  • Duplicated block (20 lines × 2) compiler/rustc_abi/src/lib.rs:515 — compiler/rustc_abi/src/lib.rs:515-534 | compiler/rustc_abi/src/lib.rs:560-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) compiler/rustc_resolve/src/ident.rs:646 — compiler/rustc_resolve/src/ident.rs:646-665 | compiler/rustc_resolve/src/ident.rs:697-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) library/compiler-builtins/libm/src/math/j0.rs:287 — library/compiler-builtins/libm/src/math/j0.rs:287-306 | library/compiler-builtins/libm/src/math/j1.rs:279-298 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j1.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) library/compiler-builtins/libm/src/math/j0.rs:399 — library/compiler-builtins/libm/src/math/j0.rs:399-418 | library/compiler-builtins/libm/src/math/j1.rs:391-410 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j1.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) library/compiler-builtins/libm/src/math/j0f.rs:224 — library/compiler-builtins/libm/src/math/j0f.rs:224-243 | library/compiler-builtins/libm/src/math/j1f.rs:223-242 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0f.rs` and `library/compiler-builtins/libm/src/math/j1f.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) library/compiler-builtins/libm/src/math/j0f.rs:336 — library/compiler-builtins/libm/src/math/j0f.rs:336-355 | library/compiler-builtins/libm/src/math/j1f.rs:335-354 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0f.rs` and `library/compiler-builtins/libm/src/math/j1f.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) library/compiler-builtins/libm/src/math/sinf.rs:32 — library/compiler-builtins/libm/src/math/sinf.rs:32-51 | library/compiler-builtins/libm/src/math/tanf.rs:32-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (20 lines × 2) library/core/src/str/pattern.rs:1744 — library/core/src/str/pattern.rs:1744-1763 | library/core/src/str/pattern.rs:1791-1810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) library/std/src/sync/mpmc/array.rs:147 — library/std/src/sync/mpmc/array.rs:147-166 | library/std/src/sync/mpmc/array.rs:231-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) compiler/rustc_codegen_cranelift/example/track-caller-attribute.rs:21 — compiler/rustc_codegen_cranelift/example/track-caller-attribute.rs:21-40 | compiler/rustc_codegen_gcc/example/track-caller-attribute.rs:21-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
R4 · Test Coverage · No test reaches this file · ×10
  • No test reaches this file REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/stringdex.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/main.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/tools/rustdoc-js/tester.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/storage.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/settings.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/src-script.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/librustdoc/html/static/js/scrape-examples.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/tools/error_index_generator/redirect.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file src/tools/error_index_generator/error-index.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D1 · Cyclomatic Complexity · rustc_codegen_gcc · ×9
  • rustc_codegen_gcc::intrinsic::old_archs::old_archs (cyclomatic 1362) compiler/rustc_codegen_gcc/src/intrinsic/old_archs.rs:13 — rustc_codegen_gcc::intrinsic::old_archs::old_archs has cyclomatic complexity 1362 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic (cyclomatic 218) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:28 — rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic has cyclomatic complexity 218 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic::simd_simple_float_intrinsic) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_codegen_gcc::asm::modifier_to_gcc (cyclomatic 58) compiler/rustc_codegen_gcc/src/asm.rs:1064 — rustc_codegen_gcc::asm::modifier_to_gcc has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_gcc::asm::reg_class_to_gcc (cyclomatic 66) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments (cyclomatic 45) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:119 — rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustc_codegen_gcc::intrinsic::llvm::intrinsic (cyclomatic 630) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_gcc::gcc_util::new_context (cyclomatic 34) compiler/rustc_codegen_gcc/src/gcc_util.rs:229 — rustc_codegen_gcc::gcc_util::new_context has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rustc_codegen_gcc::gcc_util::to_gcc_aarch64_extension (cyclomatic 62) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic::simd_simple_float_intrinsic (cyclomatic 25) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:852 — rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic::simd_simple_float_intrinsic has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_codegen_gcc::abi::conv_to_fn_attribute (cyclomatic 24) compiler/rustc_codegen_gcc/src/abi.rs:333 — rustc_codegen_gcc::abi::conv_to_fn_attribute has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_codegen_gcc::back::write::codegen (cyclomatic 23) compiler/rustc_codegen_gcc/src/back/write.rs:18 — rustc_codegen_gcc::back::write::codegen has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_codegen_gcc::attributes::from_fn_attrs (cyclomatic 19) compiler/rustc_codegen_gcc/src/attributes.rs:102 — rustc_codegen_gcc::attributes::from_fn_attrs has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Evaluator · ×9
  • Evaluator::exec_intrinsic (cyclomatic 197) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:560 — Evaluator::exec_intrinsic has cyclomatic complexity 197 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Evaluator::eval_rvalue (cyclomatic 100) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:1029 — Evaluator::eval_rvalue has cyclomatic complexity 100 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Evaluator::exec_extern_c (cyclomatic 27) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:396 — Evaluator::exec_extern_c has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Evaluator::exec_simd_intrinsic (cyclomatic 26) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs:51 — Evaluator::exec_simd_intrinsic has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Evaluator::interpret_mir (cyclomatic 24) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:796 — Evaluator::interpret_mir has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Evaluator::create_memory_map::rec (cyclomatic 22) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2223 — Evaluator::create_memory_map::rec has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Evaluator::exec_atomic_intrinsic (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs:1511 — Evaluator::exec_atomic_intrinsic has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Evaluator::patch_addresses (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:2396 — Evaluator::patch_addresses has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Evaluator::place_addr_and_ty_and_metadata (cyclomatic 18) src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs:638 — Evaluator::place_addr_and_ty_and_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · State · ×9
  • State::print_expr_outer_attr_style (cyclomatic 86) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:385 — State::print_expr_outer_attr_style has cyclomatic complexity 86 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • State::print_expr (cyclomatic 46) compiler/rustc_hir_pretty/src/lib.rs:1564 — State::print_expr has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • State::print_pat (cyclomatic 44) compiler/rustc_ast_pretty/src/pprust/state.rs:1917 — State::print_pat has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PrintState::token_kind_to_string_ext (cyclomatic 60) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • State::print_pat (cyclomatic 44) compiler/rustc_hir_pretty/src/lib.rs:2021 — State::print_pat has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • State::print_item (cyclomatic 40) compiler/rustc_ast_pretty/src/pprust/state/item.rs:163 — State::print_item has cyclomatic complexity 40 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • State::print_item (cyclomatic 27) compiler/rustc_hir_pretty/src/lib.rs:594 — State::print_item has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: State::print_node (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • State::print_type (cyclomatic 24) compiler/rustc_hir_pretty/src/lib.rs:390 — State::print_type has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: State::print_node (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • State::print_inline_asm (cyclomatic 19) compiler/rustc_ast_pretty/src/pprust/state.rs:1762 — State::print_inline_asm has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PrintState::token_kind_to_string_ext (cyclomatic 60) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • State::print_inline_asm (cyclomatic 16) compiler/rustc_hir_pretty/src/lib.rs:1473 — State::print_inline_asm has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: State::print_node (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rustc_middle · ×9
  • rustc_middle::thir::visit::walk_expr (cyclomatic 56) compiler/rustc_middle/src/thir/visit.rs:43 — rustc_middle::thir::visit::walk_expr has cyclomatic complexity 56 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_middle::ty::diagnostics::suggest_constraining_type_params (cyclomatic 39) compiler/rustc_middle/src/ty/diagnostics.rs:287 — rustc_middle::ty::diagnostics::suggest_constraining_type_params has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_middle::lint::emit_lint_base::emit_lint_base_impl (cyclomatic 30) compiler/rustc_middle/src/lint.rs:395 — rustc_middle::lint::emit_lint_base::emit_lint_base_impl has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_middle::ty::typetree::typetree_from_ty_impl_inner (cyclomatic 27) compiler/rustc_middle/src/ty/typetree.rs:100 — rustc_middle::ty::typetree::typetree_from_ty_impl_inner has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_middle::mir::pretty::pretty_print_const_value_tcx (cyclomatic 22) compiler/rustc_middle/src/mir/pretty.rs:1928 — rustc_middle::mir::pretty::pretty_print_const_value_tcx has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_middle::mir::pretty::write_scope_tree (cyclomatic 21) compiler/rustc_middle/src/mir/pretty.rs:411 — rustc_middle::mir::pretty::write_scope_tree has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_middle::mir::pretty::write_allocation_bytes (cyclomatic 19) compiler/rustc_middle/src/mir/pretty.rs:1764 — rustc_middle::mir::pretty::write_allocation_bytes has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: TerminatorKind::fmt_successor_labels (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_middle::mir::pretty::write_allocations (cyclomatic 18) compiler/rustc_middle/src/mir/pretty.rs:1584 — rustc_middle::mir::pretty::write_allocations has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: TerminatorKind::fmt_successor_labels (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • rustc_middle::ty::print::pretty::for_each_def (cyclomatic 17) compiler/rustc_middle/src/ty/print/pretty.rs:3470 — rustc_middle::ty::print::pretty::for_each_def has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_expand · ×9
  • rustc_expand::mbe::macro_rules::is_in_follow (cyclomatic 35) compiler/rustc_expand/src/mbe/macro_rules.rs:1731 — rustc_expand::mbe::macro_rules::is_in_follow has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_expand::mbe::macro_rules::compile_declarative_macro (cyclomatic 28) compiler/rustc_expand/src/mbe/macro_rules.rs:780 — rustc_expand::mbe::macro_rules::compile_declarative_macro has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_expand::mbe::macro_rules::check_matcher_core (cyclomatic 25) compiler/rustc_expand/src/mbe/macro_rules.rs:1453 — rustc_expand::mbe::macro_rules::check_matcher_core has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_expand::mbe::diagnostics::emit_frag_parse_err (cyclomatic 24) compiler/rustc_expand/src/mbe/diagnostics.rs:368 — rustc_expand::mbe::diagnostics::emit_frag_parse_err has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_expand::mbe::diagnostics::failed_to_match_macro (cyclomatic 23) compiler/rustc_expand/src/mbe/diagnostics.rs:29 — rustc_expand::mbe::diagnostics::failed_to_match_macro has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_expand::expand::parse_ast_fragment (cyclomatic 21) compiler/rustc_expand/src/expand.rs:1079 — rustc_expand::expand::parse_ast_fragment has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_expand::mbe::transcribe::transcribe_pnr (cyclomatic 20) compiler/rustc_expand/src/mbe/transcribe.rs:459 — rustc_expand::mbe::transcribe::transcribe_pnr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_expand::mbe::quoted::parse_tree (cyclomatic 19) compiler/rustc_expand/src/mbe/quoted.rs:233 — rustc_expand::mbe::quoted::parse_tree has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_expand::mbe::transcribe::transcribe (cyclomatic 16) compiler/rustc_expand/src/mbe/transcribe.rs:175 — rustc_expand::mbe::transcribe::transcribe has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · loadDatabase · ×9
  • loadDatabase::makeSearchTreeFromBase64 (cognitive 195) src/librustdoc/html/static/js/stringdex.js:3009 — loadDatabase::makeSearchTreeFromBase64 has cognitive complexity 195 (threshold 15). Drivers by points: if/else 45 (108 pts), ternaries 15 (58 pts), loops 8 (26 pts), boolean chains 3 (nesting depth added 124). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData (cognitive 93) src/librustdoc/html/static/js/stringdex.js:3045 — loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData has cognitive complexity 93 (threshold 15). Drivers by points: if/else 32 (55 pts), loops 6 (22 pts), boolean chains 8, ternaries 4 (8 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::prefixMatches (cognitive 83) src/librustdoc/html/static/js/stringdex.js:2031 — loadDatabase::prefixMatches has cognitive complexity 83 (threshold 15). Drivers by points: if/else 16 (50 pts), loops 9 (21 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::substringMatches (cognitive 70) src/librustdoc/html/static/js/stringdex.js:1947 — loadDatabase::substringMatches has cognitive complexity 70 (threshold 15). Drivers by points: if/else 14 (45 pts), loops 8 (21 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::substringMatches (cognitive 61) src/librustdoc/html/static/js/stringdex.js:2447 — loadDatabase::substringMatches has cognitive complexity 61 (threshold 15). Drivers by points: if/else 12 (36 pts), loops 8 (21 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::decode (cognitive 22) src/librustdoc/html/static/js/stringdex.js:2597 — loadDatabase::decode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (6 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • loadDatabase::searchLev (cognitive 20) src/librustdoc/html/static/js/stringdex.js:1855 — loadDatabase::searchLev has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::searchTreeLoadByNodeID (cognitive 16) src/librustdoc/html/static/js/stringdex.js:1196 — loadDatabase::searchTreeLoadByNodeID has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loadDatabase::children (cognitive 16) src/librustdoc/html/static/js/stringdex.js:2180 — loadDatabase::children has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_ty_utils · ×9
  • rustc_ty_utils::layout::layout_of_uncached (cognitive 152) compiler/rustc_ty_utils/src/layout.rs:205 — rustc_ty_utils::layout::layout_of_uncached has cognitive complexity 152 (threshold 15). Drivers by points: if/else 43 (116 pts), match/switch 10 (26 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ty_utils::instance::resolve_associated_item (cognitive 82) compiler/rustc_ty_utils/src/instance.rs:109 — rustc_ty_utils::instance::resolve_associated_item has cognitive complexity 82 (threshold 15). Drivers by points: if/else 31 (58 pts), match/switch 7 (19 pts), boolean chains 5 (nesting depth added 39). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_ty_utils::layout::invariant::layout_sanity_check (cognitive 55) compiler/rustc_ty_utils/src/layout/invariant.rs:10 — rustc_ty_utils::layout::invariant::layout_sanity_check has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 6 (10 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 21). Of this number, 36 points are the body's own statements and 19 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ty_utils::abi::arg_attrs_for_rust_scalar (cognitive 40) compiler/rustc_ty_utils/src/abi.rs:318 — rustc_ty_utils::abi::arg_attrs_for_rust_scalar has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (29 pts), match/switch 2 (6 pts), boolean chains 5 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_ty_utils::instance::resolve_instance_raw (cognitive 32) compiler/rustc_ty_utils/src/instance.rs:17 — rustc_ty_utils::instance::resolve_instance_raw has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 2 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ty_utils::abi::fn_sig_for_fn_abi (cognitive 26) compiler/rustc_ty_utils/src/abi.rs:36 — rustc_ty_utils::abi::fn_sig_for_fn_abi has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ty_utils::needs_drop::drop_tys_helper (cognitive 19) compiler/rustc_ty_utils/src/needs_drop.rs:362 — rustc_ty_utils::needs_drop::drop_tys_helper has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 4 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ty_utils::consts::recurse_build (cognitive 17) compiler/rustc_ty_utils/src/consts.rs:35 — rustc_ty_utils::consts::recurse_build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_ty_utils::implied_bounds::assumed_wf_types (cognitive 17) compiler/rustc_ty_utils/src/implied_bounds.rs:22 — rustc_ty_utils::implied_bounds::assumed_wf_types has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · mbe · ×9
  • mbe::expander::matcher::match_loop_inner (cognitive 133) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:366 — mbe::expander::matcher::match_loop_inner has cognitive complexity 133 (threshold 15). Drivers by points: if/else 44 (115 pts), match/switch 4 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • mbe::expander::transcriber::expand_subtree (cognitive 64) src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs:167 — mbe::expander::transcriber::expand_subtree has cognitive complexity 64 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 7 (28 pts), loops 3 (7 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mbe::expander::matcher::match_loop (cognitive 53) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:624 — mbe::expander::matcher::match_loop has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 2 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mbe::parser::parse_metavar_expr (cognitive 22) src/tools/rust-analyzer/crates/mbe/src/parser.rs:391 — mbe::parser::parse_metavar_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mbe::expander::transcriber::expand_repeat (cognitive 21) src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs:463 — mbe::expander::transcriber::expand_repeat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mbe::parser::parse_repeat (cognitive 21) src/tools/rust-analyzer/crates/mbe/src/parser.rs:345 — mbe::parser::parse_repeat has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (20 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • mbe::parser::next_op (cognitive 19) src/tools/rust-analyzer/crates/mbe/src/parser.rs:188 — mbe::parser::next_op has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (19 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • mbe::expander::expand_rules (cognitive 16) src/tools/rust-analyzer/crates/mbe/src/expander.rs:17 — mbe::expander::expand_rules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mbe::expander::matcher::match_meta_var (cognitive 16) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:775 — mbe::expander::matcher::match_meta_var has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · miri · ×9
  • miri::bin::miri::main (cognitive 127) src/tools/miri/src/bin/miri.rs:408 — miri::bin::miri::main has cognitive complexity 127 (threshold 15). Drivers by points: if/else 77 (101 pts), match/switch 4 (10 pts), loops 3 (9 pts), boolean chains 7 (nesting depth added 36). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • miri::diagnostics::report_result (cognitive 57) src/tools/miri/src/diagnostics.rs:241 — miri::diagnostics::report_result has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 5 (12 pts), match/switch 6 (12 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::intrinsics::x86::sse42::compare_strings (cognitive 53) src/tools/miri/src/intrinsics/x86/sse42.rs:73 — miri::intrinsics::x86::sse42::compare_strings has cognitive complexity 53 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 7 (19 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::shims::unix::linux_like::sync::futex (cognitive 41) src/tools/miri/src/shims/unix/linux_like/sync.rs:13 — miri::shims::unix::linux_like::sync::futex has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 2, match/switch 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • miri::diagnostics::report_msg (cognitive 25) src/tools/miri/src/diagnostics.rs:553 — miri::diagnostics::report_msg has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 4 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::shims::windows::foreign_items::win_get_full_path_name (cognitive 22) src/tools/miri/src/shims/windows/foreign_items.rs:32 — miri::shims::windows::foreign_items::win_get_full_path_name has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::eval::args_to_utf16_command_string (cognitive 20) src/tools/miri/src/eval.rs:605 — miri::eval::args_to_utf16_command_string has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 3 (8 pts), match/switch 1 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::helpers::iter_exported_symbols (cognitive 17) src/tools/miri/src/helpers.rs:119 — miri::helpers::iter_exported_symbols has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • miri::math::fixed_float_value (cognitive 17) src/tools/miri/src/math.rs:264 — miri::math::fixed_float_value has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), match/switch 1 (nesting depth added 2). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExprCollector · ×9
  • ExprCollector::maybe_collect_expr (cognitive 117) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1417 — ExprCollector::maybe_collect_expr has cognitive complexity 117 (threshold 15). Drivers by points: if/else 50 (91 pts), match/switch 9 (19 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::lower_inline_asm (cognitive 100) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/asm.rs:17 — ExprCollector::lower_inline_asm has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (65 pts), match/switch 10 (28 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::collect_format_args_impl (cognitive 71) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/format_args.rs:110 — ExprCollector::collect_format_args_impl has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (56 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::collect_pat (cognitive 40) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2912 — ExprCollector::collect_pat has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (10 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ExprCollector::maybe_collect_expr_as_pat (cognitive 36) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2080 — ExprCollector::maybe_collect_expr_as_pat has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 7 (11 pts), boolean chains 1 (nesting depth added 16). Of this number, 23 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::collect_range_expr (cognitive 20) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1936 — ExprCollector::collect_range_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::lower_generic_args (cognitive 19) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1023 — ExprCollector::lower_generic_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::lower_coroutine_body_with_moved_arguments (cognitive 18) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1097 — ExprCollector::lower_coroutine_body_with_moved_arguments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprCollector::collect_stmt (cognitive 17) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2719 — ExprCollector::collect_stmt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · stdarch_gen_hexagon · ×9
  • stdarch_gen_hexagon::hvx::parse_header (cognitive 92) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:361 — stdarch_gen_hexagon::hvx::parse_header has cognitive complexity 92 (threshold 15). Drivers by points: if/else 18 (68 pts), loops 4 (12 pts), match/switch 1 (9 pts), boolean chains 3 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • stdarch_gen_hexagon::scalar::parse_header (cognitive 59) library/stdarch/crates/stdarch-gen-hexagon/src/scalar.rs:304 — stdarch_gen_hexagon::scalar::parse_header has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (49 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • stdarch_gen_hexagon::scalar::generate_functions (cognitive 32) library/stdarch/crates/stdarch-gen-hexagon/src/scalar.rs:492 — stdarch_gen_hexagon::scalar::generate_functions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_gen_hexagon::hvx::generate_functions (cognitive 30) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1438 — stdarch_gen_hexagon::hvx::generate_functions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_gen_hexagon::scalar::parse_prototype (cognitive 29) library/stdarch/crates/stdarch-gen-hexagon/src/scalar.rs:249 — stdarch_gen_hexagon::scalar::parse_prototype has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 1 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • stdarch_gen_hexagon::hvx::generate_extern_block (cognitive 26) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1201 — stdarch_gen_hexagon::hvx::generate_extern_block has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_gen_hexagon::hvx::parse_compound_expr (cognitive 25) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:173 — stdarch_gen_hexagon::hvx::parse_compound_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_gen_hexagon::hvx::parse_prototype (cognitive 17) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:326 — stdarch_gen_hexagon::hvx::parse_prototype has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • stdarch_gen_hexagon::hvx::get_compound_primary_instr (cognitive 17) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1370 — stdarch_gen_hexagon::hvx::get_compound_primary_instr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SelectionContext · ×9
  • SelectionContext::winnow_candidates (cognitive 86) compiler/rustc_trait_selection/src/traits/select/mod.rs:1716 — SelectionContext::winnow_candidates has cognitive complexity 86 (threshold 15). Drivers by points: if/else 45 (68 pts), loops 5 (8 pts), match/switch 5 (7 pts), boolean chains 3 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelectionContext::evaluate_predicate_recursively (cognitive 82) compiler/rustc_trait_selection/src/traits/select/mod.rs:524 — SelectionContext::evaluate_predicate_recursively has cognitive complexity 82 (threshold 15). Drivers by points: if/else 21 (45 pts), match/switch 13 (25 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelectionContext::assemble_candidates_from_auto_impls (cognitive 29) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:741 — SelectionContext::assemble_candidates_from_auto_impls has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelectionContext::assemble_candidates_for_unsizing (cognitive 25) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:985 — SelectionContext::assemble_candidates_for_unsizing has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelectionContext::assemble_closure_candidates (cognitive 20) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:415 — SelectionContext::assemble_closure_candidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SelectionContext::assemble_builtin_copy_clone_candidate (cognitive 19) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:1148 — SelectionContext::assemble_builtin_copy_clone_candidate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SelectionContext::evaluate_trait_predicate_recursively (cognitive 19) compiler/rustc_trait_selection/src/traits/select/mod.rs:931 — SelectionContext::evaluate_trait_predicate_recursively has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SelectionContext::assemble_async_closure_candidates (cognitive 16) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:478 — SelectionContext::assemble_async_closure_candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SelectionContext::reject_fn_ptr_impls (cognitive 16) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:653 — SelectionContext::reject_fn_ptr_impls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_monomorphize · ×9
  • rustc_monomorphize::collector::collect_items_rec (cognitive 54) compiler/rustc_monomorphize/src/collector.rs:382 — rustc_monomorphize::collector::collect_items_rec has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (30 pts), match/switch 4 (12 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::collector::collect_roots (cognitive 44) compiler/rustc_monomorphize/src/collector.rs:1485 — rustc_monomorphize::collector::collect_roots has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 7 (12 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::partitioning::internalize_symbols (cognitive 30) compiler/rustc_monomorphize/src/partitioning.rs:528 — rustc_monomorphize::partitioning::internalize_symbols has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 4 (8 pts), match/switch 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::partitioning::mono_item_visibility (cognitive 26) compiler/rustc_monomorphize/src/partitioning.rs:803 — rustc_monomorphize::partitioning::mono_item_visibility has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::partitioning::merge_codegen_units (cognitive 25) compiler/rustc_monomorphize/src/partitioning.rs:317 — rustc_monomorphize::partitioning::merge_codegen_units has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::partitioning::debug_dump (cognitive 25) compiler/rustc_monomorphize/src/partitioning.rs:997 — rustc_monomorphize::partitioning::debug_dump has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (7 pts) (nesting depth added 10). Of this number, 18 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::mono_checks::abi_check::do_check_simd_vector_abi (cognitive 23) compiler/rustc_monomorphize/src/mono_checks/abi_check.rs:54 — rustc_monomorphize::mono_checks::abi_check::do_check_simd_vector_abi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (8 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_monomorphize::partitioning::collect_and_partition_mono_items (cognitive 21) compiler/rustc_monomorphize/src/partitioning.rs:1169 — rustc_monomorphize::partitioning::collect_and_partition_mono_items has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 5, match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rustc_monomorphize::collector::visit_instance_use (cognitive 18) compiler/rustc_monomorphize/src/collector.rs:995 — rustc_monomorphize::collector::visit_instance_use has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compiletest · ×9
  • compiletest::directives::make_test_description (cognitive 43) src/tools/compiletest/src/directives.rs:895 — compiletest::directives::make_test_description has cognitive complexity 43 (threshold 15). Drivers by points: match/switch 12 (24 pts), if/else 9 (17 pts), boolean chains 2 (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • compiletest::directives::ignore_llvm (cognitive 38) src/tools/compiletest/src/directives.rs:1253 — compiletest::directives::ignore_llvm has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 2 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • compiletest::directives::needs::handle_needs (cognitive 34) src/tools/compiletest/src/directives/needs.rs:8 — compiletest::directives::needs::handle_needs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::directives::ignore_gdb (cognitive 29) src/tools/compiletest/src/directives.rs:1063 — compiletest::directives::ignore_gdb has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::json::push_actual_errors (cognitive 28) src/tools/compiletest/src/json.rs:159 — compiletest::json::push_actual_errors has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 8 (13 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::directives::ignore_lldb (cognitive 26) src/tools/compiletest/src/directives.rs:1123 — compiletest::directives::ignore_lldb has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::runtest::compute_diff::make_diff (cognitive 24) src/tools/compiletest/src/runtest/compute_diff.rs:23 — compiletest::runtest::compute_diff::make_diff has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::read2::imp::read2 (cognitive 18) src/tools/compiletest/src/read2.rs:163 — compiletest::read2::imp::read2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiletest::run_tests (cognitive 16) src/tools/compiletest/src/lib.rs:49 — compiletest::run_tests has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×9
  • Duplicated block (17 lines × 2) compiler/rustc_borrowck/src/dataflow.rs:235 — compiler/rustc_borrowck/src/dataflow.rs:235-251 | compiler/rustc_borrowck/src/dataflow.rs:336-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_borrowck/src/lib.rs:1482 — compiler/rustc_borrowck/src/lib.rs:1482-1498 | compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:248-264 — before extracting anything, compare `compiler/rustc_borrowck/src/lib.rs` and `compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) compiler/rustc_builtin_macros/src/format.rs:536 — compiler/rustc_builtin_macros/src/format.rs:536-552 | compiler/rustc_builtin_macros/src/format.rs:560-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:320 — compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:320-336 | compiler/rustc_codegen_llvm/src/intrinsic.rs:501-517 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1289 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1289-1305 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1314-1330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_hir_analysis/src/check/wfcheck.rs:1181 — compiler/rustc_hir_analysis/src/check/wfcheck.rs:1181-1197 | compiler/rustc_hir_analysis/src/check/wfcheck.rs:1206-1222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_hir_analysis/src/collect/type_of.rs:305 — compiler/rustc_hir_analysis/src/collect/type_of.rs:305-321 | compiler/rustc_hir_analysis/src/collect/type_of.rs:346-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:392 — compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:392-408 | compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:431-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:451 — compiler/rustc_target/src/callconv/loongarch.rs:451-468 | compiler/rustc_target/src/callconv/riscv.rs:456-472 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×9
  • Duplicated block (8–9 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1253 — compiler/rustc_codegen_llvm/src/asm.rs:1253-1261 | compiler/rustc_codegen_llvm/src/asm.rs:1293-1300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1446 — compiler/rustc_codegen_llvm/src/asm.rs:1446-1454 | compiler/rustc_codegen_llvm/src/asm.rs:1486-1493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) compiler/rustc_const_eval/src/util/type_name.rs:56 — compiler/rustc_const_eval/src/util/type_name.rs:56-63 | compiler/rustc_symbol_mangling/src/legacy.rs:253-261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) compiler/rustc_hir_typeck/src/coercion.rs:598 — compiler/rustc_hir_typeck/src/coercion.rs:598-605 | compiler/rustc_symbol_mangling/src/export.rs:112-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2827 — compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2827-2834 | compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2856-2864 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) compiler/rustc_macros/src/symbols.rs:205 — compiler/rustc_macros/src/symbols.rs:205-212 | compiler/rustc_macros/src/symbols.rs:233-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) compiler/rustc_middle/src/mir/interpret/mod.rs:591 — compiler/rustc_middle/src/mir/interpret/mod.rs:591-598 | compiler/rustc_public/src/mir/alloc.rs:58-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) compiler/rustc_next_trait_solver/src/canonical/mod.rs:432 — compiler/rustc_next_trait_solver/src/canonical/mod.rs:432-439 | compiler/rustc_type_ir/src/relate/combine.rs:162-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) compiler/rustc_codegen_cranelift/example/std_example.rs:252 — compiler/rustc_codegen_cranelift/example/std_example.rs:252-260 | compiler/rustc_codegen_gcc/example/std_example.rs:125-132 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · hir_def · ×8
  • hir_def::attrs::match_attr_flags (cyclomatic 71) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:131 — hir_def::attrs::match_attr_flags has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_def::hir::format_args::parse (cyclomatic 42) src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs:172 — hir_def::hir::format_args::parse has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_def::expr_store::lower::path::lower_path (cyclomatic 38) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/path.rs:41 — hir_def::expr_store::lower::path::lower_path has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_def::attrs::parse_repr_tt (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/attrs.rs:1272 — hir_def::attrs::parse_repr_tt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_def::expr_store::lower::lower_body (cyclomatic 22) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:70 — hir_def::expr_store::lower::lower_body has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_def::lang_item::crate_lang_items (cyclomatic 20) src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs:38 — hir_def::lang_item::crate_lang_items has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_def::find_path::find_path_for_module (cyclomatic 17) src/tools/rust-analyzer/crates/hir-def/src/find_path.rs:177 — hir_def::find_path::find_path_for_module has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_def::find_path::find_local_import_locations (cyclomatic 16) src/tools/rust-analyzer/crates/hir-def/src/find_path.rs:577 — hir_def::find_path::find_local_import_locations has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TestCx · ×8
  • TestCx::make_compile_args (cyclomatic 68) src/tools/compiletest/src/runtest.rs:1652 — TestCx::make_compile_args has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TestCx::check_expected_errors (cyclomatic 44) src/tools/compiletest/src/runtest.rs:682 — TestCx::check_expected_errors has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TestCx::run_ui_test (cyclomatic 41) src/tools/compiletest/src/runtest/ui.rs:16 — TestCx::run_ui_test has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TestCx::run_rmake_test (cyclomatic 26) src/tools/compiletest/src/runtest/run_make.rs:13 — TestCx::run_rmake_test has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TestCx::run_codegen_units_test (cyclomatic 20) src/tools/compiletest/src/runtest/codegen_units.rs:8 — TestCx::run_codegen_units_test has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TestCx::compare_output (cyclomatic 19) src/tools/compiletest/src/runtest.rs:2823 — TestCx::compare_output has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TestCx::document_inner (cyclomatic 16) src/tools/compiletest/src/runtest.rs:1000 — TestCx::document_inner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TestCx::build_auxiliary (cyclomatic 16) src/tools/compiletest/src/runtest.rs:1416 — TestCx::build_auxiliary has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LoweringContext · ×8
  • LoweringContext::lower_expr_mut (cyclomatic 66) compiler/rustc_ast_lowering/src/expr.rs:219 — LoweringContext::lower_expr_mut has cyclomatic complexity 66 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LoweringContext::lower_inline_asm (cyclomatic 61) compiler/rustc_ast_lowering/src/asm.rs:25 — LoweringContext::lower_inline_asm has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LoweringContext::lower_ty (cyclomatic 34) compiler/rustc_ast_lowering/src/lib.rs:1537 — LoweringContext::lower_ty has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LoweringContext::lower_item_kind (cyclomatic 24) compiler/rustc_ast_lowering/src/item.rs:183 — LoweringContext::lower_item_kind has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • LoweringContext::lower_qpath (cyclomatic 21) compiler/rustc_ast_lowering/src/path.rs:27 — LoweringContext::lower_qpath has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LoweringContext::lower_fn_decl (cyclomatic 20) compiler/rustc_ast_lowering/src/lib.rs:1938 — LoweringContext::lower_fn_decl has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ImplTraitPosition::fmt (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LoweringContext::can_lower_expr_to_const_arg_direct (cyclomatic 19) compiler/rustc_ast_lowering/src/lib.rs:2777 — LoweringContext::can_lower_expr_to_const_arg_direct has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ImplTraitPosition::fmt (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LoweringContext::lower_path_segment (cyclomatic 16) compiler/rustc_ast_lowering/src/path.rs:254 — LoweringContext::lower_path_segment has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · std · ×8
  • std::sys::backtrace::_print_fmt (cyclomatic 20) library/std/src/sys/backtrace.rs:54 — std::sys::backtrace::_print_fmt has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • std::sys::io::error::sgx::decode_error_kind (cyclomatic 19) library/std/src/sys/io/error/sgx.rs:14 — std::sys::io::error::sgx::decode_error_kind has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • std::sys::args::windows::parse_lp_cmd_line (cyclomatic 18) library/std/src/sys/args/windows.rs:54 — std::sys::args::windows::parse_lp_cmd_line has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • std::sys::pal::unix::init (cyclomatic 17) library/std/src/sys/pal/unix/mod.rs:22 — std::sys::pal::unix::init has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (sanitize_standard_fds, reset_sigpipe). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • std::sys::args::uefi::parse_lp_cmd_line (cyclomatic 16) library/std/src/sys/args/uefi.rs:42 — std::sys::args::uefi::parse_lp_cmd_line has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • std::sys::args::windows::append_bat_arg (cyclomatic 16) library/std/src/sys/args/windows.rs:219 — std::sys::args::windows::append_bat_arg has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • std::sys::io::kernel_copy::linux::copy_regular_files (cyclomatic 16) library/std/src/sys/io/kernel_copy/linux.rs:678 — std::sys::io::kernel_copy::linux::copy_regular_files has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • std::sys::random::linux::getrandom (cyclomatic 16) library/std/src/sys/random/linux.rs:72 — std::sys::random::linux::getrandom has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · rustc_codegen_gcc · ×8
  • rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic (cognitive 363) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:28 — rustc_codegen_gcc::intrinsic::simd::generic_simd_intrinsic has cognitive complexity 363 (threshold 15). Drivers by points: if/else 151 (243 pts), match/switch 55 (89 pts), loops 12 (22 pts), boolean chains 9 (nesting depth added 136). Of this number, 342 points are the body's own statements and 21 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_gcc::back::write::codegen (cognitive 42) compiler/rustc_codegen_gcc/src/back/write.rs:18 — rustc_codegen_gcc::back::write::codegen has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (37 pts), boolean chains 4, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_gcc::gcc_util::new_context (cognitive 31) compiler/rustc_codegen_gcc/src/gcc_util.rs:229 — rustc_codegen_gcc::gcc_util::new_context has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 5 (7 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_gcc::asm::modifier_to_gcc (cognitive 26) compiler/rustc_codegen_gcc/src/asm.rs:1064 — rustc_codegen_gcc::asm::modifier_to_gcc has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 4 (7 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_gcc::attributes::from_fn_attrs (cognitive 23) compiler/rustc_codegen_gcc/src/attributes.rs:102 — rustc_codegen_gcc::attributes::from_fn_attrs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (18 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_codegen_gcc::callee::get_fn (cognitive 18) compiler/rustc_codegen_gcc/src/callee.rs:17 — rustc_codegen_gcc::callee::get_fn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_codegen_gcc::intrinsic::old_archs::old_archs (cognitive 17) compiler/rustc_codegen_gcc/src/intrinsic/old_archs.rs:13 — rustc_codegen_gcc::intrinsic::old_archs::old_archs has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 9 (17 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments (cognitive 16) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:119 — rustc_codegen_gcc::intrinsic::llvm::adjust_intrinsic_arguments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlobalState · ×8
  • GlobalState::handle_event (cognitive 109) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:315 — GlobalState::handle_event has cognitive complexity 109 (threshold 15). Drivers by points: if/else 31 (60 pts), boolean chains 19, loops 8 (16 pts), match/switch 6 (14 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlobalState::switch_workspaces (cognitive 62) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:467 — GlobalState::switch_workspaces has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 5 (10 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • GlobalState::process_changes (cognitive 57) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:338 — GlobalState::process_changes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (45 pts), match/switch 2 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • GlobalState::handle_task (cognitive 40) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:850 — GlobalState::handle_task has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 9 (21 pts), if/else 7 (19 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • GlobalState::current_status (cognitive 37) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:128 — GlobalState::current_status has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlobalState::compute_priming_scope (cognitive 30) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:756 — GlobalState::compute_priming_scope has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (9 pts), match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GlobalState::handle_vfs_msg (cognitive 21) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:980 — GlobalState::handle_vfs_msg has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • GlobalState::handle_deferred_task (cognitive 17) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:1085 — GlobalState::handle_deferred_task has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · hir_expand · ×8
  • hir_expand::cfg_process::macro_input_callback (cognitive 86) src/tools/rust-analyzer/crates/hir-expand/src/cfg_process.rs:47 — hir_expand::cfg_process::macro_input_callback has cognitive complexity 86 (threshold 15). Drivers by points: if/else 23 (61 pts), match/switch 4 (11 pts), loops 3 (10 pts), boolean chains 4 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_expand::fixup::fixup_syntax (cognitive 74) src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs:52 — hir_expand::fixup::fixup_syntax has cognitive complexity 74 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 5 (17 pts), boolean chains 6, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_expand::builtin::derive_macro::coerce_pointee_expand (cognitive 64) src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs:1128 — hir_expand::builtin::derive_macro::coerce_pointee_expand has cognitive complexity 64 (threshold 15). Drivers by points: if/else 31 (46 pts), match/switch 8 (10 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 18). Of this number, 46 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_expand::attrs::expand_cfg_attr_with_doc_comments (cognitive 32) src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs:111 — hir_expand::attrs::expand_cfg_attr_with_doc_comments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_expand::eager::eager_macro_recur (cognitive 27) src/tools/rust-analyzer/crates/hir-expand/src/eager.rs:151 — hir_expand::eager::eager_macro_recur has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 7 (17 pts), if/else 4 (9 pts), loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_expand::builtin::fn_macro::concat_expand (cognitive 24) src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs:544 — hir_expand::builtin::fn_macro::concat_expand has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_expand::builtin::fn_macro::cfg_select_expand (cognitive 20) src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs:342 — hir_expand::builtin::fn_macro::cfg_select_expand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_expand::mod_path::convert_path (cognitive 18) src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs:259 — hir_expand::mod_path::convert_path has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 4 (6 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocSearch.execQuery · ×8
  • DocSearch.execQuery::unifyFunctionTypes (cognitive 77) REDACTED:2979 — DocSearch.execQuery::unifyFunctionTypes has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (50 pts), ternaries 5 (11 pts), boolean chains 10, loops 4 (6 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::transformResults (cognitive 53) REDACTED:2660 — DocSearch.execQuery::transformResults has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (38 pts), ternaries 3 (9 pts), boolean chains 5, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::unifyFunctionTypeIsMatchCandidate (cognitive 48) REDACTED:3524 — DocSearch.execQuery::unifyFunctionTypeIsMatchCandidate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 11, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::formatDisplayTypeSignature::writeFn (cognitive 47) REDACTED:2504 — DocSearch.execQuery::formatDisplayTypeSignature::writeFn has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 2 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::transformResults, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::unifyGenericTypes (cognitive 35) REDACTED:3312 — DocSearch.execQuery::unifyGenericTypes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::checkPath (cognitive 23) REDACTED:3855 — DocSearch.execQuery::checkPath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::buildHrefAndPath (cognitive 21) REDACTED:2165 — DocSearch.execQuery::buildHrefAndPath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::unifyFunctionTypeCheckBindings (cognitive 16) REDACTED:3628 — DocSearch.execQuery::unifyFunctionTypeCheckBindings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 7 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 8 times rather than 8 independent problems. Splitting this body alone leaves the other 7 exactly as they are. Where these are variations on one operation, the change that clears all 8 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AstValidator · ×8
  • AstValidator::visit_item (cognitive 64) compiler/rustc_ast_passes/src/ast_validation.rs:1435 — AstValidator::visit_item has cognitive complexity 64 (threshold 15). Drivers by points: if/else 25 (50 pts), boolean chains 5, loops 2 (5 pts), match/switch 2 (4 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AstValidator::visit_fn (cognitive 32) compiler/rustc_ast_passes/src/ast_validation.rs:1955 — AstValidator::visit_fn has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 4 (7 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AstValidator::visit_assoc_item (cognitive 32) compiler/rustc_ast_passes/src/ast_validation.rs:2077 — AstValidator::visit_assoc_item has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 6 (10 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AstValidator::visit_generics (cognitive 27) compiler/rustc_ast_passes/src/ast_validation.rs:1843 — AstValidator::visit_generics has cognitive complexity 27 (threshold 15). Drivers by points: if/else 3 (12 pts), match/switch 3 (9 pts), loops 3 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AstValidator::check_c_variadic_type (cognitive 21) compiler/rustc_ast_passes/src/ast_validation.rs:965 — AstValidator::check_c_variadic_type has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AstValidator::visit_ty_common (cognitive 20) compiler/rustc_ast_passes/src/ast_validation.rs:1213 — AstValidator::visit_ty_common has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AstValidator::visit_param_bound (cognitive 20) compiler/rustc_ast_passes/src/ast_validation.rs:1894 — AstValidator::visit_param_bound has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 2 (7 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AstValidator::check_extern_fn_signature (cognitive 16) compiler/rustc_ast_passes/src/ast_validation.rs:575 — AstValidator::check_extern_fn_signature has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_lint · ×8
  • rustc_lint::foreign_modules::structurally_same_type_impl (cognitive 39) compiler/rustc_lint/src/foreign_modules.rs:225 — rustc_lint::foreign_modules::structurally_same_type_impl has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_lint::types::lint_nan (cognitive 29) compiler/rustc_lint/src/types.rs:225 — rustc_lint::types::lint_nan has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18, match/switch 4 (6 pts), loops 3, boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 3 function items inside it that branch (eq_ne_suggestion, nan_method_path, nan_ty). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_lint::types::lint_wide_pointer (cognitive 25) compiler/rustc_lint/src/types.rs:364 — rustc_lint::types::lint_wide_pointer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_lint::unused::must_use::is_ty_must_use (cognitive 25) compiler/rustc_lint/src/unused/must_use.rs:139 — rustc_lint::unused::must_use::is_ty_must_use has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_lint::types::repr_nullable_ptr (cognitive 24) compiler/rustc_lint/src/types.rs:948 — rustc_lint::types::repr_nullable_ptr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_lint::types::literal::lint_uint_literal (cognitive 23) compiler/rustc_lint/src/types/literal.rs:327 — rustc_lint::types::literal::lint_uint_literal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_lint::ptr_nulls::useless_check (cognitive 18) compiler/rustc_lint/src/ptr_nulls.rs:67 — rustc_lint::ptr_nulls::useless_check has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_lint::types::literal::report_bin_hex_error (cognitive 17) compiler/rustc_lint/src/types/literal.rs:142 — rustc_lint::types::literal::report_bin_hex_error has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rustc_borrowck · ×8
  • rustc_borrowck::places_conflict::place_projection_conflict (cognitive 32) compiler/rustc_borrowck/src/places_conflict.rs:298 — rustc_borrowck::places_conflict::place_projection_conflict has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (28 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_borrowck::diagnostics::mutability_errors::suggest_ampmut (cognitive 27) compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:1891 — rustc_borrowck::diagnostics::mutability_errors::suggest_ampmut has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_borrowck::polonius::legacy::emit_move_facts (cognitive 23) compiler/rustc_borrowck/src/polonius/legacy/mod.rs:69 — rustc_borrowck::polonius::legacy::emit_move_facts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_borrowck::polonius::dump::emit_mermaid_cfg (cognitive 20) compiler/rustc_borrowck/src/polonius/dump.rs:299 — rustc_borrowck::polonius::dump::emit_mermaid_cfg has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (8 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_borrowck::region_infer::values::pretty_print_region_elements (cognitive 20) compiler/rustc_borrowck/src/region_infer/values.rs:409 — rustc_borrowck::region_infer::values::pretty_print_region_elements has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_borrowck::region_infer::opaque_types::compute_definition_site_hidden_types_from_defining_uses (cognitive 17) compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs:305 — rustc_borrowck::region_infer::opaque_types::compute_definition_site_hidden_types_from_defining_uses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_borrowck::places_conflict::place_components_conflict (cognitive 16) compiler/rustc_borrowck/src/places_conflict.rs:131 — rustc_borrowck::places_conflict::place_components_conflict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_borrowck::region_infer::opaque_types::apply_definition_site_hidden_types (cognitive 16) compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs:528 — rustc_borrowck::region_infer::opaque_types::apply_definition_site_hidden_types has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExprUseVisitor · ×8
  • ExprUseVisitor::walk_captures (cognitive 28) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:991 — ExprUseVisitor::walk_captures has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprUseVisitor::cat_pattern (cognitive 23) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:1590 — ExprUseVisitor::cat_pattern has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (13 pts), match/switch 3 (6 pts), if/else 2 (4 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • ExprUseVisitor::cat_pattern (cognitive 23) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496 — ExprUseVisitor::cat_pattern has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (13 pts), match/switch 3 (6 pts), if/else 2 (4 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • ExprUseVisitor::walk_expr (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502 — ExprUseVisitor::walk_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ExprUseVisitor::walk_captures (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1052 — ExprUseVisitor::walk_captures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExprUseVisitor::walk_pat (cognitive 20) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:828 — ExprUseVisitor::walk_pat has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ExprUseVisitor::walk_expr (cognitive 19) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:390 — ExprUseVisitor::walk_expr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ExprUseVisitor::walk_pat (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879 — ExprUseVisitor::walk_pat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×8
  • Members sharing a duplicated core (4 members, 50+ identical tokens) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:71 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:71-88 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:120-139 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:147-169 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:178-198 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) compiler/rustc_const_eval/src/interpret/stack.rs:515 — compiler/rustc_const_eval/src/interpret/stack.rs:515-596 | compiler/rustc_middle/src/ty/sty.rs:1968-2013 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:122-190 | compiler/rustc_trait_selection/src/traits/select/mod.rs:2028-2079 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:504 — compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:504-524 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:529-549 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:554-572 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:577-597 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) compiler/rustc_passes/src/check_attr.rs:559 — compiler/rustc_passes/src/check_attr.rs:559-592 | compiler/rustc_passes/src/check_attr.rs:602-645 | compiler/rustc_passes/src/check_attr.rs:648-680 | compiler/rustc_passes/src/check_attr.rs:682-732 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) compiler/rustc_trait_selection/src/traits/project.rs:1387 — compiler/rustc_trait_selection/src/traits/project.rs:1387-1437 | compiler/rustc_trait_selection/src/traits/project.rs:1443-1484 | compiler/rustc_trait_selection/src/traits/project.rs:1490-1529 | compiler/rustc_trait_selection/src/traits/project.rs:1535-1582 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) library/alloc/src/boxed.rs:1056 — library/alloc/src/boxed.rs:1056-1071 | library/alloc/src/boxed.rs:1094-1109 | library/alloc/src/boxed.rs:1192-1207 | library/alloc/src/boxed.rs:1235-1250 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) library/core/src/num/imp/flt2dec/mod.rs:368 — library/core/src/num/imp/flt2dec/mod.rs:368-409 | library/core/src/num/imp/flt2dec/mod.rs:443-481 | library/core/src/num/imp/flt2dec/mod.rs:537-585 | library/core/src/num/imp/flt2dec/mod.rs:614-685 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) library/std/src/sync/nonpoison/rwlock.rs:674 — library/std/src/sync/nonpoison/rwlock.rs:674-687 | library/std/src/sync/nonpoison/rwlock.rs:899-912 | library/std/src/sync/poison/rwlock.rs:808-821 | library/std/src/sync/poison/rwlock.rs:1034-1047 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×8
  • Duplicated block (19 lines × 2) compiler/rustc_codegen_cranelift/src/allocator.rs:20 — compiler/rustc_codegen_cranelift/src/allocator.rs:20-38 | compiler/rustc_codegen_gcc/src/allocator.rs:36-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:679 — compiler/rustc_const_eval/src/const_eval/machine.rs:679-697 | compiler/rustc_const_eval/src/const_eval/machine.rs:705-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) compiler/rustc_hir/src/hir.rs:3864 — compiler/rustc_hir/src/hir.rs:3864-3882 | compiler/rustc_type_ir/src/ty_kind.rs:1071-1089 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) compiler/rustc_mir_build/src/thir/print.rs:805 — compiler/rustc_mir_build/src/thir/print.rs:805-823 | compiler/rustc_mir_build/src/thir/print.rs:827-845 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) compiler/rustc_target/src/callconv/hexagon.rs:11 — compiler/rustc_target/src/callconv/hexagon.rs:11-29 | compiler/rustc_target/src/callconv/hexagon.rs:44-62 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2143 — compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2143-2161 | compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:2164-2182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) library/compiler-builtins/libm/src/math/lgamma_r.rs:287 — library/compiler-builtins/libm/src/math/lgamma_r.rs:287-305 | library/compiler-builtins/libm/src/math/lgammaf_r.rs:222-240 — before extracting anything, compare `library/compiler-builtins/libm/src/math/lgamma_r.rs` and `library/compiler-builtins/libm/src/math/lgammaf_r.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) library/core/src/num/imp/flt2dec/mod.rs:385 — library/core/src/num/imp/flt2dec/mod.rs:385-403 | library/core/src/num/imp/flt2dec/mod.rs:630-648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×8
  • Duplicated block (9–10 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:915 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:915-924 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1339-1347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1042 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1042-1051 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1160-1168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:574 — compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:574-582 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:603-612 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) compiler/rustc_expand/src/mbe/macro_rules.rs:1767 — compiler/rustc_expand/src/mbe/macro_rules.rs:1767-1775 | compiler/rustc_expand/src/mbe/macro_rules.rs:1780-1789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) compiler/rustc_mir_transform/src/check_mut_restriction.rs:132 — compiler/rustc_mir_transform/src/check_mut_restriction.rs:132-140 | compiler/rustc_mir_transform/src/check_mut_restriction.rs:147-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) library/alloc/src/io/buffered/bufwriter.rs:394 — library/alloc/src/io/buffered/bufwriter.rs:394-403 | library/alloc/src/io/buffered/bufwriter.rs:633-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) library/compiler-builtins/compiler-builtins/src/float/div.rs:111 — library/compiler-builtins/compiler-builtins/src/float/div.rs:111-119 | library/compiler-builtins/compiler-builtins/src/float/mul.rs:18-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) library/core/src/fmt/float.rs:91 — library/core/src/fmt/float.rs:91-99 | library/core/src/fmt/float.rs:184-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×8
  • Duplicated block (5 lines × 3) compiler/rustc_builtin_macros/src/autodiff.rs:378 — compiler/rustc_builtin_macros/src/autodiff.rs:378-382 | compiler/rustc_builtin_macros/src/autodiff.rs:387-391 | compiler/rustc_builtin_macros/src/autodiff.rs:398-402 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) compiler/rustc_passes/src/check_attr.rs:563 — compiler/rustc_passes/src/check_attr.rs:563-568 | compiler/rustc_passes/src/check_attr.rs:608-612 | compiler/rustc_passes/src/check_attr.rs:655-660 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1281 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1281-1285 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1290-1294 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1298-1305 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1321 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1321-1325 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1330-1334 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1338-1345 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) compiler/rustc_borrowck/src/polonius/liveness_constraints.rs:98 — compiler/rustc_borrowck/src/polonius/liveness_constraints.rs:98-102 | compiler/rustc_infer/src/infer/outlives/test_type_match.rs:153-157 | compiler/rustc_lint/src/impl_trait_overcaptures.rs:548-552 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) compiler/rustc_index/src/slice.rs:68 — compiler/rustc_index/src/slice.rs:68-72 | compiler/rustc_index/src/slice.rs:91-95 | compiler/rustc_index/src/vec.rs:132-136 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) library/alloc/src/rcs/arc.rs:1496 — library/alloc/src/rcs/arc.rs:1496-1500 | library/alloc/src/rcs/arc.rs:5105-5109 | library/alloc/src/rcs/rc.rs:1338-1342 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) compiler/rustc_ast/src/attr/version.rs:31 — compiler/rustc_ast/src/attr/version.rs:31-35 | compiler/rustc_attr_parsing/src/attributes/util.rs:23-27 | compiler/rustc_macros/src/current_version.rs:34-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D1 · Cyclomatic Complexity · miri · ×7
  • miri::bin::miri::main (cyclomatic 92) src/tools/miri/src/bin/miri.rs:408 — miri::bin::miri::main has cyclomatic complexity 92 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • miri::diagnostics::report_result (cyclomatic 47) src/tools/miri/src/diagnostics.rs:241 — miri::diagnostics::report_result has cyclomatic complexity 47 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • miri::math::fixed_float_value (cyclomatic 29) src/tools/miri/src/math.rs:264 — miri::math::fixed_float_value has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • miri::intrinsics::x86::sse42::compare_strings (cyclomatic 26) src/tools/miri/src/intrinsics/x86/sse42.rs:73 — miri::intrinsics::x86::sse42::compare_strings has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • miri::shims::unix::linux_like::sync::futex (cyclomatic 18) src/tools/miri/src/shims/unix/linux_like/sync.rs:13 — miri::shims::unix::linux_like::sync::futex has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • miri::shims::windows::foreign_items::win_get_full_path_name (cyclomatic 17) src/tools/miri/src/shims/windows/foreign_items.rs:32 — miri::shims::windows::foreign_items::win_get_full_path_name has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • miri::diagnostics::report_msg (cyclomatic 16) src/tools/miri/src/diagnostics.rs:553 — miri::diagnostics::report_msg has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_ty_utils · ×7
  • rustc_ty_utils::layout::layout_of_uncached (cyclomatic 81) compiler/rustc_ty_utils/src/layout.rs:205 — rustc_ty_utils::layout::layout_of_uncached has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_ty_utils::consts::recurse_build (cyclomatic 44) compiler/rustc_ty_utils/src/consts.rs:35 — rustc_ty_utils::consts::recurse_build has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_ty_utils::instance::resolve_associated_item (cyclomatic 44) compiler/rustc_ty_utils/src/instance.rs:109 — rustc_ty_utils::instance::resolve_associated_item has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_ty_utils::layout::invariant::layout_sanity_check (cyclomatic 41) compiler/rustc_ty_utils/src/layout/invariant.rs:10 — rustc_ty_utils::layout::invariant::layout_sanity_check has cyclomatic complexity 41 (threshold 15). Of this number, 23 points are the body's own statements and 18 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_ty_utils::abi::arg_attrs_for_rust_scalar (cyclomatic 22) compiler/rustc_ty_utils/src/abi.rs:318 — rustc_ty_utils::abi::arg_attrs_for_rust_scalar has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_ty_utils::abi::fn_sig_for_fn_abi (cyclomatic 16) compiler/rustc_ty_utils/src/abi.rs:36 — rustc_ty_utils::abi::fn_sig_for_fn_abi has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_ty_utils::abi::fn_abi_sanity_check (cyclomatic 16) compiler/rustc_ty_utils/src/abi.rs:417 — rustc_ty_utils::abi::fn_abi_sanity_check has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (fn_arg_sanity_check, fn_arg_attrs_sanity_check). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · Command · ×7
  • Command::posix_spawn (cyclomatic 26) library/std/src/sys/process/unix/unix.rs:456 — Command::posix_spawn has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: std::sys::process::unix::unix::signal_string (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Command::fmt (cyclomatic 20) library/std/src/sys/process/unix/common.rs:499 — Command::fmt has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Command::spawn (cyclomatic 19) library/std/src/sys/process/unix/vxworks.rs:16 — Command::spawn has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Command::do_exec (cyclomatic 16) library/std/src/sys/process/unix/unix.rs:283 — Command::do_exec has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: std::sys::process::unix::unix::signal_string (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Command::fmt (cyclomatic 16) library/std/src/sys/process/unsupported.rs:139 — Command::fmt has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Command::spawn_with_attributes (cyclomatic 16) library/std/src/sys/process/windows.rs:286 — Command::spawn_with_attributes has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Command::bench (cyclomatic 16) src/tools/miri/miri-script/src/commands.rs:271 — Command::bench has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rustc_attr_parsing · ×7
  • rustc_attr_parsing::check_cfg::unexpected_cfg_name (cyclomatic 24) compiler/rustc_attr_parsing/src/check_cfg.rs:110 — rustc_attr_parsing::check_cfg::unexpected_cfg_name has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_attr_parsing::check_cfg::unexpected_cfg_value (cyclomatic 18) compiler/rustc_attr_parsing/src/check_cfg.rs:293 — rustc_attr_parsing::check_cfg::unexpected_cfg_value has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_attr_parsing::attributes::diagnostic::parse_directive_items (cyclomatic 17) compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs:276 — rustc_attr_parsing::attributes::diagnostic::parse_directive_items has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_attr_parsing::attributes::proc_macro_attrs::parse_derive_like (cyclomatic 17) compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs:59 — rustc_attr_parsing::attributes::proc_macro_attrs::parse_derive_like has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_attr_parsing::attributes::cfg::eval_config_entry (cyclomatic 16) compiler/rustc_attr_parsing/src/attributes/cfg.rs:229 — rustc_attr_parsing::attributes::cfg::eval_config_entry has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_attr_parsing::attributes::cfg_select::lint_unreachable (cyclomatic 16) compiler/rustc_attr_parsing/src/attributes/cfg_select.rs:159 — rustc_attr_parsing::attributes::cfg_select::lint_unreachable has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_attr_parsing::attributes::rustc_internal::parse_cgu_fields (cyclomatic 16) compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs:254 — rustc_attr_parsing::attributes::rustc_internal::parse_cgu_fields has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · rustc_parse · ×7
  • rustc_parse::lexer::unescape_error_reporting::emit_unescape_error (cognitive 52) compiler/rustc_parse/src/lexer/unescape_error_reporting.rs:15 — rustc_parse::lexer::unescape_error_reporting::emit_unescape_error has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 8, match/switch 3 (6 pts), loops 2 (4 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_parse::parser::asm::parse_asm_operand (cognitive 37) compiler/rustc_parse/src/parser/asm.rs:98 — rustc_parse::parser::asm::parse_asm_operand has cognitive complexity 37 (threshold 15). Drivers by points: if/else 25 (37 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_parse::lexer::diagnostics::report_suspicious_mismatch_block (cognitive 26) compiler/rustc_parse/src/lexer/diagnostics.rs:72 — rustc_parse::lexer::diagnostics::report_suspicious_mismatch_block has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_parse::parser::asm::parse_asm_args (cognitive 25) compiler/rustc_parse/src/parser/asm.rs:169 — rustc_parse::parser::asm::parse_asm_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_parse::new_parser_from_file (cognitive 23) compiler/rustc_parse/src/lib.rs:111 — rustc_parse::new_parser_from_file has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_parse::parser::asm::parse_options (cognitive 17) compiler/rustc_parse/src/parser/asm.rs:289 — rustc_parse::parser::asm::parse_options has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_parse::parser::generics::suggest_replacing_equality_pred_with_assoc_item_constraint (cognitive 17) compiler/rustc_parse/src/parser/generics.rs:692 — rustc_parse::parser::generics::suggest_replacing_equality_pred_with_assoc_item_constraint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Command · ×7
  • Command::fmt (cognitive 38) library/std/src/sys/process/unix/common.rs:499 — Command::fmt has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 3 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Command::posix_spawn (cognitive 37) library/std/src/sys/process/unix/unix.rs:456 — Command::posix_spawn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (25 pts), match/switch 4 (7 pts), boolean chains 4, loops 1 (nesting depth added 10). Of this number, 29 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Command::fmt (cognitive 34) library/std/src/sys/process/unsupported.rs:139 — Command::fmt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 3 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Command::spawn (cognitive 26) library/std/src/sys/process/unix/vxworks.rs:16 — Command::spawn has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 11 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Command::bench (cognitive 22) src/tools/miri/miri-script/src/commands.rs:271 — Command::bench has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Command::do_exec (cognitive 21) library/std/src/sys/process/unix/unix.rs:283 — Command::do_exec has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Command::spawn_with_attributes (cognitive 19) library/std/src/sys/process/windows.rs:286 — Command::spawn_with_attributes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 2, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EvalCtxt · ×7
  • EvalCtxt::term_is_fully_unconstrained (cognitive 32) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1174 — EvalCtxt::term_is_fully_unconstrained has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 7, match/switch 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalCtxt::normalize_opaque_type (cognitive 24) compiler/rustc_next_trait_solver/src/solve/project_goals/opaque_types.rs:17 — EvalCtxt::normalize_opaque_type has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 6 (10 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EvalCtxt::evaluate_goal_raw (cognitive 23) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:749 — EvalCtxt::evaluate_goal_raw has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 6 (10 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalCtxt::consider_builtin_upcast_to_principal (cognitive 23) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:1097 — EvalCtxt::consider_builtin_upcast_to_principal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalCtxt::merge_trait_candidates (cognitive 22) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:1639 — EvalCtxt::merge_trait_candidates has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (4 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalCtxt::filter_specialized_impls (cognitive 20) compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:1067 — EvalCtxt::filter_specialized_impls has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalCtxt::try_assemble_bounds_via_registered_opaques (cognitive 18) compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:1128 — EvalCtxt::try_assemble_bounds_via_registered_opaques has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hir · ×7
  • hir::display::write_function (cognitive 31) src/tools/rust-analyzer/crates/hir/src/display.rs:159 — hir::display::write_function has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • hir::source_analyzer::resolve_hir_path_ (cognitive 29) src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:1873 — hir::source_analyzer::resolve_hir_path_ has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir::display::write_generic_params_or_args (cognitive 25) src/tools/rust-analyzer/crates/hir/src/display.rs:710 — hir::display::write_generic_params_or_args has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, match/switch 1 (3 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir::display::write_variants (cognitive 24) src/tools/rust-analyzer/crates/hir/src/display.rs:497 — hir::display::write_variants has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir::term_search::tactics::data_constructor (cognitive 23) src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs:126 — hir::term_search::tactics::data_constructor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir::display::write_fields (cognitive 19) src/tools/rust-analyzer/crates/hir/src/display.rs:462 — hir::display::write_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir::term_search::tactics::free_function (cognitive 18) src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs:270 — hir::term_search::tactics::free_function has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×7
  • Duplicated block (12–13 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2189 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2189-2201 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2375-2386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) compiler/rustc_infer/src/infer/at.rs:80 — compiler/rustc_infer/src/infer/at.rs:80-92 | compiler/rustc_infer/src/infer/at.rs:111-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:283 — compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:283-295 | compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:322-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:398 — compiler/rustc_target/src/callconv/loongarch.rs:398-410 | compiler/rustc_target/src/callconv/riscv.rs:404-415 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–13 lines × 2) compiler/rustc_trait_selection/src/traits/wf.rs:1096 — compiler/rustc_trait_selection/src/traits/wf.rs:1096-1108 | compiler/rustc_trait_selection/src/traits/wf.rs:1154-1165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) library/alloc/src/collections/binary_heap/mod.rs:840 — library/alloc/src/collections/binary_heap/mod.rs:840-852 | library/alloc/src/collections/binary_heap/mod.rs:901-912 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) src/etc/debugger_tester/common.py:637 — src/etc/debugger_tester/common.py:637-649 | src/etc/debugger_tester/lldb/check_lldb.py:163-174 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×7
  • Duplicated block (11 lines × 3) compiler/rustc_ast/src/token.rs:1032 — compiler/rustc_ast/src/token.rs:1032-1042 | compiler/rustc_ast/src/token.rs:1048-1058 | compiler/rustc_ast/src/token.rs:1062-1072 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:155 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:155-165 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1094-1104 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:1146-1156 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1591 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1591-1601 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2606-2616 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2708-2718 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) compiler/rustc_codegen_llvm/src/asm.rs:1248 — compiler/rustc_codegen_llvm/src/asm.rs:1248-1258 | compiler/rustc_codegen_llvm/src/asm.rs:1441-1451 | compiler/rustc_codegen_llvm/src/asm.rs:1616-1626 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:1385 — compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:1385-1396 | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs:1424-1434 | compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs:156-167 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) compiler/rustc_middle/src/ty/util.rs:1208 — compiler/rustc_middle/src/ty/util.rs:1208-1218 | compiler/rustc_middle/src/ty/util.rs:1258-1268 | compiler/rustc_mir_transform/src/gvn.rs:1745-1755 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs:382 — compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs:382-392 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:384-394 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:735-745 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D1 · Cyclomatic Complexity · TypeChecker · ×6
  • TypeChecker::visit_rvalue (cyclomatic 114) compiler/rustc_mir_transform/src/validate.rs:1018 — TypeChecker::visit_rvalue has cyclomatic complexity 114 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeChecker::visit_rvalue (cyclomatic 68) compiler/rustc_borrowck/src/type_check/mod.rs:992 — TypeChecker::visit_rvalue has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeChecker::visit_projection_elem (cyclomatic 47) compiler/rustc_mir_transform/src/validate.rs:668 — TypeChecker::visit_projection_elem has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeChecker::check_iscleanup (cyclomatic 26) compiler/rustc_borrowck/src/type_check/mod.rs:2081 — TypeChecker::check_iscleanup has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeChecker::visit_terminator (cyclomatic 24) compiler/rustc_borrowck/src/type_check/mod.rs:739 — TypeChecker::visit_terminator has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeChecker::visit_statement (cyclomatic 19) compiler/rustc_mir_transform/src/validate.rs:1482 — TypeChecker::visit_statement has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tidy · ×6
  • tidy::style::check_file_style (cyclomatic 92) src/tools/tidy/src/style.rs:327 — tidy::style::check_file_style has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • tidy::features::collect_lang_features_in (cyclomatic 25) src/tools/tidy/src/features.rs:284 — tidy::features::collect_lang_features_in has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • tidy::triagebot::check (cyclomatic 21) src/tools/tidy/src/triagebot.rs:21 — tidy::triagebot::check has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • tidy::extra_checks::check (cyclomatic 18) src/tools/tidy/src/extra_checks/mod.rs:49 — tidy::extra_checks::check has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • tidy::features::check (cyclomatic 18) src/tools/tidy/src/features.rs:93 — tidy::features::check has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • tidy::deps::check_permitted_dependencies (cyclomatic 16) src/tools/tidy/src/deps.rs:962 — tidy::deps::check_permitted_dependencies has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExprCollector · ×6
  • ExprCollector::maybe_collect_expr (cyclomatic 89) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:1417 — ExprCollector::maybe_collect_expr has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExprCollector::lower_inline_asm (cyclomatic 49) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/asm.rs:17 — ExprCollector::lower_inline_asm has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExprCollector::collect_pat (cyclomatic 40) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2912 — ExprCollector::collect_pat has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ExprCollector::maybe_collect_expr_as_pat (cyclomatic 29) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:2080 — ExprCollector::maybe_collect_expr_as_pat has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExprCollector::collect_format_args_impl (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/format_args.rs:110 — ExprCollector::collect_format_args_impl has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExprCollector::lower_type_ref (cyclomatic 20) src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs:746 — ExprCollector::lower_type_ref has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DocSearch.execQuery · ×6
  • DocSearch.execQuery::unifyFunctionTypes (cyclomatic 47) REDACTED:2979 — DocSearch.execQuery::unifyFunctionTypes has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::unifyFunctionTypeIsMatchCandidate (cyclomatic 33) REDACTED:3524 — DocSearch.execQuery::unifyFunctionTypeIsMatchCandidate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::formatDisplayTypeSignature::writeFn (cyclomatic 27) REDACTED:2504 — DocSearch.execQuery::formatDisplayTypeSignature::writeFn has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::transformResults, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::unifyGenericTypes (cyclomatic 23) REDACTED:3312 — DocSearch.execQuery::unifyGenericTypes has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::transformResults (cyclomatic 22) REDACTED:2660 — DocSearch.execQuery::transformResults has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::buildHrefAndPath, DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DocSearch.execQuery::buildHrefAndPath (cyclomatic 18) REDACTED:2165 — DocSearch.execQuery::buildHrefAndPath has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 5 other methods here (DocSearch.execQuery::formatDisplayTypeSignature::writeFn, DocSearch.execQuery::transformResults, DocSearch.execQuery::unifyFunctionTypes, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ExprUseVisitor · ×6
  • ExprUseVisitor::walk_expr (cyclomatic 41) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:390 — ExprUseVisitor::walk_expr has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ExprUseVisitor::walk_expr (cyclomatic 40) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:502 — ExprUseVisitor::walk_expr has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ExprUseVisitor::cat_pattern (cyclomatic 22) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:1590 — ExprUseVisitor::cat_pattern has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ExprUseVisitor::cat_pattern (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:1496 — ExprUseVisitor::cat_pattern has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ExprUseVisitor::walk_pat (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs:879 — ExprUseVisitor::walk_pat has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExprUseVisitor::walk_pat (cyclomatic 17) compiler/rustc_hir_typeck/src/expr_use_visitor.rs:828 — ExprUseVisitor::walk_pat has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VnState · ×6
  • VnState::eval_to_const_inner (cyclomatic 39) compiler/rustc_mir_transform/src/gvn.rs:571 — VnState::eval_to_const_inner has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • VnState::project (cyclomatic 22) compiler/rustc_mir_transform/src/gvn.rs:822 — VnState::project has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • VnState::simplify_cast (cyclomatic 22) compiler/rustc_mir_transform/src/gvn.rs:1564 — VnState::simplify_cast has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • VnState::simplify_aggregate (cyclomatic 20) compiler/rustc_mir_transform/src/gvn.rs:1201 — VnState::simplify_aggregate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • VnState::simplify_binary_inner (cyclomatic 18) compiler/rustc_mir_transform/src/gvn.rs:1441 — VnState::simplify_binary_inner has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • VnState::simplify_unary (cyclomatic 16) compiler/rustc_mir_transform/src/gvn.rs:1297 — VnState::simplify_unary has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FnAbi · ×6
  • FnAbi::adjust_for_foreign_abi (cyclomatic 36) compiler/rustc_target/src/callconv/mod.rs:697 — FnAbi::adjust_for_foreign_abi has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FnAbi::apply_attrs_llfn (cyclomatic 29) compiler/rustc_codegen_llvm/src/abi.rs:459 — FnAbi::apply_attrs_llfn has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FnAbi::adjust_for_rust_abi (cyclomatic 26) compiler/rustc_target/src/callconv/mod.rs:784 — FnAbi::adjust_for_rust_abi has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • FnAbi::gcc_type (cyclomatic 23) compiler/rustc_codegen_gcc/src/abi.rs:131 — FnAbi::gcc_type has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FnAbi::apply_attrs_callsite (cyclomatic 18) compiler/rustc_codegen_llvm/src/abi.rs:640 — FnAbi::apply_attrs_callsite has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FnAbi::llvm_type (cyclomatic 16) compiler/rustc_codegen_llvm/src/abi.rs:364 — FnAbi::llvm_type has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DefCollector · ×6
  • DefCollector::build_reduced_graph_for_use_tree (cyclomatic 31) compiler/rustc_resolve/src/build_reduced_graph.rs:592 — DefCollector::build_reduced_graph_for_use_tree has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DefCollector::resolve_macros (cyclomatic 31) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1306 — DefCollector::resolve_macros has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DefCollector::seed_with_top_level (cyclomatic 25) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:277 — DefCollector::seed_with_top_level has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • DefCollector::record_resolved_import (cyclomatic 24) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:882 — DefCollector::record_resolved_import has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DefCollector::push_res_and_update_glob_vis (cyclomatic 23) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1202 — DefCollector::push_res_and_update_glob_vis has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DefCollector::build_reduced_graph_for_item (cyclomatic 19) compiler/rustc_resolve/src/build_reduced_graph.rs:823 — DefCollector::build_reduced_graph_for_item has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_lint · ×6
  • rustc_lint::foreign_modules::structurally_same_type_impl (cyclomatic 30) compiler/rustc_lint/src/foreign_modules.rs:225 — rustc_lint::foreign_modules::structurally_same_type_impl has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_lint::types::lint_nan (cyclomatic 29) compiler/rustc_lint/src/types.rs:225 — rustc_lint::types::lint_nan has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to 3 function items inside it that branch (eq_ne_suggestion, nan_ty, nan_method_path). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • rustc_lint::unused::must_use::is_ty_must_use (cyclomatic 25) compiler/rustc_lint/src/unused/must_use.rs:139 — rustc_lint::unused::must_use::is_ty_must_use has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_lint::lifetime_syntax::emit_mismatch_diagnostic (cyclomatic 18) compiler/rustc_lint/src/lifetime_syntax.rs:240 — rustc_lint::lifetime_syntax::emit_mismatch_diagnostic has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_lint::types::lint_wide_pointer (cyclomatic 17) compiler/rustc_lint/src/types.rs:364 — rustc_lint::types::lint_wide_pointer has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_lint::unused::must_use::emit_must_use_untranslated (cyclomatic 17) compiler/rustc_lint/src/unused/must_use.rs:498 — rustc_lint::unused::must_use::emit_must_use_untranslated has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · Printer · ×6
  • Printer::print_expr_in (cognitive 88) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:531 — Printer::print_expr_in has cognitive complexity 88 (threshold 15). Drivers by points: if/else 23 (50 pts), loops 7 (19 pts), match/switch 10 (19 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Printer::print_pat (cognitive 54) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:896 — Printer::print_pat has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 6 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Printer::print_type_ref (cognitive 28) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1259 — Printer::print_type_ref has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Printer::default_print_def_path (cognitive 23) compiler/rustc_middle/src/ty/print/mod.rs:148 — Printer::default_print_def_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Printer::print_path (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1111 — Printer::print_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Printer::print_type_bounds (cognitive 19) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1364 — Printer::print_type_bounds has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_session · ×6
  • rustc_session::config::cfg::default_configuration (cognitive 49) compiler/rustc_session/src/config/cfg.rs:165 — rustc_session::config::cfg::default_configuration has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_session::options::build_options (cognitive 37) compiler/rustc_session/src/options.rs:733 — rustc_session::options::build_options has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 5 (16 pts), loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_session::utils::extra_compiler_flags (cognitive 23) compiler/rustc_session/src/utils.rs:63 — rustc_session::utils::extra_compiler_flags has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_session::options::parse::parse_instrument_xray (cognitive 19) compiler/rustc_session/src/options.rs:1711 — rustc_session::options::parse::parse_instrument_xray has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_session::options::parse::parse_offload (cognitive 17) compiler/rustc_session/src/options.rs:1517 — rustc_session::options::parse::parse_offload has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_session::diagnostics::create_lit_error (cognitive 16) compiler/rustc_session/src/diagnostics.rs:594 — rustc_session::diagnostics::create_lit_error has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 4 (6 pts), boolean chains 3 (nesting depth added 4). Of this number, 12 points are the body's own statements and 4 belong to 2 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FmtVisitor · ×6
  • FmtVisitor::close_block (cognitive 48) src/tools/rustfmt/src/visitor.rs:263 — FmtVisitor::close_block has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 5 (17 pts), boolean chains 6, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FmtVisitor::visit_item (cognitive 25) src/tools/rustfmt/src/visitor.rs:443 — FmtVisitor::visit_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), match/switch 3 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FmtVisitor::visit_stmt (cognitive 20) src/tools/rustfmt/src/visitor.rs:118 — FmtVisitor::visit_stmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FmtVisitor::visit_impl_items (cognitive 19) src/tools/rustfmt/src/items.rs:736 — FmtVisitor::visit_impl_items has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (6 pts), if/else 3 (5 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FmtVisitor::process_comment (cognitive 17) src/tools/rustfmt/src/missed_spans.rs:235 — FmtVisitor::process_comment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FmtVisitor::process_missing_code (cognitive 16) src/tools/rustfmt/src/missed_spans.rs:329 — FmtVisitor::process_missing_code has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodegenCx · ×6
  • CodegenCx::codegen_global_asm (cognitive 27) compiler/rustc_codegen_gcc/src/asm.rs:944 — CodegenCx::codegen_global_asm has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 4 (14 pts), if/else 4 (8 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CodegenCx::get_static_inner (cognitive 24) compiler/rustc_codegen_llvm/src/consts.rs:367 — CodegenCx::get_static_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodegenCx::codegen_static_item (cognitive 24) compiler/rustc_codegen_llvm/src/consts.rs:474 — CodegenCx::codegen_static_item has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • CodegenCx::declare_fn (cognitive 22) compiler/rustc_codegen_llvm/src/declare.rs:165 — CodegenCx::declare_fn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodegenCx::codegen_global_asm (cognitive 21) compiler/rustc_codegen_llvm/src/asm.rs:412 — CodegenCx::codegen_global_asm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodegenCx::scalar_to_backend_with_pac (cognitive 16) compiler/rustc_codegen_gcc/src/common.rs:330 — CodegenCx::scalar_to_backend_with_pac has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×6
  • Duplicated block (13–14 lines × 2) compiler/rustc_abi/src/lib.rs:546 — compiler/rustc_abi/src/lib.rs:546-558 | compiler/rustc_abi/src/lib.rs:589-602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) compiler/rustc_attr_parsing/src/attributes/crate_level.rs:304 — compiler/rustc_attr_parsing/src/attributes/crate_level.rs:304-316 | compiler/rustc_attr_parsing/src/attributes/crate_level.rs:344-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:116 — compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:116-128 | compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:290-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) compiler/rustc_pattern_analysis/src/usefulness.rs:1623 — compiler/rustc_pattern_analysis/src/usefulness.rs:1623-1635 | compiler/rustc_pattern_analysis/src/usefulness.rs:1639-1652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) library/alloc/src/vec/into_iter.rs:348 — library/alloc/src/vec/into_iter.rs:348-360 | library/alloc/src/vec/into_iter.rs:490-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) src/etc/debugger_tester/gdb/check_gdb.py:130 — src/etc/debugger_tester/gdb/check_gdb.py:130-142 | src/etc/debugger_tester/lldb/check_lldb.py:202-215 — `src/etc/debugger_tester/gdb/check_gdb.py` and `src/etc/debugger_tester/lldb/check_lldb.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/etc/debugger_tester/lldb/check_lldb.py:202` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:376 — compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:376-383 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:622-629 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:734-741 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) compiler/rustc_middle/src/mir/pretty.rs:226 — compiler/rustc_middle/src/mir/pretty.rs:226-233 | compiler/rustc_middle/src/mir/pretty.rs:235-242 | compiler/rustc_middle/src/mir/pretty.rs:248-255 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:206 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:206-213 | compiler/rustc_trait_selection/src/traits/effects.rs:361-368 | compiler/rustc_trait_selection/src/traits/select/mod.rs:2085-2092 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs` and `compiler/rustc_trait_selection/src/traits/effects.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) compiler/rustc_target/src/callconv/loongarch.rs:92 — compiler/rustc_target/src/callconv/loongarch.rs:92-99 | compiler/rustc_target/src/callconv/riscv.rs:97-104 | compiler/rustc_target/src/callconv/sparc64.rs:72-79 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) library/std/src/os/unix/net/datagram.rs:72 — library/std/src/os/unix/net/datagram.rs:72-79 | library/std/src/os/unix/net/stream.rs:90-97 | library/std/src/os/windows/net/stream.rs:44-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) compiler/rustc_codegen_cranelift/build_system/rustc_info.rs:26 — compiler/rustc_codegen_cranelift/build_system/rustc_info.rs:26-33 | compiler/rustc_codegen_cranelift/build_system/rustc_info.rs:39-46 | compiler/rustc_codegen_cranelift/build_system/rustc_info.rs:52-59 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · Printer · ×5
  • Printer::print_expr_in (cyclomatic 79) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:531 — Printer::print_expr_in has cyclomatic complexity 79 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Printer::print_pat (cyclomatic 40) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:896 — Printer::print_pat has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Printer::print_path (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1111 — Printer::print_path has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Printer::print_type_ref (cyclomatic 26) src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs:1259 — Printer::print_type_ref has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Printer::print_mod_item (cyclomatic 21) src/tools/rust-analyzer/crates/hir-def/src/item_tree/pretty.rs:155 — Printer::print_mod_item has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GlobalState · ×5
  • GlobalState::handle_event (cyclomatic 74) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:315 — GlobalState::handle_event has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • GlobalState::handle_task (cyclomatic 30) src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs:850 — GlobalState::handle_task has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • GlobalState::switch_workspaces (cyclomatic 29) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:467 — GlobalState::switch_workspaces has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • GlobalState::process_changes (cyclomatic 25) src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs:338 — GlobalState::process_changes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • GlobalState::current_status (cyclomatic 22) src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs:128 — GlobalState::current_status has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SelectionContext · ×5
  • SelectionContext::evaluate_predicate_recursively (cyclomatic 67) compiler/rustc_trait_selection/src/traits/select/mod.rs:524 — SelectionContext::evaluate_predicate_recursively has cyclomatic complexity 67 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SelectionContext::winnow_candidates (cyclomatic 49) compiler/rustc_trait_selection/src/traits/select/mod.rs:1716 — SelectionContext::winnow_candidates has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SelectionContext::assemble_candidates_from_auto_impls (cyclomatic 20) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:741 — SelectionContext::assemble_candidates_from_auto_impls has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SelectionContext::assemble_candidates (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • SelectionContext::assemble_builtin_copy_clone_candidate (cyclomatic 19) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:1148 — SelectionContext::assemble_builtin_copy_clone_candidate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SelectionContext::assemble_candidates (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • SelectionContext::assemble_candidates_for_unsizing (cyclomatic 17) compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:985 — SelectionContext::assemble_candidates_for_unsizing has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SelectionContext::assemble_candidates (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PrettyPrinter · ×5
  • PrettyPrinter::pretty_print_type (cyclomatic 57) compiler/rustc_middle/src/ty/print/pretty.rs:759 — PrettyPrinter::pretty_print_type has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PrettyPrinter::pretty_print_opaque_impl_type (cyclomatic 43) compiler/rustc_middle/src/ty/print/pretty.rs:1041 — PrettyPrinter::pretty_print_opaque_impl_type has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PrettyPrinter::pretty_print_const_valtree (cyclomatic 23) compiler/rustc_middle/src/ty/print/pretty.rs:1892 — PrettyPrinter::pretty_print_const_valtree has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • PrettyPrinter::pretty_print_const_expr (cyclomatic 22) compiler/rustc_middle/src/ty/print/pretty.rs:1614 — PrettyPrinter::pretty_print_const_expr has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PrettyPrinter::try_print_visible_def_path_recur (cyclomatic 18) compiler/rustc_middle/src/ty/print/pretty.rs:490 — PrettyPrinter::try_print_visible_def_path_recur has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hir_expand · ×5
  • hir_expand::builtin::derive_macro::coerce_pointee_expand (cyclomatic 57) src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs:1128 — hir_expand::builtin::derive_macro::coerce_pointee_expand has cyclomatic complexity 57 (threshold 15). Of this number, 33 points are the body's own statements and 24 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_expand::fixup::fixup_syntax (cyclomatic 41) src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs:52 — hir_expand::fixup::fixup_syntax has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_expand::cfg_process::macro_input_callback (cyclomatic 35) src/tools/rust-analyzer/crates/hir-expand/src/cfg_process.rs:47 — hir_expand::cfg_process::macro_input_callback has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_expand::builtin::fn_macro::concat_expand (cyclomatic 21) src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs:544 — hir_expand::builtin::fn_macro::concat_expand has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: BuiltinFnLikeExpander::find_by_name (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • hir_expand::mod_path::convert_path (cyclomatic 19) src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs:259 — hir_expand::mod_path::convert_path has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · mbe · ×5
  • mbe::expander::matcher::match_loop_inner (cyclomatic 45) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:366 — mbe::expander::matcher::match_loop_inner has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mbe::expander::transcriber::expand_subtree (cyclomatic 30) src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs:167 — mbe::expander::transcriber::expand_subtree has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mbe::expander::matcher::match_loop (cyclomatic 22) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:624 — mbe::expander::matcher::match_loop has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mbe::expander::matcher::match_meta_var (cyclomatic 21) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:775 — mbe::expander::matcher::match_meta_var has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • mbe::parser::eat_fragment_kind (cyclomatic 19) src/tools/rust-analyzer/crates/mbe/src/parser.rs:296 — mbe::parser::eat_fragment_kind has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_mir_build · ×5
  • rustc_mir_build::thir::pattern::check_match::report_non_exhaustive_match (cyclomatic 38) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:1250 — rustc_mir_build::thir::pattern::check_match::report_non_exhaustive_match has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_build::thir::pattern::check_match::find_fallback_pattern_typo (cyclomatic 29) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:1043 — rustc_mir_build::thir::pattern::check_match::find_fallback_pattern_typo has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_build::thir::constant::lit_to_const (cyclomatic 27) compiler/rustc_mir_build/src/thir/constant.rs:10 — rustc_mir_build::thir::constant::lit_to_const has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_mir_build::builder::expr::as_constant::as_constant_inner (cyclomatic 16) compiler/rustc_mir_build/src/builder/expr/as_constant.rs:46 — rustc_mir_build::builder::expr::as_constant::as_constant_inner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_mir_build::thir::pattern::check_match::check_borrow_conflicts_in_at_patterns (cyclomatic 16) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:770 — rustc_mir_build::thir::pattern::check_match::check_borrow_conflicts_in_at_patterns has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · parser · ×5
  • parser::grammar::items::opt_item (cyclomatic 38) src/tools/rust-analyzer/crates/parser/src/grammar/items.rs:109 — parser::grammar::items::opt_item has cyclomatic complexity 38 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • parser::grammar::expressions::atom::atom_expr (cyclomatic 37) src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs:73 — parser::grammar::expressions::atom::atom_expr has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • parser::grammar::expressions::atom::parse_asm_expr (cyclomatic 22) src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs:349 — parser::grammar::expressions::atom::parse_asm_expr has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • parser::grammar::expressions::atom::builtin_expr (cyclomatic 18) src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs:256 — parser::grammar::expressions::atom::builtin_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • parser::grammar::expressions::expr_bp (cyclomatic 16) src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs:248 — parser::grammar::expressions::expr_bp has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::grammar::expressions::current_op (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · MirLowerCtx · ×5
  • MirLowerCtx::lower_expr_to_place_without_adjust (cognitive 208) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:370 — MirLowerCtx::lower_expr_to_place_without_adjust has cognitive complexity 208 (threshold 15). Drivers by points: if/else 62 (140 pts), match/switch 23 (54 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 114). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirLowerCtx::pattern_match_inner (cognitive 78) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs:117 — MirLowerCtx::pattern_match_inner has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (60 pts), match/switch 5 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 42). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MirLowerCtx::lower_expr_as_place_without_adjust (cognitive 37) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs:117 — MirLowerCtx::lower_expr_as_place_without_adjust has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirLowerCtx::lower_block_to_place (cognitive 34) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1677 — MirLowerCtx::lower_block_to_place has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MirLowerCtx::lower_params_and_bindings (cognitive 20) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1758 — MirLowerCtx::lower_params_and_bindings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_interface · ×5
  • rustc_interface::interface::parse_check_cfg (cognitive 154) compiler/rustc_interface/src/interface.rs:116 — rustc_interface::interface::parse_check_cfg has cognitive complexity 154 (threshold 15). Drivers by points: if/else 45 (127 pts), loops 4 (10 pts), boolean chains 9, match/switch 3 (8 pts) (nesting depth added 93). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_interface::passes::write_out_deps (cognitive 31) compiler/rustc_interface/src/passes.rs:588 — rustc_interface::passes::write_out_deps has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 5 (7 pts), match/switch 3 (nesting depth added 10). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_interface::passes::configure_and_expand (cognitive 24) compiler/rustc_interface/src/passes.rs:136 — rustc_interface::passes::configure_and_expand has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • rustc_interface::passes::write_dep_info (cognitive 19) compiler/rustc_interface/src/passes.rs:827 — rustc_interface::passes::write_dep_info has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_interface::interface::parse_cfg (cognitive 17) compiler/rustc_interface/src/interface.rs:47 — rustc_interface::interface::parse_cfg has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_resolve · ×5
  • rustc_resolve::diagnostics::impls::show_candidates (cognitive 125) compiler/rustc_resolve/src/diagnostics/impls.rs:4123 — rustc_resolve::diagnostics::impls::show_candidates has cognitive complexity 125 (threshold 15). Drivers by points: if/else 51 (96 pts), loops 8 (19 pts), match/switch 2 (6 pts), boolean chains 4 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_resolve::rustdoc::source_span_for_markdown_range_inner (cognitive 56) compiler/rustc_resolve/src/rustdoc.rs:565 — rustc_resolve::rustdoc::source_span_for_markdown_range_inner has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (44 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_resolve::check_unused::calc_unused_spans (cognitive 38) compiler/rustc_resolve/src/check_unused.rs:302 — rustc_resolve::check_unused::calc_unused_spans has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_resolve::rustdoc::strip_generics_from_path (cognitive 24) compiler/rustc_resolve/src/rustdoc.rs:311 — rustc_resolve::rustdoc::strip_generics_from_path has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_resolve::rustdoc::parse_links (cognitive 16) compiler/rustc_resolve/src/rustdoc.rs:439 — rustc_resolve::rustdoc::parse_links has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrettyPrinter · ×5
  • PrettyPrinter::pretty_print_opaque_impl_type (cognitive 82) compiler/rustc_middle/src/ty/print/pretty.rs:1041 — PrettyPrinter::pretty_print_opaque_impl_type has cognitive complexity 82 (threshold 15). Drivers by points: if/else 22 (46 pts), loops 7 (14 pts), match/switch 4 (13 pts), boolean chains 9 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PrettyPrinter::pretty_print_type (cognitive 72) compiler/rustc_middle/src/ty/print/pretty.rs:759 — PrettyPrinter::pretty_print_type has cognitive complexity 72 (threshold 15). Drivers by points: if/else 30 (57 pts), match/switch 6 (14 pts), boolean chains 1 (nesting depth added 35). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PrettyPrinter::pretty_print_const_valtree (cognitive 29) compiler/rustc_middle/src/ty/print/pretty.rs:1892 — PrettyPrinter::pretty_print_const_valtree has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 4 (8 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PrettyPrinter::pretty_print_dyn_existential (cognitive 25) compiler/rustc_middle/src/ty/print/pretty.rs:1381 — PrettyPrinter::pretty_print_dyn_existential has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PrettyPrinter::try_print_visible_def_path_recur (cognitive 24) compiler/rustc_middle/src/ty/print/pretty.rs:490 — PrettyPrinter::try_print_visible_def_path_recur has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_driver_impl · ×5
  • rustc_driver_impl::print_crate_info (cognitive 77) compiler/rustc_driver_impl/src/lib.rs:630 — rustc_driver_impl::print_crate_info has cognitive complexity 77 (threshold 15). Drivers by points: if/else 16 (40 pts), loops 9 (25 pts), match/switch 3 (8 pts), boolean chains 4 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_driver_impl::compiler_entrypoint (cognitive 25) compiler/rustc_driver_impl/src/lib.rs:172 — rustc_driver_impl::compiler_entrypoint has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_driver_impl::install_ice_hook (cognitive 20) compiler/rustc_driver_impl/src/lib.rs:1461 — rustc_driver_impl::install_ice_hook has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (7 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_driver_impl::report_ice (cognitive 19) compiler/rustc_driver_impl/src/lib.rs:1540 — rustc_driver_impl::report_ice has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_driver_impl::handle_explain (cognitive 18) compiler/rustc_driver_impl/src/lib.rs:427 — rustc_driver_impl::handle_explain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Lexer · ×5
  • Lexer::next_token_from_cursor (cognitive 72) compiler/rustc_parse/src/lexer/mod.rs:161 — Lexer::next_token_from_cursor has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (64 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lexer::lex_token_tree_open_delim (cognitive 42) compiler/rustc_parse/src/lexer/tokentrees.rs:54 — Lexer::lex_token_tree_open_delim has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Lexer::cook_lexer_literal (cognitive 40) compiler/rustc_parse/src/lexer/mod.rs:795 — Lexer::cook_lexer_literal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 1 (3 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Lexer::maybe_report_guarded_str (cognitive 19) compiler/rustc_parse/src/lexer/mod.rs:1144 — Lexer::maybe_report_guarded_str has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lexer::lex_token_trees (cognitive 17) compiler/rustc_parse/src/lexer/tokentrees.rs:14 — Lexer::lex_token_trees has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_mir_build · ×5
  • rustc_mir_build::thir::pattern::check_match::find_fallback_pattern_typo (cognitive 71) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:1043 — rustc_mir_build::thir::pattern::check_match::find_fallback_pattern_typo has cognitive complexity 71 (threshold 15). Drivers by points: if/else 19 (51 pts), loops 4 (13 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_mir_build::thir::pattern::check_match::report_non_exhaustive_match (cognitive 63) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:1250 — rustc_mir_build::thir::pattern::check_match::report_non_exhaustive_match has cognitive complexity 63 (threshold 15). Drivers by points: if/else 31 (49 pts), boolean chains 7, loops 3 (5 pts), match/switch 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_build::builder::scope::build_scope_drops (cognitive 25) compiler/rustc_mir_build/src/builder/scope.rs:1793 — rustc_mir_build::builder::scope::build_scope_drops has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_build::thir::constant::lit_to_const (cognitive 18) compiler/rustc_mir_build/src/thir/constant.rs:10 — rustc_mir_build::thir::constant::lit_to_const has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_mir_build::builder::expr::as_constant::as_constant_inner (cognitive 16) compiler/rustc_mir_build/src/builder/expr/as_constant.rs:46 — rustc_mir_build::builder::expr::as_constant::as_constant_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ProbeContext · ×5
  • ProbeContext::consider_probe (cognitive 69) compiler/rustc_hir_typeck/src/method/probe.rs:2002 — ProbeContext::consider_probe has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (45 pts), match/switch 6 (11 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProbeContext::consider_probe (cognitive 30) src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs:1567 — ProbeContext::consider_probe has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProbeContext::pick_all_method (cognitive 26) compiler/rustc_hir_typeck/src/method/probe.rs:1331 — ProbeContext::pick_all_method has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ProbeContext::assemble_extension_candidates_for_trait (cognitive 19) compiler/rustc_hir_typeck/src/method/probe.rs:1139 — ProbeContext::assemble_extension_candidates_for_trait has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProbeContext::collapse_candidates_to_subtrait_pick (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs:1909 — ProbeContext::collapse_candidates_to_subtrait_pick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Checker · ×5
  • Checker::visit_item (cognitive 65) compiler/rustc_passes/src/stability.rs:717 — Checker::visit_item has cognitive complexity 65 (threshold 15). Drivers by points: if/else 15 (49 pts), loops 2 (6 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 41). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Checker::visit_terminator (cognitive 53) compiler/rustc_const_eval/src/check_consts/check.rs:723 — Checker::visit_terminator has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (35 pts), match/switch 5 (11 pts), boolean chains 7 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Checker::visit_rvalue (cognitive 24) compiler/rustc_const_eval/src/check_consts/check.rs:528 — Checker::visit_rvalue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Checker::check_url (cognitive 24) src/tools/linkchecker/main.rs:312 — Checker::check_url has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::visit_use::recurse (cognitive 18) compiler/rustc_passes/src/stability.rs:898 — Checker::visit_use::recurse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_metadata · ×5
  • rustc_metadata::dependency_format::calculate_type (cognitive 63) compiler/rustc_metadata/src/dependency_format.rs:84 — rustc_metadata::dependency_format::calculate_type has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 8 (14 pts), boolean chains 8, match/switch 4 (7 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_metadata::dependency_format::verify_ok (cognitive 41) compiler/rustc_metadata/src/dependency_format.rs:403 — rustc_metadata::dependency_format::verify_ok has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_metadata::rmeta::decoder::cstore_impl::provide (cognitive 31) compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:436 — rustc_metadata::rmeta::decoder::cstore_impl::provide has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 4 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_metadata::fs::encode_and_write_metadata (cognitive 21) compiler/rustc_metadata/src/fs.rs:38 — rustc_metadata::fs::encode_and_write_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_metadata::native_libs::collect (cognitive 19) compiler/rustc_metadata/src/native_libs.rs:20 — rustc_metadata::native_libs::collect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · compiler_builtins · ×5
  • compiler_builtins::int::specialized_div_rem::delegate::u128_divide_sparc (cognitive 50) library/compiler-builtins/compiler-builtins/src/int/specialized_div_rem/delegate.rs:197 — compiler_builtins::int::specialized_div_rem::delegate::u128_divide_sparc has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 3 (8 pts), match/switch 1 (nesting depth added 32). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • compiler_builtins::float::div::div (cognitive 46) library/compiler-builtins/compiler-builtins/src/float/div.rs:87 — compiler_builtins::float::div::div has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiler_builtins::float::add::add (cognitive 41) library/compiler-builtins/compiler-builtins/src/float/add.rs:4 — compiler_builtins::float::add::add has cognitive complexity 41 (threshold 15). Drivers by points: if/else 26 (40 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiler_builtins::float::mul::mul (cognitive 35) library/compiler-builtins/compiler-builtins/src/float/mul.rs:3 — compiler_builtins::float::mul::mul has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compiler_builtins::float::trunc::trunc (cognitive 18) library/compiler-builtins/compiler-builtins/src/float/trunc.rs:3 — compiler_builtins::float::trunc::trunc has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_passes · ×5
  • rustc_passes::stability::check_unused_or_stable_features (cognitive 43) compiler/rustc_passes/src/stability.rs:1159 — rustc_passes::stability::check_unused_or_stable_features has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 7 (11 pts), boolean chains 5 (nesting depth added 18). Of this number, 29 points are the body's own statements and 14 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_passes::dead::lint_dead_codes (cognitive 41) compiler/rustc_passes/src/dead.rs:1479 — rustc_passes::dead::lint_dead_codes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_passes::stability::stability_implications (cognitive 36) compiler/rustc_passes/src/stability.rs:268 — rustc_passes::stability::stability_implications has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (15 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_passes::eii::check_externally_implementable_items (cognitive 18) compiler/rustc_passes/src/eii.rs:44 — rustc_passes::eii::check_externally_implementable_items has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_passes::stability::lookup_stability (cognitive 17) compiler/rustc_passes/src/stability.rs:145 — rustc_passes::stability::lookup_stability has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FnAbi · ×5
  • FnAbi::apply_attrs_llfn (cognitive 32) compiler/rustc_codegen_llvm/src/abi.rs:459 — FnAbi::apply_attrs_llfn has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (4 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnAbi::adjust_for_rust_abi (cognitive 27) compiler/rustc_target/src/callconv/mod.rs:784 — FnAbi::adjust_for_rust_abi has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, match/switch 3 (4 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnAbi::adjust_for_foreign_abi (cognitive 23) compiler/rustc_target/src/callconv/mod.rs:697 — FnAbi::adjust_for_foreign_abi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnAbi::gcc_type (cognitive 17) compiler/rustc_codegen_gcc/src/abi.rs:131 — FnAbi::gcc_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • FnAbi::llvm_type (cognitive 17) compiler/rustc_codegen_llvm/src/abi.rs:364 — FnAbi::llvm_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Coerce · ×5
  • Coerce::coerce_from_fn_item (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:742 — Coerce::coerce_from_fn_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Coerce::coerce_borrowed_pointer (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:350 — Coerce::coerce_borrowed_pointer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Coerce::coerce_unsized_old_solver (cognitive 17) compiler/rustc_hir_typeck/src/coercion.rs:711 — Coerce::coerce_unsized_old_solver has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Coerce::coerce (cognitive 16) compiler/rustc_hir_typeck/src/coercion.rs:242 — Coerce::coerce has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Coerce::coerce_to_ref (cognitive 16) compiler/rustc_hir_typeck/src/coercion.rs:411 — Coerce::coerce_to_ref has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DeclValidator · ×5
  • DeclValidator::validate_struct_fields (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:322 — DeclValidator::validate_struct_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_enum_variant_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DeclValidator::validate_enum_variants (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:503 — DeclValidator::validate_enum_variants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DeclValidator::validate_enum_variant_fields (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:573 — DeclValidator::validate_enum_variant_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeclValidator::validate_struct_fields) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DeclValidator::validate_union_fields (cognitive 17) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:415 — DeclValidator::validate_union_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DeclValidator::validate_func_body (cognitive 16) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/decl_check.rs:233 — DeclValidator::validate_func_body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×5
  • Duplicated block (25 lines × 2) compiler/rustc_borrowck/src/type_check/free_region_relations.rs:317 — compiler/rustc_borrowck/src/type_check/free_region_relations.rs:317-341 | compiler/rustc_borrowck/src/type_check/free_region_relations.rs:424-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) compiler/rustc_symbol_mangling/src/legacy.rs:455 — compiler/rustc_symbol_mangling/src/legacy.rs:455-479 | compiler/rustc_symbol_mangling/src/v0.rs:405-429 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (25 lines × 2) compiler/rustc_trait_selection/src/diagnostics.rs:1993 — compiler/rustc_trait_selection/src/diagnostics.rs:1993-2017 | compiler/rustc_trait_selection/src/error_reporting/infer/region.rs:1554-1578 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (25 lines × 2) library/alloc/src/rcs/arc.rs:2412 — library/alloc/src/rcs/arc.rs:2412-2436 | library/alloc/src/rcs/rc.rs:2501-2525 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (25 lines × 2) compiler/rustc_codegen_cranelift/example/std_example.rs:75 — compiler/rustc_codegen_cranelift/example/std_example.rs:75-99 | compiler/rustc_codegen_gcc/example/std_example.rs:67-91 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1070 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1070-1091 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1182-1203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1161 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1161-1182 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2850-2871 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:214 — compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:214-235 | compiler/rustc_codegen_ssa/src/back/symbol_edit.rs:397-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:343 — compiler/rustc_target/src/callconv/loongarch.rs:343-364 | compiler/rustc_target/src/callconv/riscv.rs:349-370 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:424 — compiler/rustc_target/src/callconv/loongarch.rs:424-445 | compiler/rustc_target/src/callconv/riscv.rs:429-450 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) compiler/rustc_codegen_gcc/src/debuginfo.rs:145 — compiler/rustc_codegen_gcc/src/debuginfo.rs:145-165 | compiler/rustc_codegen_llvm/src/debuginfo/mod.rs:688-708 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (21 lines × 2) compiler/rustc_codegen_gcc/src/int.rs:536 — compiler/rustc_codegen_gcc/src/int.rs:536-556 | compiler/rustc_codegen_gcc/src/int.rs:566-586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) library/compiler-builtins/libm/src/math/atan.rs:96 — library/compiler-builtins/libm/src/math/atan.rs:96-116 | library/compiler-builtins/libm/src/math/atanf.rs:75-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (21 lines × 2) library/alloc/src/rcs/arc.rs:4943 — library/alloc/src/rcs/arc.rs:4943-4963 | library/alloc/src/rcs/rc.rs:4522-4542 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21 lines × 2) src/etc/debugger_tester/gdb/check_gdb.py:318 — src/etc/debugger_tester/gdb/check_gdb.py:318-338 | src/etc/debugger_tester/lldb/check_lldb.py:461-481 — `src/etc/debugger_tester/gdb/check_gdb.py` and `src/etc/debugger_tester/lldb/check_lldb.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) compiler/rustc_codegen_llvm/src/asm.rs:1281 — compiler/rustc_codegen_llvm/src/asm.rs:1281-1298 | compiler/rustc_codegen_llvm/src/asm.rs:1474-1491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2724 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2724-2741 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2805-2822 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) library/compiler-builtins/libm/src/math/acos.rs:81 — library/compiler-builtins/libm/src/math/acos.rs:81-98 | library/compiler-builtins/libm/src/math/acosf.rs:49-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) library/std/src/os/xous/ffi.rs:38 — library/std/src/os/xous/ffi.rs:38-55 | library/std/src/os/xous/ffi.rs:102-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) library/std/src/os/xous/ffi.rs:520 — library/std/src/os/xous/ffi.rs:520-537 | library/std/src/os/xous/ffi.rs:596-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) compiler/rustc_borrowck/src/lib.rs:973 — compiler/rustc_borrowck/src/lib.rs:973-983 | compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:191-200 — before extracting anything, compare `compiler/rustc_borrowck/src/lib.rs` and `compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10–11 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:656 — compiler/rustc_const_eval/src/const_eval/machine.rs:656-665 | compiler/rustc_const_eval/src/const_eval/machine.rs:755-765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) compiler/rustc_hir_typeck/src/closure.rs:486 — compiler/rustc_hir_typeck/src/closure.rs:486-495 | compiler/rustc_hir_typeck/src/closure.rs:535-545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) compiler/rustc_mir_build/src/builder/mod.rs:668 — compiler/rustc_mir_build/src/builder/mod.rs:668-677 | compiler/rustc_mir_build/src/builder/mod.rs:703-713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:198 — compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:198-208 | compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs:232-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×5
  • Duplicated block (10 lines × 4) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:505 — compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:505-514 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:530-539 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:555-564 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:578-587 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) library/compiler-builtins/libm/src/math/j0.rs:286 — library/compiler-builtins/libm/src/math/j0.rs:286-295 | library/compiler-builtins/libm/src/math/j0.rs:398-407 | library/compiler-builtins/libm/src/math/j1.rs:278-287 | library/compiler-builtins/libm/src/math/j1.rs:390-399 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j1.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) library/compiler-builtins/libm/src/math/j0f.rs:223 — library/compiler-builtins/libm/src/math/j0f.rs:223-232 | library/compiler-builtins/libm/src/math/j0f.rs:335-344 | library/compiler-builtins/libm/src/math/j1f.rs:222-231 | library/compiler-builtins/libm/src/math/j1f.rs:334-343 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0f.rs` and `library/compiler-builtins/libm/src/math/j1f.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) library/alloc/src/rcs/arc.rs:531 — library/alloc/src/rcs/arc.rs:531-540 | library/alloc/src/rcs/arc.rs:564-573 | library/alloc/src/rcs/rc.rs:525-534 | library/alloc/src/rcs/rc.rs:557-566 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) library/alloc/src/rcs/arc.rs:639 — library/alloc/src/rcs/arc.rs:639-648 | library/alloc/src/rcs/arc.rs:672-681 | library/alloc/src/rcs/rc.rs:614-623 | library/alloc/src/rcs/rc.rs:647-656 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×5
  • Duplicated block (9 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:447 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:447-455 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:955-963 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1356-1364 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:762 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:762-770 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:815-823 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1073-1082 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:186 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:186-194 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:402-410 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:455-463 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:267 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:267-275 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:514-522 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2504-2512 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) library/std/src/os/xous/ffi.rs:259 — library/std/src/os/xous/ffi.rs:259-267 | library/std/src/os/xous/ffi.rs:474-482 | library/std/src/os/xous/ffi.rs:518-526 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×5
  • Duplicated block (5 lines × 4) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1351 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1351-1355 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1360-1364 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1369-1373 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1378-1382 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1387 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1387-1391 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1396-1400 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1405-1409 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1414-1418 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) compiler/rustc_codegen_llvm/src/consts.rs:758 — compiler/rustc_codegen_llvm/src/consts.rs:758-762 | compiler/rustc_codegen_llvm/src/consts.rs:778-782 | compiler/rustc_codegen_llvm/src/consts.rs:841-845 | compiler/rustc_codegen_llvm/src/consts.rs:897-901 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) library/alloc/src/rcs/arc.rs:312 — library/alloc/src/rcs/arc.rs:312-316 | library/alloc/src/rcs/arc.rs:5037-5041 | library/alloc/src/rcs/rc.rs:386-390 | library/alloc/src/rcs/rc.rs:4615-4619 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) compiler/rustc_codegen_cranelift/example/std_example.rs:316 — compiler/rustc_codegen_cranelift/example/std_example.rs:316-320 | compiler/rustc_codegen_cranelift/example/std_example.rs:324-328 | compiler/rustc_codegen_gcc/example/std_example.rs:146-150 | compiler/rustc_codegen_gcc/example/std_example.rs:154-158 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
R10 · Code Duplication · Duplicated block (12 lines × 2 locations) · ×5
  • Duplicated block (12 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:906 — src/librustdoc/html/static/js/stringdex.js:906 · src/librustdoc/html/static/js/stringdex.js:988 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3502 — src/librustdoc/html/static/js/stringdex.js:3502 · src/librustdoc/html/static/js/stringdex.js:3555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3516 — src/librustdoc/html/static/js/stringdex.js:3516 · src/librustdoc/html/static/js/stringdex.js:3597 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:1032 — src/tools/rust-analyzer/editors/code/src/commands.ts:1032 · src/tools/rust-analyzer/editors/code/src/commands.ts:1067 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:1058 — src/tools/rust-analyzer/editors/code/src/commands.ts:1058 · src/tools/rust-analyzer/editors/code/src/commands.ts:1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (11 lines × 2 locations) · ×5
  • Duplicated block (11 lines × 2 locations) REDACTED:5526 — REDACTED:5526 · src/librustdoc/html/static/js/stringdex.js:3701 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (11 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:457 — src/librustdoc/html/static/js/stringdex.js:457 · src/librustdoc/html/static/js/stringdex.js:566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:2285 — src/librustdoc/html/static/js/stringdex.js:2285 · src/librustdoc/html/static/js/stringdex.js:2551 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (11 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:102 — src/tools/rust-analyzer/editors/code/src/commands.ts:102 · src/tools/rust-analyzer/editors/code/src/commands.ts:279 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (11 lines × 2 locations) src/tools/rustdoc-js/tester.js:199 — src/tools/rustdoc-js/tester.js:199 · src/tools/rustdoc-js/tester.js:246 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
S1 · Web-Security Posture · Weak hash algorithm · ×5
  • Weak hash algorithm compiler/rustc_span/src/lib.rs:1832 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm compiler/rustc_span/src/lib.rs:1835 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm compiler/rustc_span/src/lib.rs:1887 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm compiler/rustc_span/src/lib.rs:1899 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm src/tools/coverage-dump/src/llvm_utils.rs:44 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
AC3 · Page structure · Page without a main landmark · ×4
  • Page without a main landmark compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark REDACTED:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark REDACTED:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark src/tools/rust-analyzer/editors/code/src/commands.ts:1362 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D1 · Cyclomatic Complexity · Ty · ×4
  • Ty::hir_fmt (cyclomatic 117) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:1281 — Ty::hir_fmt has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Ty::rewrite_result (cyclomatic 44) src/tools/rustfmt/src/types.rs:808 — Ty::rewrite_result has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Ty::ty_and_layout_field::field_ty_or_layout (cyclomatic 25) compiler/rustc_middle/src/ty/layout.rs:853 — Ty::ty_and_layout_field::field_ty_or_layout has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Ty::ty_and_layout_pointee_info_at (cyclomatic 23) compiler/rustc_middle/src/ty/layout.rs:1049 — Ty::ty_and_layout_pointee_info_at has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HirEqInterExpr · ×4
  • HirEqInterExpr::eq_expr (cyclomatic 69) src/tools/clippy/clippy_utils/src/hir_utils.rs:504 — HirEqInterExpr::eq_expr has cyclomatic complexity 69 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • HirEqInterExpr::eq_block (cyclomatic 23) src/tools/clippy/clippy_utils/src/hir_utils.rs:394 — HirEqInterExpr::eq_block has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • HirEqInterExpr::eq_pat (cyclomatic 18) src/tools/clippy/clippy_utils/src/hir_utils.rs:796 — HirEqInterExpr::eq_pat has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: clippy_utils::hir_utils::has_ambiguous_literal_in_expr (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • HirEqInterExpr::check_ctxt (cyclomatic 17) src/tools/clippy/clippy_utils/src/hir_utils.rs:930 — HirEqInterExpr::check_ctxt has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: clippy_utils::hir_utils::has_ambiguous_literal_in_expr (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rustc_sanitizers · ×4
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty (cyclomatic 51) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:422 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::transform::transform_instance (cyclomatic 20) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs:507 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::transform::transform_instance has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_const_value (cyclomatic 17) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:152 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_const_value has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty_name (cyclomatic 17) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:759 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty_name has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AnalysisStats · ×4
  • AnalysisStats::run_inference (cyclomatic 49) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:774 — AnalysisStats::run_inference has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalysisStats::run (cyclomatic 48) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:52 — AnalysisStats::run has cyclomatic complexity 48 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • AnalysisStats::run_body_lowering (cyclomatic 31) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:1162 — AnalysisStats::run_body_lowering has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalysisStats::run_term_search (cyclomatic 28) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:494 — AnalysisStats::run_term_search has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compiletest · ×4
  • compiletest::directives::make_test_description (cyclomatic 35) src/tools/compiletest/src/directives.rs:895 — compiletest::directives::make_test_description has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • compiletest::directives::ignore_llvm (cyclomatic 19) src/tools/compiletest/src/directives.rs:1253 — compiletest::directives::ignore_llvm has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • compiletest::directives::needs::handle_needs (cyclomatic 17) src/tools/compiletest/src/directives/needs.rs:8 — compiletest::directives::needs::handle_needs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • compiletest::json::push_actual_errors (cyclomatic 17) src/tools/compiletest/src/json.rs:159 — compiletest::json::push_actual_errors has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Checker · ×4
  • Checker::visit_terminator (cyclomatic 34) compiler/rustc_const_eval/src/check_consts/check.rs:723 — Checker::visit_terminator has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Checker::visit_rvalue (cyclomatic 27) compiler/rustc_const_eval/src/check_consts/check.rs:528 — Checker::visit_rvalue has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Checker::visit_item (cyclomatic 25) compiler/rustc_passes/src/stability.rs:717 — Checker::visit_item has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Checker::check_url (cyclomatic 23) src/tools/linkchecker/main.rs:312 — Checker::check_url has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ValidityVisitor · ×4
  • ValidityVisitor::visit_value (cyclomatic 33) compiler/rustc_const_eval/src/interpret/validity.rs:1347 — ValidityVisitor::visit_value has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ValidityVisitor::check_safe_pointer (cyclomatic 31) compiler/rustc_const_eval/src/interpret/validity.rs:560 — ValidityVisitor::check_safe_pointer has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ValidityVisitor::try_visit_primitive (cyclomatic 22) compiler/rustc_const_eval/src/interpret/validity.rs:851 — ValidityVisitor::try_visit_primitive has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ValidityVisitor::aggregate_field_path_elem (cyclomatic 17) compiler/rustc_const_eval/src/interpret/validity.rs:371 — ValidityVisitor::aggregate_field_path_elem has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_const_eval · ×4
  • rustc_const_eval::check_consts::ops::build_error_for_const_call (cyclomatic 31) compiler/rustc_const_eval/src/check_consts/ops.rs:218 — rustc_const_eval::check_consts::ops::build_error_for_const_call has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_const_eval::const_eval::valtrees::const_to_valtree_inner (cyclomatic 20) compiler/rustc_const_eval/src/const_eval/valtrees.rs:83 — rustc_const_eval::const_eval::valtrees::const_to_valtree_inner has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_const_eval::util::check_validity_requirement::check_validity_requirement_lax (cyclomatic 20) compiler/rustc_const_eval/src/util/check_validity_requirement.rs:91 — rustc_const_eval::util::check_validity_requirement::check_validity_requirement_lax has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_const_eval::interpret::intern::intern_const_alloc_recursive (cyclomatic 17) compiler/rustc_const_eval/src/interpret/intern.rs:204 — rustc_const_eval::interpret::intern::intern_const_alloc_recursive has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_session · ×4
  • rustc_session::config::cfg::default_configuration (cyclomatic 31) compiler/rustc_session/src/config/cfg.rs:165 — rustc_session::config::cfg::default_configuration has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_session::diagnostics::create_lit_error (cyclomatic 20) compiler/rustc_session/src/diagnostics.rs:594 — rustc_session::diagnostics::create_lit_error has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_session::options::parse::parse_autodiff (cyclomatic 19) compiler/rustc_session/src/options.rs:1569 — rustc_session::options::parse::parse_autodiff has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_session::options::parse::parse_instrument_xray (cyclomatic 16) compiler/rustc_session/src/options.rs:1711 — rustc_session::options::parse::parse_instrument_xray has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: rustc_session::options::parse::parse_sanitizers (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · loadDatabase · ×4
  • loadDatabase::prefixMatches (cyclomatic 31) src/librustdoc/html/static/js/stringdex.js:2031 — loadDatabase::prefixMatches has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • loadDatabase::substringMatches (cyclomatic 21) src/librustdoc/html/static/js/stringdex.js:1947 — loadDatabase::substringMatches has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • loadDatabase::substringMatches (cyclomatic 19) src/librustdoc/html/static/js/stringdex.js:2447 — loadDatabase::substringMatches has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • loadDatabase::decode (cyclomatic 17) src/librustdoc/html/static/js/stringdex.js:2597 — loadDatabase::decode has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rustc_monomorphize · ×4
  • rustc_monomorphize::collector::collect_items_rec (cyclomatic 29) compiler/rustc_monomorphize/src/collector.rs:382 — rustc_monomorphize::collector::collect_items_rec has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_monomorphize::collector::collect_roots (cyclomatic 23) compiler/rustc_monomorphize/src/collector.rs:1485 — rustc_monomorphize::collector::collect_roots has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_monomorphize::partitioning::collect_and_partition_mono_items (cyclomatic 20) compiler/rustc_monomorphize/src/partitioning.rs:1169 — rustc_monomorphize::partitioning::collect_and_partition_mono_items has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_monomorphize::partitioning::mono_item_visibility (cyclomatic 19) compiler/rustc_monomorphize/src/partitioning.rs:803 — rustc_monomorphize::partitioning::mono_item_visibility has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Context · ×4
  • Context::manage_cond_expr (cyclomatic 27) compiler/rustc_builtin_macros/src/assert/context.rs:187 — Context::manage_cond_expr has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Context::add_constraints_from_ty (cyclomatic 21) src/tools/rust-analyzer/crates/hir-ty/src/variance.rs:176 — Context::add_constraints_from_ty has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Context::try_overflow_last_item (cyclomatic 21) src/tools/rustfmt/src/overflow.rs:483 — Context::try_overflow_last_item has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Context::render_item (cyclomatic 19) src/librustdoc/html/render/context.rs:215 — Context::render_item has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compiler_builtins · ×4
  • compiler_builtins::float::div::div (cyclomatic 27) library/compiler-builtins/compiler-builtins/src/float/div.rs:87 — compiler_builtins::float::div::div has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • compiler_builtins::float::add::add (cyclomatic 24) library/compiler-builtins/compiler-builtins/src/float/add.rs:4 — compiler_builtins::float::add::add has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • compiler_builtins::int::specialized_div_rem::delegate::u128_divide_sparc (cyclomatic 20) library/compiler-builtins/compiler-builtins/src/int/specialized_div_rem/delegate.rs:197 — compiler_builtins::int::specialized_div_rem::delegate::u128_divide_sparc has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • compiler_builtins::float::mul::mul (cyclomatic 19) library/compiler-builtins/compiler-builtins/src/float/mul.rs:3 — compiler_builtins::float::mul::mul has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hir · ×4
  • hir::source_analyzer::resolve_hir_path_ (cyclomatic 25) src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:1873 — hir::source_analyzer::resolve_hir_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir::attrs::resolve_doc_path_on_ (cyclomatic 23) src/tools/rust-analyzer/crates/hir/src/attrs.rs:316 — hir::attrs::resolve_doc_path_on_ has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir::display::write_function (cyclomatic 23) src/tools/rust-analyzer/crates/hir/src/display.rs:159 — hir::display::write_function has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • hir::attrs::resolve_assoc_or_field (cyclomatic 21) src/tools/rust-analyzer/crates/hir/src/attrs.rs:372 — hir::attrs::resolve_assoc_or_field has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · Config · ×4
  • Config::parse_inner (cognitive 153) src/bootstrap/src/core/config/config.rs:383 — Config::parse_inner has cognitive complexity 153 (threshold 15). Drivers by points: if/else 70 (104 pts), boolean chains 24, match/switch 14 (22 pts), loops 2 (3 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::apply_change_with_sink (cognitive 45) src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:1206 — Config::apply_change_with_sink has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 5 (17 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::maybe_download_ci_llvm (cognitive 21) src/bootstrap/src/core/download.rs:273 — Config::maybe_download_ci_llvm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (6 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::download_rustc_commit (cognitive 16) src/bootstrap/src/core/config/config.rs:1751 — Config::download_rustc_commit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ty · ×4
  • Ty::hir_fmt (cognitive 149) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:1281 — Ty::hir_fmt has cognitive complexity 149 (threshold 15). Drivers by points: if/else 46 (102 pts), match/switch 21 (42 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Ty::rewrite_result (cognitive 61) src/tools/rustfmt/src/types.rs:808 — Ty::rewrite_result has cognitive complexity 61 (threshold 15). Drivers by points: if/else 29 (54 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Ty::ty_and_layout_pointee_info_at (cognitive 44) compiler/rustc_middle/src/ty/layout.rs:1049 — Ty::ty_and_layout_pointee_info_at has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 7, match/switch 3 (5 pts), loops 1 (3 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Ty::ty_and_layout_field::field_ty_or_layout (cognitive 27) compiler/rustc_middle/src/ty/layout.rs:853 — Ty::ty_and_layout_field::field_ty_or_layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 4 (8 pts), boolean chains 2 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AnalysisStats · ×4
  • AnalysisStats::run_inference (cognitive 134) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:774 — AnalysisStats::run_inference has cognitive complexity 134 (threshold 15). Drivers by points: if/else 43 (115 pts), match/switch 4 (8 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalysisStats::run (cognitive 81) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:52 — AnalysisStats::run has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (35 pts), match/switch 6 (22 pts), loops 8 (21 pts), boolean chains 3 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalysisStats::run_term_search (cognitive 67) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:494 — AnalysisStats::run_term_search has cognitive complexity 67 (threshold 15). Drivers by points: if/else 10 (31 pts), match/switch 9 (26 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalysisStats::run_body_lowering (cognitive 50) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs:1162 — AnalysisStats::run_body_lowering has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (37 pts), match/switch 4 (10 pts), loops 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CastCheck · ×4
  • CastCheck::report_cast_error (cognitive 87) compiler/rustc_hir_typeck/src/cast.rs:286 — CastCheck::report_cast_error has cognitive complexity 87 (threshold 15). Drivers by points: if/else 33 (69 pts), match/switch 5 (10 pts), boolean chains 8 (nesting depth added 41). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CastCheck::do_check (cognitive 23) compiler/rustc_hir_typeck/src/cast.rs:929 — CastCheck::do_check has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 5 (11 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CastCheck::check (cognitive 19) compiler/rustc_hir_typeck/src/cast.rs:816 — CastCheck::check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CastCheck::do_check (cognitive 18) src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs:162 — CastCheck::do_check has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 1 (4 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ValidityVisitor · ×4
  • ValidityVisitor::check_safe_pointer (cognitive 80) compiler/rustc_const_eval/src/interpret/validity.rs:560 — ValidityVisitor::check_safe_pointer has cognitive complexity 80 (threshold 15). Drivers by points: if/else 24 (59 pts), match/switch 4 (17 pts), boolean chains 4 (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ValidityVisitor::visit_value (cognitive 50) compiler/rustc_const_eval/src/interpret/validity.rs:1347 — ValidityVisitor::visit_value has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 7 (14 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ValidityVisitor::try_visit_primitive (cognitive 26) compiler/rustc_const_eval/src/interpret/validity.rs:851 — ValidityVisitor::try_visit_primitive has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ValidityVisitor::aggregate_field_path_elem (cognitive 19) compiler/rustc_const_eval/src/interpret/validity.rs:371 — ValidityVisitor::aggregate_field_path_elem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · cargo_miri · ×4
  • cargo_miri::phases::phase_rustc (cognitive 75) src/tools/miri/cargo-miri/src/phases.rs:276 — cargo_miri::phases::phase_rustc has cognitive complexity 75 (threshold 15). Drivers by points: if/else 26 (54 pts), loops 6 (13 pts), boolean chains 8 (nesting depth added 35). Of this number, 63 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • cargo_miri::phases::phase_cargo_miri (cognitive 31) src/tools/miri/cargo-miri/src/phases.rs:59 — cargo_miri::phases::phase_cargo_miri has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 6, match/switch 3 (4 pts), loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • cargo_miri::setup::setup (cognitive 31) src/tools/miri/cargo-miri/src/setup.rs:16 — cargo_miri::setup::setup has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5, match/switch 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • cargo_miri::phases::phase_runner (cognitive 19) src/tools/miri/cargo-miri/src/phases.rs:545 — cargo_miri::phases::phase_runner has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project_model · ×4
  • project_model::workspace::cargo_to_crate_graph (cognitive 72) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1262 — project_model::workspace::cargo_to_crate_graph has cognitive complexity 72 (threshold 15). Drivers by points: if/else 22 (55 pts), loops 7 (12 pts), boolean chains 5 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • project_model::workspace::handle_rustc_crates (cognitive 60) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1534 — project_model::workspace::handle_rustc_crates has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (37 pts), loops 9 (23 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • project_model::env::cargo_config_env (cognitive 34) src/tools/rust-analyzer/crates/project-model/src/env.rs:63 — project_model::env::cargo_config_env has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • project_model::workspace::project_json_to_crate_graph (cognitive 27) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1105 — project_model::workspace::project_json_to_crate_graph has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssignmentResult · ×4
  • AssignmentResult::report_fully_unused (cognitive 57) compiler/rustc_mir_transform/src/liveness.rs:961 — AssignmentResult::report_fully_unused has cognitive complexity 57 (threshold 15). Drivers by points: if/else 26 (52 pts), boolean chains 4, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentResult::report_unused_assignments (cognitive 38) compiler/rustc_mir_transform/src/liveness.rs:1182 — AssignmentResult::report_unused_assignments has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentResult::find_dead_assignments (cognitive 30) compiler/rustc_mir_transform/src/liveness.rs:640 — AssignmentResult::find_dead_assignments has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3 (8 pts), loops 4 (7 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentResult::merge_guards (cognitive 16) compiler/rustc_mir_transform/src/liveness.rs:814 — AssignmentResult::merge_guards has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VnState · ×4
  • VnState::eval_to_const_inner (cognitive 46) compiler/rustc_mir_transform/src/gvn.rs:571 — VnState::eval_to_const_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 4 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • VnState::simplify_cast (cognitive 35) compiler/rustc_mir_transform/src/gvn.rs:1564 — VnState::simplify_cast has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • VnState::project (cognitive 23) compiler/rustc_mir_transform/src/gvn.rs:822 — VnState::project has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • VnState::simplify_aggregate (cognitive 20) compiler/rustc_mir_transform/src/gvn.rs:1201 — VnState::simplify_aggregate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Context · ×4
  • Context::render_item (cognitive 40) src/librustdoc/html/render/context.rs:215 — Context::render_item has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 2 (7 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Context::try_overflow_last_item (cognitive 35) src/tools/rustfmt/src/overflow.rs:483 — Context::try_overflow_last_item has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 7, match/switch 2 (3 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Context::manage_cond_expr (cognitive 17) compiler/rustc_builtin_macros/src/assert/context.rs:187 — Context::manage_cond_expr has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (6 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Context::init (cognitive 17) src/librustdoc/html/render/context.rs:498 — Context::init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ide_diagnostics · ×4
  • ide_diagnostics::handlers::unlinked_file::fixes (cognitive 37) src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unlinked_file.rs:77 — ide_diagnostics::handlers::unlinked_file::fixes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 4 (11 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_diagnostics::handlers::missing_fields::fixes (cognitive 29) src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/missing_fields.rs:56 — ide_diagnostics::handlers::missing_fields::fixes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_diagnostics::semantic_diagnostics (cognitive 26) src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs:375 — ide_diagnostics::semantic_diagnostics has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 3 (4 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some (cognitive 22) src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs:176 — ide_diagnostics::handlers::type_mismatch::add_missing_ok_or_some has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceBuildScripts · ×4
  • WorkspaceBuildScripts::build_command (cognitive 35) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:435 — WorkspaceBuildScripts::build_command has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 3 (7 pts) (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • WorkspaceBuildScripts::rustc_crates (cognitive 25) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:183 — WorkspaceBuildScripts::rustc_crates has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (9 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WorkspaceBuildScripts::run_command (cognitive 23) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:328 — WorkspaceBuildScripts::run_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WorkspaceBuildScripts::run_once (cognitive 17) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:100 — WorkspaceBuildScripts::run_once has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalContextPrivExt · ×4
  • EvalContextPrivExt::tb_reborrow (cognitive 34) src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs:238 — EvalContextPrivExt::tb_reborrow has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (25 pts), match/switch 1 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextPrivExt::sb_reborrow (cognitive 26) src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:594 — EvalContextPrivExt::sb_reborrow has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextPrivExt::schedule (cognitive 25) src/tools/miri/src/concurrency/scheduler.rs:52 — EvalContextPrivExt::schedule has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextPrivExt::virtual_socket_read (cognitive 18) src/tools/miri/src/shims/unix/virtual_socket.rs:442 — EvalContextPrivExt::virtual_socket_read has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinkCollector · ×4
  • LinkCollector::resolve_with_disambiguator (cognitive 32) src/librustdoc/passes/collect_intra_doc_links.rs:1610 — LinkCollector::resolve_with_disambiguator has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (5 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LinkCollector::resolve_links (cognitive 29) src/librustdoc/passes/collect_intra_doc_links.rs:1075 — LinkCollector::resolve_links has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, loops 3, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LinkCollector::resolve_ambiguities (cognitive 23) src/librustdoc/passes/collect_intra_doc_links.rs:1304 — LinkCollector::resolve_ambiguities has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LinkCollector::resolve_with_disambiguator_cached (cognitive 16) src/librustdoc/passes/collect_intra_doc_links.rs:1547 — LinkCollector::resolve_with_disambiguator_cached has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rustc_query_impl · ×4
  • rustc_query_impl::handle_cycle_error::layout_of (cognitive 31) compiler/rustc_query_impl/src/handle_cycle_error.rs:128 — rustc_query_impl::handle_cycle_error::layout_of has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_query_impl::handle_cycle_error::find_item_ty_spans (cognitive 21) compiler/rustc_query_impl/src/handle_cycle_error.rs:298 — rustc_query_impl::handle_cycle_error::find_item_ty_spans has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_query_impl::handle_cycle_error::create_cycle_error (cognitive 17) compiler/rustc_query_impl/src/handle_cycle_error.rs:346 — rustc_query_impl::handle_cycle_error::create_cycle_error has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_query_impl::handle_cycle_error::recursive_type_error (cognitive 16) compiler/rustc_query_impl/src/handle_cycle_error.rs:215 — rustc_query_impl::handle_cycle_error::recursive_type_error has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_next_trait_solver · ×4
  • rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_callable (cognitive 30) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:277 — rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_callable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_async_callable (cognitive 23) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:435 — rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_async_callable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_next_trait_solver::canonical::compute_query_response_instantiation_values_in_universe (cognitive 19) compiler/rustc_next_trait_solver/src/canonical/mod.rs:190 — rustc_next_trait_solver::canonical::compute_query_response_instantiation_values_in_universe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_next_trait_solver::solve::eval_ctxt::fast_path::inlined_rerunning_stalled_goal_may_make_progress (cognitive 17) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/fast_path.rs:43 — rustc_next_trait_solver::solve::eval_ctxt::fast_path::inlined_rerunning_stalled_goal_may_make_progress has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UseTree · ×4
  • UseTree::normalize (cognitive 30) src/tools/rustfmt/src/imports.rs:554 — UseTree::normalize has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UseTree::from_ast (cognitive 23) src/tools/rustfmt/src/imports.rs:423 — UseTree::from_ast has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UseTree::expand_impl (cognitive 18) src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs:736 — UseTree::expand_impl has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • UseTree::flatten (cognitive 18) src/tools/rustfmt/src/imports.rs:699 — UseTree::flatten has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 2 (5 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_ast · ×4
  • rustc_ast::util::comments::beautify_doc_string::get_horizontal_trim (cognitive 27) compiler/rustc_ast/src/util/comments.rs:54 — rustc_ast::util::comments::beautify_doc_string::get_horizontal_trim has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rustc_ast::util::comments::beautify_doc_string) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_ast::util::comments::beautify_doc_string (cognitive 22) compiler/rustc_ast/src/util/comments.rs:37 — rustc_ast::util::comments::beautify_doc_string has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 5 (10 pts), boolean chains 7, match/switch 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (rustc_ast::util::comments::beautify_doc_string::get_horizontal_trim) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • rustc_ast::tokenstream::make_attr_token_stream (cognitive 16) compiler/rustc_ast/src/tokenstream.rs:354 — rustc_ast::tokenstream::make_attr_token_stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ast::util::classify::type_trailing_braced_mac_call (cognitive 16) compiler/rustc_ast/src/util/classify.rs:258 — rustc_ast::util::classify::type_trailing_braced_mac_call has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (15 pts), loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Channel · ×4
  • Channel::start_recv (cognitive 27) library/std/src/sync/mpmc/list.rs:284 — Channel::start_recv has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (24 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Channel::start_recv (cognitive 20) library/std/src/sync/mpmc/array.rs:215 — Channel::start_recv has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Channel::start_send (cognitive 19) library/std/src/sync/mpmc/list.rs:175 — Channel::start_send has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Channel::start_send (cognitive 17) library/std/src/sync/mpmc/array.rs:124 — Channel::start_send has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Generalizer · ×4
  • Generalizer::tys (cognitive 27) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434 — Generalizer::tys has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Generalizer::tys (cognitive 26) compiler/rustc_infer/src/infer/relate/generalize.rs:493 — Generalizer::tys has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Generalizer::consts (cognitive 21) compiler/rustc_infer/src/infer/relate/generalize.rs:655 — Generalizer::consts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Generalizer::consts (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/relate/generalize.rs:592 — Generalizer::consts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · syntax · ×4
  • syntax::validation::validate_literal (cognitive 26) src/tools/rust-analyzer/crates/syntax/src/validation.rs:124 — syntax::validation::validate_literal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • syntax::validation::validate_path_keywords (cognitive 18) src/tools/rust-analyzer/crates/syntax/src/validation.rs:285 — syntax::validation::validate_path_keywords has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (use_prefix). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • syntax::ast::prec::precedence (cognitive 16) src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs:73 — syntax::ast::prec::precedence has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (16 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • syntax::parsing::reparsing::reparse_token (cognitive 16) src/tools/rust-analyzer/crates/syntax/src/parsing/reparsing.rs:46 — syntax::parsing::reparsing::reparse_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InferCtxt · ×4
  • InferCtxt::shallow_resolve (cognitive 24) compiler/rustc_infer/src/infer/mod.rs:1270 — InferCtxt::shallow_resolve has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 3 (8 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferCtxt::query_response_instantiation_guess (cognitive 20) compiler/rustc_infer/src/infer/canonical/query_response.rs:411 — InferCtxt::query_response_instantiation_guess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferCtxt::query_response_instantiation_guess (cognitive 20) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/canonical/instantiate.rs:322 — InferCtxt::query_response_instantiation_guess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferCtxt::instantiate_var (cognitive 16) compiler/rustc_infer/src/infer/relate/generalize.rs:124 — InferCtxt::instantiate_var has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · xtask · ×4
  • xtask::codegen::lints::generate_descriptor_clippy (cognitive 20) src/tools/rust-analyzer/xtask/src/codegen/lints.rs:449 — xtask::codegen::lints::generate_descriptor_clippy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3, match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::codegen::lints::generate_lint_descriptor (cognitive 19) src/tools/rust-analyzer/xtask/src/codegen/lints.rs:167 — xtask::codegen::lints::generate_lint_descriptor has cognitive complexity 19 (threshold 15). Drivers by points: loops 9, if/else 3 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function item inside it that branches (insert_lints). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • xtask::publish::notes::process_inline_macros (cognitive 18) src/tools/rust-analyzer/xtask/src/publish/notes.rs:437 — xtask::publish::notes::process_inline_macros has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (15 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • xtask::tidy::check_cargo_toml (cognitive 16) src/tools/rust-analyzer/xtask/src/tidy.rs:83 — xtask::tidy::check_cargo_toml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×4
  • Duplicated block (28 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1043 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1043-1070 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2579-2606 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (28 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:1507 — compiler/rustc_codegen_llvm/src/intrinsic.rs:1507-1534 | compiler/rustc_codegen_llvm/src/intrinsic.rs:1608-1635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (28 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:215 — compiler/rustc_target/src/callconv/loongarch.rs:215-242 | compiler/rustc_target/src/callconv/riscv.rs:220-247 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (28 lines × 2) library/compiler-builtins/ci/ci-util.py:353 — library/compiler-builtins/ci/ci-util.py:353-380 | library/compiler-builtins/etc/update-api-list.py:243-270 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `library/compiler-builtins/ci/ci-util.py:353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×4
  • Duplicated block (17–18 lines × 2) compiler/rustc_index/src/bit_set.rs:772 — compiler/rustc_index/src/bit_set.rs:772-789 | compiler/rustc_index/src/bit_set.rs:851-867 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) compiler/rustc_next_trait_solver/src/normalize.rs:114 — compiler/rustc_next_trait_solver/src/normalize.rs:114-131 | compiler/rustc_next_trait_solver/src/normalize.rs:165-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) library/compiler-builtins/libm/src/math/expm1.rs:96 — library/compiler-builtins/libm/src/math/expm1.rs:96-113 | library/compiler-builtins/libm/src/math/expm1f.rs:100-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17–18 lines × 2) src/etc/lldb_providers.py:860 — src/etc/lldb_providers.py:860-877 | src/etc/lldb_providers.py:926-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×4
  • Duplicated block (9 lines × 4) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:72 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:72-80 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:122-130 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:149-157 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:180-188 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) compiler/rustc_trait_selection/src/traits/project.rs:1392 — compiler/rustc_trait_selection/src/traits/project.rs:1392-1401 | compiler/rustc_trait_selection/src/traits/project.rs:1448-1457 | compiler/rustc_trait_selection/src/traits/project.rs:1494-1502 | compiler/rustc_trait_selection/src/traits/project.rs:1539-1547 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) library/std/src/sync/nonpoison/rwlock.rs:679 — library/std/src/sync/nonpoison/rwlock.rs:679-687 | library/std/src/sync/nonpoison/rwlock.rs:904-912 | library/std/src/sync/poison/rwlock.rs:813-821 | library/std/src/sync/poison/rwlock.rs:1039-1047 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 4) library/std/src/sync/nonpoison/rwlock.rs:644 — library/std/src/sync/nonpoison/rwlock.rs:644-652 | library/std/src/sync/nonpoison/rwlock.rs:869-877 | library/std/src/sync/poison/rwlock.rs:778-786 | library/std/src/sync/poison/rwlock.rs:1004-1012 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:702 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:702-709 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:838-845 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:945-952 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1187-1194 — before extracting anything, compare `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs` and `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) compiler/rustc_macros/src/type_foldable.rs:15 — compiler/rustc_macros/src/type_foldable.rs:15-22 | compiler/rustc_macros/src/type_foldable.rs:31-38 | compiler/rustc_type_ir_macros/src/lib.rs:149-156 | compiler/rustc_type_ir_macros/src/lib.rs:171-178 — before extracting anything, compare `compiler/rustc_macros/src/type_foldable.rs` and `compiler/rustc_type_ir_macros/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) library/alloc/src/rcs/arc.rs:1928 — library/alloc/src/rcs/arc.rs:1928-1935 | library/alloc/src/rcs/arc.rs:5027-5034 | library/alloc/src/rcs/rc.rs:1754-1761 | library/alloc/src/rcs/rc.rs:4605-4612 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) compiler/rustc_codegen_cranelift/example/std_example.rs:321 — compiler/rustc_codegen_cranelift/example/std_example.rs:321-328 | compiler/rustc_codegen_cranelift/example/std_example.rs:329-336 | compiler/rustc_codegen_gcc/example/std_example.rs:151-158 | compiler/rustc_codegen_gcc/example/std_example.rs:159-166 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×4
  • Duplicated block (6 lines × 4) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:32 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:32-37 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:385-390 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:554-559 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:604-609 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) compiler/rustc_mir_build/src/thir/print.rs:276 — compiler/rustc_mir_build/src/thir/print.rs:276-281 | compiler/rustc_mir_build/src/thir/print.rs:285-290 | compiler/rustc_mir_build/src/thir/print.rs:376-381 | compiler/rustc_mir_build/src/thir/print.rs:385-390 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) compiler/rustc_infer/src/infer/at.rs:457 — compiler/rustc_infer/src/infer/at.rs:457-462 | compiler/rustc_infer/src/infer/at.rs:472-477 | compiler/rustc_infer/src/infer/mod.rs:1803-1808 | compiler/rustc_infer/src/infer/mod.rs:1822-1827 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 4) compiler/rustc_middle/src/ty/predicate.rs:114 — compiler/rustc_middle/src/ty/predicate.rs:114-119 | compiler/rustc_middle/src/ty/predicate.rs:123-128 | compiler/rustc_middle/src/ty/print/pretty.rs:3006-3011 | compiler/rustc_middle/src/ty/print/pretty.rs:3026-3031 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:380 — compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:380-385 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:626-631 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:649-654 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) compiler/rustc_middle/src/ptrauth/llvm_siphash/mod.rs:50 — compiler/rustc_middle/src/ptrauth/llvm_siphash/mod.rs:50-55 | compiler/rustc_middle/src/ptrauth/llvm_siphash/mod.rs:58-63 | compiler/rustc_middle/src/ptrauth/llvm_siphash/mod.rs:65-70 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) compiler/rustc_passes/src/check_attr.rs:63 — compiler/rustc_passes/src/check_attr.rs:63-68 | compiler/rustc_passes/src/check_attr.rs:72-77 | compiler/rustc_passes/src/check_attr.rs:85-90 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) library/alloc/src/boxed/convert.rs:114 — library/alloc/src/boxed/convert.rs:114-119 | library/alloc/src/boxed/convert.rs:191-196 | library/alloc/src/ffi/c_str.rs:801-806 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
R10 · Code Duplication · Duplicated block (10 lines × 2 locations) · ×4
  • Duplicated block (10 lines × 2 locations) src/librustdoc/html/static/js/main.js:38 — src/librustdoc/html/static/js/main.js:38 · src/librustdoc/html/static/js/main.js:167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2 locations) REDACTED:5014 — REDACTED:5014 · REDACTED:5054 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:940 — src/librustdoc/html/static/js/stringdex.js:940 · src/librustdoc/html/static/js/stringdex.js:1013 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (10 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3086 — src/librustdoc/html/static/js/stringdex.js:3086 · src/librustdoc/html/static/js/stringdex.js:3098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X3 · Exception handling · Swallowed exception (empty catch) · ×4
  • Swallowed exception (empty catch) src/tools/rust-analyzer/lib/smol_str/src/gdb_smolstr_printer.py:117 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/tools/rust-analyzer/editors/code/src/ctx.ts:442 — `.catch((_) => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) REDACTED:353 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) src/librustdoc/html/static/js/storage.js:176 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×3
  • Animation without a prefers-reduced-motion guard src/tools/clippy/util/gh-pages/style.css:742 — `.github-corner:hover .octo-arm` moves (`animation: octocat-wave 560ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard src/tools/clippy/util/gh-pages/style.css:763 — `.github-corner .octo-arm` moves (`animation: octocat-wave 560ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard src/librustdoc/html/static/css/rustdoc.css:2386 — `.settings-menu.rotate > a img` moves (`animation: rotating 2s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
D1 · Cyclomatic Complexity · MirLowerCtx · ×3
  • MirLowerCtx::lower_expr_to_place_without_adjust (cyclomatic 131) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:370 — MirLowerCtx::lower_expr_to_place_without_adjust has cyclomatic complexity 131 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirLowerCtx::pattern_match_inner (cyclomatic 46) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs:117 — MirLowerCtx::pattern_match_inner has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MirLowerCtx::lower_expr_as_place_without_adjust (cyclomatic 25) src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs:117 — MirLowerCtx::lower_expr_as_place_without_adjust has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Config · ×3
  • Config::parse_inner (cyclomatic 120) src/bootstrap/src/core/config/config.rs:383 — Config::parse_inner has cyclomatic complexity 120 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Config::apply_change_with_sink (cyclomatic 21) src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:1206 — Config::apply_change_with_sink has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Config::inlay_hints (cyclomatic 18) src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs:2083 — Config::inlay_hints has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rust_analyzer::config::field_props (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SpanlessHash · ×3
  • SpanlessHash::hash_expr (cyclomatic 59) src/tools/clippy/clippy_utils/src/hir_utils.rs:1182 — SpanlessHash::hash_expr has cyclomatic complexity 59 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SpanlessHash::hash_pat (cyclomatic 24) src/tools/clippy/clippy_utils/src/hir_utils.rs:1462 — SpanlessHash::hash_pat has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • SpanlessHash::hash_tykind (cyclomatic 17) src/tools/clippy/clippy_utils/src/hir_utils.rs:1602 — SpanlessHash::hash_tykind has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: clippy_utils::hir_utils::has_ambiguous_literal_in_expr (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · hir_ide · ×3
  • hir_ide::display::render_const_scalar_inner (cyclomatic 57) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:819 — hir_ide::display::render_const_scalar_inner has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • hir_ide::display::render_const_scalar_from_valtree_inner (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:1094 — hir_ide::display::render_const_scalar_from_valtree_inner has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • hir_ide::display::write_bounds_like_dyn_trait (cyclomatic 36) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:2099 — hir_ide::display::write_bounds_like_dyn_trait has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayoutCalculator · ×3
  • LayoutCalculator::layout_of_enum (cyclomatic 56) compiler/rustc_abi/src/layout.rs:583 — LayoutCalculator::layout_of_enum has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LayoutCalculator::layout_of_univariant_biased (cyclomatic 43) compiler/rustc_abi/src/layout.rs:1090 — LayoutCalculator::layout_of_univariant_biased has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LayoutCalculator::layout_of_union (cyclomatic 18) compiler/rustc_abi/src/layout.rs:397 — LayoutCalculator::layout_of_union has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CastCheck · ×3
  • CastCheck::report_cast_error (cyclomatic 55) compiler/rustc_hir_typeck/src/cast.rs:286 — CastCheck::report_cast_error has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CastCheck::do_check (cyclomatic 26) compiler/rustc_hir_typeck/src/cast.rs:929 — CastCheck::do_check has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • CastCheck::do_check (cyclomatic 24) src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs:162 — CastCheck::do_check has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_interface · ×3
  • rustc_interface::interface::parse_check_cfg (cyclomatic 51) compiler/rustc_interface/src/interface.rs:116 — rustc_interface::interface::parse_check_cfg has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_interface::passes::write_out_deps (cyclomatic 22) compiler/rustc_interface/src/passes.rs:588 — rustc_interface::passes::write_out_deps has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_interface::passes::configure_and_expand (cyclomatic 20) compiler/rustc_interface/src/passes.rs:136 — rustc_interface::passes::configure_and_expand has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rustc_driver_impl · ×3
  • rustc_driver_impl::print_crate_info (cyclomatic 49) compiler/rustc_driver_impl/src/lib.rs:630 — rustc_driver_impl::print_crate_info has cyclomatic complexity 49 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rustc_driver_impl::compiler_entrypoint (cyclomatic 26) compiler/rustc_driver_impl/src/lib.rs:172 — rustc_driver_impl::compiler_entrypoint has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rustc_driver_impl::pretty::print (cyclomatic 18) compiler/rustc_driver_impl/src/pretty.rs:232 — rustc_driver_impl::pretty::print has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · InlineAsmCtxt · ×3
  • InlineAsmCtxt::get_asm_ty (cyclomatic 48) compiler/rustc_hir_typeck/src/inline_asm.rs:70 — InlineAsmCtxt::get_asm_ty has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • InlineAsmCtxt::check_asm (cyclomatic 33) compiler/rustc_hir_typeck/src/inline_asm.rs:458 — InlineAsmCtxt::check_asm has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InlineAsmCtxt::check_asm_operand_type (cyclomatic 27) compiler/rustc_hir_typeck/src/inline_asm.rs:189 — InlineAsmCtxt::check_asm_operand_type has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Definition · ×3
  • Definition::search_scope (cyclomatic 48) src/tools/rust-analyzer/crates/ide-db/src/search.rs:290 — Definition::search_scope has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Definition::label (cyclomatic 28) src/tools/rust-analyzer/crates/ide-db/src/defs.rs:310 — Definition::label has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Definition::range_for_rename (cyclomatic 27) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:136 — Definition::range_for_rename has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AstValidator · ×3
  • AstValidator::visit_item (cyclomatic 47) compiler/rustc_ast_passes/src/ast_validation.rs:1435 — AstValidator::visit_item has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AstValidator::visit_assoc_item (cyclomatic 26) compiler/rustc_ast_passes/src/ast_validation.rs:2077 — AstValidator::visit_assoc_item has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • AstValidator::visit_fn (cyclomatic 20) compiler/rustc_ast_passes/src/ast_validation.rs:1955 — AstValidator::visit_fn has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_resolve · ×3
  • rustc_resolve::diagnostics::impls::show_candidates (cyclomatic 46) compiler/rustc_resolve/src/diagnostics/impls.rs:4123 — rustc_resolve::diagnostics::impls::show_candidates has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_resolve::rustdoc::source_span_for_markdown_range_inner (cyclomatic 26) compiler/rustc_resolve/src/rustdoc.rs:565 — rustc_resolve::rustdoc::source_span_for_markdown_range_inner has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_resolve::check_unused::calc_unused_spans (cyclomatic 19) compiler/rustc_resolve/src/check_unused.rs:302 — rustc_resolve::check_unused::calc_unused_spans has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_metadata · ×3
  • rustc_metadata::dependency_format::calculate_type (cyclomatic 41) compiler/rustc_metadata/src/dependency_format.rs:84 — rustc_metadata::dependency_format::calculate_type has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_metadata::rmeta::decoder::cstore_impl::provide (cyclomatic 21) compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:436 — rustc_metadata::rmeta::decoder::cstore_impl::provide has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_metadata::dependency_format::verify_ok (cyclomatic 20) compiler/rustc_metadata/src/dependency_format.rs:403 — rustc_metadata::dependency_format::verify_ok has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · syntax_bridge · ×3
  • syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cyclomatic 40) src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs:23 — syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • syntax_bridge::convert_tokens (cyclomatic 31) src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs:208 — syntax_bridge::convert_tokens has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • syntax_bridge::to_parser_input::to_parser_input (cyclomatic 31) src/tools/rust-analyzer/crates/syntax-bridge/src/to_parser_input.rs:8 — syntax_bridge::to_parser_input::to_parser_input has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · cargo_miri · ×3
  • cargo_miri::phases::phase_rustc (cyclomatic 37) src/tools/miri/cargo-miri/src/phases.rs:276 — cargo_miri::phases::phase_rustc has cyclomatic complexity 37 (threshold 15). Of this number, 30 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • cargo_miri::phases::phase_cargo_miri (cyclomatic 30) src/tools/miri/cargo-miri/src/phases.rs:59 — cargo_miri::phases::phase_cargo_miri has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • cargo_miri::setup::setup (cyclomatic 24) src/tools/miri/cargo-miri/src/setup.rs:16 — cargo_miri::setup::setup has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RustcPatCtxt · ×3
  • RustcPatCtxt::lower_pat (cyclomatic 35) compiler/rustc_pattern_analysis/src/rustc.rs:461 — RustcPatCtxt::lower_pat has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • RustcPatCtxt::ctors_for_ty (cyclomatic 22) compiler/rustc_pattern_analysis/src/rustc.rs:306 — RustcPatCtxt::ctors_for_ty has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • RustcPatCtxt::print_witness_pat (cyclomatic 20) compiler/rustc_pattern_analysis/src/rustc.rs:783 — RustcPatCtxt::print_witness_pat has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · project_model · ×3
  • project_model::workspace::cargo_to_crate_graph (cyclomatic 31) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1262 — project_model::workspace::cargo_to_crate_graph has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • project_model::workspace::handle_rustc_crates (cyclomatic 20) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1534 — project_model::workspace::handle_rustc_crates has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • project_model::workspace::project_json_to_crate_graph (cyclomatic 16) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:1105 — project_model::workspace::project_json_to_crate_graph has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FmtVisitor · ×3
  • FmtVisitor::visit_item (cyclomatic 29) src/tools/rustfmt/src/visitor.rs:443 — FmtVisitor::visit_item has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FmtVisitor::visit_impl_items (cyclomatic 25) src/tools/rustfmt/src/items.rs:736 — FmtVisitor::visit_impl_items has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FmtVisitor::close_block (cyclomatic 22) src/tools/rustfmt/src/visitor.rs:263 — FmtVisitor::close_block has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AttributeParser · ×3
  • AttributeParser::check_attribute_stability (cyclomatic 27) compiler/rustc_attr_parsing/src/stability.rs:22 — AttributeParser::check_attribute_stability has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AttributeParser::parse_attribute_list (cyclomatic 23) compiler/rustc_attr_parsing/src/interface.rs:317 — AttributeParser::parse_attribute_list has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AttributeParser::check_target (cyclomatic 17) compiler/rustc_attr_parsing/src/target_checking.rs:96 — AttributeParser::check_target has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AssignmentResult · ×3
  • AssignmentResult::report_fully_unused (cyclomatic 27) compiler/rustc_mir_transform/src/liveness.rs:961 — AssignmentResult::report_fully_unused has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AssignmentResult::report_unused_assignments (cyclomatic 20) compiler/rustc_mir_transform/src/liveness.rs:1182 — AssignmentResult::report_unused_assignments has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AssignmentResult::find_dead_assignments (cyclomatic 18) compiler/rustc_mir_transform/src/liveness.rs:640 — AssignmentResult::find_dead_assignments has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · stdarch_gen_hexagon · ×3
  • stdarch_gen_hexagon::hvx::parse_header (cyclomatic 27) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:361 — stdarch_gen_hexagon::hvx::parse_header has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • stdarch_gen_hexagon::scalar::parse_header (cyclomatic 22) library/stdarch/crates/stdarch-gen-hexagon/src/scalar.rs:304 — stdarch_gen_hexagon::scalar::parse_header has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • stdarch_gen_hexagon::hvx::parse_compound_expr (cyclomatic 17) library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:173 — stdarch_gen_hexagon::hvx::parse_compound_expr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Expr · ×3
  • Expr::gen_source_code (cyclomatic 27) src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs:102 — Expr::gen_source_code has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Expr::needs_parens_in_expr (cyclomatic 24) src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs:199 — Expr::needs_parens_in_expr has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Expr::binding_power (cyclomatic 19) src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs:334 — Expr::binding_power has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · clippy_dev · ×3
  • clippy_dev::main (cyclomatic 24) src/tools/clippy/clippy_dev/src/main.rs:11 — clippy_dev::main has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_dev::fmt::fmt_conf (cyclomatic 22) src/tools/clippy/clippy_dev/src/fmt.rs:66 — clippy_dev::fmt::fmt_conf has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • clippy_dev::edit_lints::rename_update_fn (cyclomatic 20) src/tools/clippy/clippy_dev/src/edit_lints.rs:375 — clippy_dev::edit_lints::rename_update_fn has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UseTree · ×3
  • UseTree::normalize (cyclomatic 21) src/tools/rustfmt/src/imports.rs:554 — UseTree::normalize has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UseTree::from_ast (cyclomatic 18) src/tools/rustfmt/src/imports.rs:423 — UseTree::from_ast has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UseTree::expand_impl (cyclomatic 16) src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs:736 — UseTree::expand_impl has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · EvalContextPrivExt · ×3
  • EvalContextPrivExt::tb_reborrow (cyclomatic 17) src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs:238 — EvalContextPrivExt::tb_reborrow has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextPrivExt::sb_reborrow (cyclomatic 16) src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:594 — EvalContextPrivExt::sb_reborrow has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalContextPrivExt::schedule (cyclomatic 16) src/tools/miri/src/concurrency/scheduler.rs:52 — EvalContextPrivExt::schedule has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D17 · Explicit Debt · FixmeComment repeated across 10 files · ×3
  • FixmeComment repeated across 10 files tests/ui/panics/issue-47429-short-backtraces.rs:22 — The identical FixmeComment appears in 10 files (10 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 10 independent debts. Fix the systemic cause once rather than file-by-file. Text: "//@ ignore-android FIXME #17520". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
  • FixmeComment repeated across 10 files src/tools/rust-analyzer/crates/syntax/src/validation.rs:23 — The identical FixmeComment appears in 10 files (10 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 10 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME:". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
  • FixmeComment repeated across 10 files compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs:18 — The identical FixmeComment appears in 10 files (10 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 10 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(compiler-team#422): musl targets should be dynamically linked by default.". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · stdarch_gen_loongarch · ×3
  • stdarch_gen_loongarch::gen_test_body (cognitive 224) library/stdarch/crates/stdarch-gen-loongarch/src/main.rs:881 — stdarch_gen_loongarch::gen_test_body has cognitive complexity 224 (threshold 15). Drivers by points: loops 72 (144 pts), if/else 44 (54 pts), boolean chains 14, match/switch 10 (12 pts) (nesting depth added 84). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • stdarch_gen_loongarch::gen_bind_body (cognitive 91) library/stdarch/crates/stdarch-gen-loongarch/src/main.rs:253 — stdarch_gen_loongarch::gen_bind_body has cognitive complexity 91 (threshold 15). Drivers by points: if/else 42 (49 pts), match/switch 16 (22 pts), boolean chains 20 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • stdarch_gen_loongarch::gen_bind (cognitive 18) library/stdarch/crates/stdarch-gen-loongarch/src/main.rs:154 — stdarch_gen_loongarch::gen_bind has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EncodeContext · ×3
  • EncodeContext::encode_def_ids (cognitive 107) compiler/rustc_metadata/src/rmeta/encoder.rs:1487 — EncodeContext::encode_def_ids has cognitive complexity 107 (threshold 15). Drivers by points: if/else 40 (79 pts), match/switch 3 (12 pts), loops 6 (10 pts), boolean chains 6 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EncodeContext::encode_mir (cognitive 39) compiler/rustc_metadata/src/rmeta/encoder.rs:1932 — EncodeContext::encode_mir has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EncodeContext::encode_proc_macros (cognitive 21) compiler/rustc_metadata/src/rmeta/encoder.rs:2110 — EncodeContext::encode_proc_macros has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayoutCalculator · ×3
  • LayoutCalculator::layout_of_enum (cognitive 99) compiler/rustc_abi/src/layout.rs:583 — LayoutCalculator::layout_of_enum has cognitive complexity 99 (threshold 15). Drivers by points: if/else 37 (58 pts), match/switch 7 (18 pts), loops 8 (16 pts), boolean chains 7 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LayoutCalculator::layout_of_univariant_biased (cognitive 91) compiler/rustc_abi/src/layout.rs:1090 — LayoutCalculator::layout_of_univariant_biased has cognitive complexity 91 (threshold 15). Drivers by points: if/else 31 (54 pts), match/switch 10 (29 pts), boolean chains 7, loops 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LayoutCalculator::layout_of_union (cognitive 33) compiler/rustc_abi/src/layout.rs:397 — LayoutCalculator::layout_of_union has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hir_ide · ×3
  • hir_ide::display::render_const_scalar_inner (cognitive 87) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:819 — hir_ide::display::render_const_scalar_inner has cognitive complexity 87 (threshold 15). Drivers by points: if/else 27 (67 pts), match/switch 6 (13 pts), loops 3 (7 pts) (nesting depth added 51). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • hir_ide::display::write_bounds_like_dyn_trait (cognitive 77) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:2099 — hir_ide::display::write_bounds_like_dyn_trait has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (69 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • hir_ide::display::render_const_scalar_from_valtree_inner (cognitive 35) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:1094 — hir_ide::display::render_const_scalar_from_valtree_inner has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · EvalContextExtPriv · ×3
  • EvalContextExtPriv::emulate_foreign_item_inner (cognitive 82) src/tools/miri/src/shims/foreign_items.rs:256 — EvalContextExtPriv::emulate_foreign_item_inner has cognitive complexity 82 (threshold 15). Drivers by points: if/else 36 (68 pts), match/switch 6 (11 pts), boolean chains 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExtPriv::addr_from_alloc_id_uncached (cognitive 19) src/tools/miri/src/alloc_addresses/mod.rs:108 — EvalContextExtPriv::addr_from_alloc_id_uncached has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalContextExtPriv::tracing_apply_accesses (cognitive 18) src/tools/miri/src/shims/native_lib/mod.rs:181 — EvalContextExtPriv::tracing_apply_accesses has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 3 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SemanticsImpl · ×3
  • SemanticsImpl::descend_into_macros_impl (cognitive 78) src/tools/rust-analyzer/crates/hir/src/semantics.rs:1237 — SemanticsImpl::descend_into_macros_impl has cognitive complexity 78 (threshold 15). Drivers by points: if/else 10 (41 pts), match/switch 6 (20 pts), loops 5 (16 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticsImpl::analyze_impl (cognitive 16) src/tools/rust-analyzer/crates/hir/src/semantics.rs:2283 — SemanticsImpl::analyze_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SemanticsImpl::locals_used (cognitive 16) src/tools/rust-analyzer/crates/hir/src/semantics.rs:2459 — SemanticsImpl::locals_used has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_ast_lowering · ×3
  • rustc_ast_lowering::format::expand_format_args (cognitive 74) compiler/rustc_ast_lowering/src/format.rs:280 — rustc_ast_lowering::format::expand_format_args has cognitive complexity 74 (threshold 15). Drivers by points: if/else 25 (59 pts), match/switch 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ast_lowering::delegation::resolution::resolve_type_relative_delegations (cognitive 45) compiler/rustc_ast_lowering/src/delegation/resolution.rs:34 — rustc_ast_lowering::delegation::resolution::resolve_type_relative_delegations has cognitive complexity 45 (threshold 15). Drivers by points: match/switch 5 (20 pts), if/else 4 (12 pts), loops 3 (12 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ast_lowering::format::flatten_format_args (cognitive 16) compiler/rustc_ast_lowering/src/format.rs:152 — rustc_ast_lowering::format::flatten_format_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineAsmCtxt · ×3
  • InlineAsmCtxt::check_asm (cognitive 74) compiler/rustc_hir_typeck/src/inline_asm.rs:458 — InlineAsmCtxt::check_asm has cognitive complexity 74 (threshold 15). Drivers by points: if/else 15 (47 pts), match/switch 6 (22 pts), loops 2 (5 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InlineAsmCtxt::check_asm_operand_type (cognitive 33) compiler/rustc_hir_typeck/src/inline_asm.rs:189 — InlineAsmCtxt::check_asm_operand_type has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 4 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InlineAsmCtxt::get_asm_ty (cognitive 23) compiler/rustc_hir_typeck/src/inline_asm.rs:70 — InlineAsmCtxt::get_asm_ty has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 6 (9 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InlineAssemblyGenerator · ×3
  • InlineAssemblyGenerator::generate_asm_wrapper (cognitive 60) compiler/rustc_codegen_cranelift/src/inline_asm.rs:530 — InlineAssemblyGenerator::generate_asm_wrapper has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (30 pts), match/switch 6 (16 pts), loops 7 (12 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InlineAssemblyGenerator::allocate_registers (cognitive 42) compiler/rustc_codegen_cranelift/src/inline_asm.rs:312 — InlineAssemblyGenerator::allocate_registers has cognitive complexity 42 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 6 (12 pts), match/switch 3 (6 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InlineAssemblyGenerator::allocate_stack_slots (cognitive 20) compiler/rustc_codegen_cranelift/src/inline_asm.rs:435 — InlineAssemblyGenerator::allocate_stack_slots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 5 (6 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TagParser · ×3
  • TagParser::extract_html_tag (cognitive 60) src/librustdoc/passes/lint/html_tags.rs:527 — TagParser::extract_html_tag has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (49 pts), loops 2 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TagParser::extract_opening_tag (cognitive 46) src/librustdoc/passes/lint/html_tags.rs:596 — TagParser::extract_opening_tag has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TagParser::extract_tags (cognitive 27) src/librustdoc/passes/lint/html_tags.rs:680 — TagParser::extract_tags has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LintExtractor · ×3
  • LintExtractor::lints_from_file (cognitive 59) src/tools/lint-docs/src/lib.rs:195 — LintExtractor::lints_from_file has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (39 pts), match/switch 4 (13 pts), loops 4 (7 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LintExtractor::replace_produces (cognitive 16) src/tools/lint-docs/src/lib.rs:368 — LintExtractor::replace_produces has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (9 pts), loops 4 (7 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LintExtractor::generate_lint_output (cognitive 16) src/tools/lint-docs/src/lib.rs:429 — LintExtractor::generate_lint_output has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 2, loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · NiceRegionError · ×3
  • NiceRegionError::report_trait_placeholder_mismatch (cognitive 58) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs:246 — NiceRegionError::report_trait_placeholder_mismatch has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (42 pts), boolean chains 10, match/switch 2 (4 pts), loops 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NiceRegionError::explain_actual_impl_that_was_found (cognitive 25) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs:506 — NiceRegionError::explain_actual_impl_that_was_found has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NiceRegionError::try_report_mismatched_static_lifetime (cognitive 18) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs:21 — NiceRegionError::try_report_mismatched_static_lifetime has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (5 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · rustc_const_eval · ×3
  • rustc_const_eval::check_consts::ops::build_error_for_const_call (cognitive 52) compiler/rustc_const_eval/src/check_consts/ops.rs:218 — rustc_const_eval::check_consts::ops::build_error_for_const_call has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 4 (9 pts), boolean chains 5, loops 1 (5 pts) (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_const_eval::interpret::intern::intern_const_alloc_recursive (cognitive 27) compiler/rustc_const_eval/src/interpret/intern.rs:204 — rustc_const_eval::interpret::intern::intern_const_alloc_recursive has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_const_eval::util::check_validity_requirement::check_validity_requirement_lax (cognitive 18) compiler/rustc_const_eval/src/util/check_validity_requirement.rs:91 — rustc_const_eval::util::check_validity_requirement::check_validity_requirement_lax has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), match/switch 4, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LintLevelsBuilder · ×3
  • LintLevelsBuilder::add (cognitive 51) compiler/rustc_lint/src/levels.rs:728 — LintLevelsBuilder::add has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (34 pts), match/switch 4 (10 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LintLevelsBuilder::add_command_line (cognitive 17) compiler/rustc_lint/src/levels.rs:484 — LintLevelsBuilder::add_command_line has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LintLevelsBuilder::insert_spec (cognitive 16) compiler/rustc_lint/src/levels.rs:558 — LintLevelsBuilder::insert_spec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · syntax_bridge · ×3
  • syntax_bridge::convert_tokens (cognitive 51) src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs:208 — syntax_bridge::convert_tokens has cognitive complexity 51 (threshold 15). Drivers by points: match/switch 8 (24 pts), if/else 4 (15 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 34). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • syntax_bridge::to_parser_input::to_parser_input (cognitive 44) src/tools/rust-analyzer/crates/syntax-bridge/src/to_parser_input.rs:8 — syntax_bridge::to_parser_input::to_parser_input has cognitive complexity 44 (threshold 15). Drivers by points: match/switch 8 (25 pts), if/else 5 (16 pts), boolean chains 2, loops 1 (nesting depth added 28). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • syntax_bridge::prettify_macro_expansion::prettify_macro_expansion (cognitive 41) src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs:23 — syntax_bridge::prettify_macro_expansion::prettify_macro_expansion has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 5 (12 pts), boolean chains 7, loops 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutoTraitFinder · ×3
  • AutoTraitFinder::evaluate_nested_obligations (cognitive 50) compiler/rustc_trait_selection/src/traits/auto_trait.rs:647 — AutoTraitFinder::evaluate_nested_obligations has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 5 (15 pts), boolean chains 2, loops 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AutoTraitFinder::map_vid_to_region (cognitive 33) compiler/rustc_trait_selection/src/traits/auto_trait.rs:528 — AutoTraitFinder::map_vid_to_region has cognitive complexity 33 (threshold 15). Drivers by points: if/else 4 (20 pts), loops 4 (7 pts), match/switch 2 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AutoTraitFinder::evaluate_predicates (cognitive 20) compiler/rustc_trait_selection/src/traits/auto_trait.rs:299 — AutoTraitFinder::evaluate_predicates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocParser · ×3
  • DocParser::parse_auto_cfg (cognitive 47) compiler/rustc_attr_parsing/src/attributes/doc.rs:387 — DocParser::parse_auto_cfg has cognitive complexity 47 (threshold 15). Drivers by points: if/else 7 (27 pts), match/switch 4 (12 pts), loops 3 (8 pts) (nesting depth added 33). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • DocParser::parse_single_doc_attr_item (cognitive 42) compiler/rustc_attr_parsing/src/attributes/doc.rs:512 — DocParser::parse_single_doc_attr_item has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (34 pts), match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocParser::parse_auto_cfg_values (cognitive 30) compiler/rustc_attr_parsing/src/attributes/doc.rs:312 — DocParser::parse_auto_cfg_values has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Module · ×3
  • Module::get_usages_and_record_fields (cognitive 47) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:276 — Module::get_usages_and_record_fields has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (34 pts), match/switch 3 (12 pts), loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Module::process_def_in_sel (cognitive 39) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:551 — Module::process_def_in_sel has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 11, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Module::expand_and_group_usages_file_wise (cognitive 18) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:375 — Module::expand_and_group_usages_file_wise has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_macros · ×3
  • rustc_macros::query::parse_query_modifiers (cognitive 46) compiler/rustc_macros/src/query.rs:152 — rustc_macros::query::parse_query_modifiers has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (45 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_macros::diagnostics::utils::build_format (cognitive 16) compiler/rustc_macros/src/diagnostics/utils.rs:287 — rustc_macros::diagnostics::utils::build_format has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_macros::symbols::symbols_with_errors (cognitive 16) compiler/rustc_macros/src/symbols.rs:175 — rustc_macros::symbols::symbols_with_errors has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (7 pts), if/else 3 (5 pts), loops 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AttributeParser · ×3
  • AttributeParser::parse_attribute_list (cognitive 45) compiler/rustc_attr_parsing/src/interface.rs:317 — AttributeParser::parse_attribute_list has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (36 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AttributeParser::check_target (cognitive 21) compiler/rustc_attr_parsing/src/target_checking.rs:96 — AttributeParser::check_target has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 3, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AttributeParser::check_attribute_safety (cognitive 16) compiler/rustc_attr_parsing/src/safety.rs:12 — AttributeParser::check_attribute_safety has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CoerceMany · ×3
  • CoerceMany::coerce_inner (cognitive 42) compiler/rustc_hir_typeck/src/coercion.rs:1673 — CoerceMany::coerce_inner has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (37 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CoerceMany::report_return_mismatched_types (cognitive 25) compiler/rustc_hir_typeck/src/coercion.rs:2005 — CoerceMany::report_return_mismatched_types has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CoerceMany::coerce_inner (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs:1295 — CoerceMany::coerce_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModCollector · ×3
  • ModCollector::collect (cognitive 42) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1898 — ModCollector::collect has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 5 (8 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ModCollector::collect_macro_def (cognitive 19) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:2599 — ModCollector::collect_macro_def has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ModCollector::collect_macro_rules (cognitive 16) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:2517 — ModCollector::collect_macro_rules has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Intrinsic · ×3
  • Intrinsic::generate_big_endian (cognitive 39) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1061 — Intrinsic::generate_big_endian has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Intrinsic::defer_to_existing_llvm_link (cognitive 24) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1549 — Intrinsic::defer_to_existing_llvm_link has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Intrinsic::pre_build (cognitive 18) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1418 — Intrinsic::pre_build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stdarch_test · ×3
  • stdarch_test::disassembly::parse (cognitive 37) library/stdarch/crates/stdarch-test/src/disassembly.rs:106 — stdarch_test::disassembly::parse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 5, loops 4 (5 pts), match/switch 1 (4 pts) (nesting depth added 18). Of this number, 30 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_test::assert (cognitive 21) library/stdarch/crates/stdarch-test/src/lib.rs:57 — stdarch_test::assert has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, loops 2, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • stdarch_test::wasm::disassemble_myself (cognitive 19) library/stdarch/crates/stdarch-test/src/wasm.rs:7 — stdarch_test::wasm::disassemble_myself has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HirEqInterExpr · ×3
  • HirEqInterExpr::eq_expr (cognitive 37) src/tools/clippy/clippy_utils/src/hir_utils.rs:504 — HirEqInterExpr::eq_expr has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 29, if/else 2 (4 pts), match/switch 3 (4 pts) (nesting depth added 3). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • HirEqInterExpr::check_ctxt (cognitive 29) src/tools/clippy/clippy_utils/src/hir_utils.rs:930 — HirEqInterExpr::check_ctxt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HirEqInterExpr::eq_block (cognitive 27) src/tools/clippy/clippy_utils/src/hir_utils.rs:394 — HirEqInterExpr::eq_block has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, match/switch 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LexicalResolver · ×3
  • LexicalResolver::expansion (cognitive 36) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:192 — LexicalResolver::expansion has cognitive complexity 36 (threshold 15). Drivers by points: match/switch 6 (19 pts), if/else 5 (15 pts), loops 2 (nesting depth added 23). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LexicalResolver::collect_error_for_expanding_node (cognitive 22) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:694 — LexicalResolver::collect_error_for_expanding_node has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LexicalResolver::collect_bounding_regions (cognitive 17) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:812 — LexicalResolver::collect_bounding_regions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (process_edges). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · rustc_pattern_analysis · ×3
  • rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness (cognitive 33) compiler/rustc_pattern_analysis/src/usefulness.rs:1698 — rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_pattern_analysis::rustc::print::write_struct_like (cognitive 27) compiler/rustc_pattern_analysis/src/rustc/print.rs:46 — rustc_pattern_analysis::rustc::print::write_struct_like has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, loops 2 (5 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_pattern_analysis::usefulness::collect_overlapping_range_endpoints (cognitive 24) compiler/rustc_pattern_analysis/src/usefulness.rs:1598 — rustc_pattern_analysis::usefulness::collect_overlapping_range_endpoints has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · citool · ×3
  • citool::jobs::calculate_jobs (cognitive 33) src/ci/citool/src/jobs.rs:308 — citool::jobs::calculate_jobs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • citool::analysis::report_test_diffs (cognitive 20) src/ci/citool/src/analysis.rs:454 — citool::analysis::report_test_diffs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 5 (7 pts), match/switch 4 (6 pts) (nesting depth added 5). Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • citool::analysis::report_debuginfo_statistics (cognitive 16) src/ci/citool/src/analysis.rs:148 — citool::analysis::report_debuginfo_statistics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 3 (5 pts), match/switch 1 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CrateLocator · ×3
  • CrateLocator::extract_one (cognitive 32) compiler/rustc_metadata/src/locator.rs:573 — CrateLocator::extract_one has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CrateLocator::find_commandline_library (cognitive 21) compiler/rustc_metadata/src/locator.rs:741 — CrateLocator::find_commandline_library has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CrateLocator::find_library_crate (cognitive 19) compiler/rustc_metadata/src/locator.rs:388 — CrateLocator::find_library_crate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clippy_config · ×3
  • clippy_config::de::create_value_list_msg (cognitive 32) src/tools/clippy/clippy_config/src/de.rs:69 — clippy_config::de::create_value_list_msg has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_config::conf::load_conf_file (cognitive 26) src/tools/clippy/clippy_config/src/conf.rs:885 — clippy_config::conf::load_conf_file has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_config::types::create_disallowed_map (cognitive 18) src/tools/clippy/clippy_config/src/types.rs:233 — clippy_config::types::create_disallowed_map has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clippy_dev · ×3
  • clippy_dev::edit_lints::rename_update_fn (cognitive 32) src/tools/clippy/clippy_dev/src/edit_lints.rs:375 — clippy_dev::edit_lints::rename_update_fn has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 5, match/switch 2 (5 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_dev::main (cognitive 24) src/tools/clippy/clippy_dev/src/main.rs:11 — clippy_dev::main has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 6 (11 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • clippy_dev::deprecate_lint::remove_lint_declaration (cognitive 17) src/tools/clippy/clippy_dev/src/deprecate_lint.rs:116 — clippy_dev::deprecate_lint::remove_lint_declaration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (remove_impl_lint_pass, remove_test_assets). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Node · ×3
  • Node::trim_clone (cognitive 32) src/tools/generate-copyright/src/main.rs:139 — Node::trim_clone has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Node::merge_groups (cognitive 21) src/tools/collect-license-metadata/src/path_tree.rs:201 — Node::merge_groups has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Node::merge_directory_licenses (cognitive 18) src/tools/collect-license-metadata/src/path_tree.rs:141 — Node::merge_directory_licenses has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 2 (6 pts), match/switch 2 (5 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ImproperCTypesVisitor · ×3
  • ImproperCTypesVisitor::visit_type (cognitive 29) compiler/rustc_lint/src/types/improper_ctypes.rs:783 — ImproperCTypesVisitor::visit_type has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 4 (7 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ImproperCTypesVisitor::visit_indirection (cognitive 20) compiler/rustc_lint/src/types/improper_ctypes.rs:542 — ImproperCTypesVisitor::visit_indirection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ImproperCTypesVisitor::visit_struct_or_union (cognitive 20) compiler/rustc_lint/src/types/improper_ctypes.rs:670 — ImproperCTypesVisitor::visit_struct_or_union has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SubdiagnosticDeriveVariantBuilder · ×3
  • SubdiagnosticDeriveVariantBuilder::into_tokens (cognitive 28) compiler/rustc_macros/src/diagnostics/subdiagnostic.rs:503 — SubdiagnosticDeriveVariantBuilder::into_tokens has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SubdiagnosticDeriveVariantBuilder::generate_field_code_inner_path (cognitive 21) compiler/rustc_macros/src/diagnostics/subdiagnostic.rs:291 — SubdiagnosticDeriveVariantBuilder::generate_field_code_inner_path has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SubdiagnosticDeriveVariantBuilder::generate_field_code_inner_list (cognitive 16) compiler/rustc_macros/src/diagnostics/subdiagnostic.rs:405 — SubdiagnosticDeriveVariantBuilder::generate_field_code_inner_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Cursor · ×3
  • Cursor::advance_token (cognitive 27) compiler/rustc_lexer/src/lib.rs:536 — Cursor::advance_token has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (7 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Cursor::number (cognitive 20) compiler/rustc_lexer/src/lib.rs:910 — Cursor::number has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Cursor::frontmatter (cognitive 19) compiler/rustc_lexer/src/lib.rs:696 — Cursor::frontmatter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CStore · ×3
  • CStore::report_target_modifiers_extended (cognitive 26) compiler/rustc_metadata/src/creader.rs:347 — CStore::report_target_modifiers_extended has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (19 pts), match/switch 3 (6 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CStore::inject_allocator_crate (cognitive 24) compiler/rustc_metadata/src/creader.rs:1102 — CStore::inject_allocator_crate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CStore::report_incompatible_partial_mitigations (cognitive 18) compiler/rustc_metadata/src/creader.rs:478 — CStore::report_incompatible_partial_mitigations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_sanitizers · ×3
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty (cognitive 26) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:422 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_ty has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_const_value (cognitive 20) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:152 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::encode::encode_const_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_sanitizers::cfi::typeid::itanium_cxx_abi::transform::transform_instance (cognitive 19) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs:507 — rustc_sanitizers::cfi::typeid::itanium_cxx_abi::transform::transform_instance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RustcPatCtxt · ×3
  • RustcPatCtxt::lower_pat (cognitive 25) compiler/rustc_pattern_analysis/src/rustc.rs:461 — RustcPatCtxt::lower_pat has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 10 (22 pts), if/else 2 (3 pts) (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RustcPatCtxt::ctors_for_ty (cognitive 22) compiler/rustc_pattern_analysis/src/rustc.rs:306 — RustcPatCtxt::ctors_for_ty has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RustcPatCtxt::print_witness_pat (cognitive 16) compiler/rustc_pattern_analysis/src/rustc.rs:783 — RustcPatCtxt::print_witness_pat has cognitive complexity 16 (threshold 15). Drivers by points: loops 2 (6 pts), match/switch 3 (5 pts), boolean chains 3, if/else 1 (2 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RustdocVisitor · ×3
  • RustdocVisitor::maybe_inline_local (cognitive 25) src/librustdoc/visit_ast.rs:253 — RustdocVisitor::maybe_inline_local has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 10, loops 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • RustdocVisitor::visit_use_inner (cognitive 22) src/librustdoc/visit_ast.rs:581 — RustdocVisitor::visit_use_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RustdocVisitor::visit_item_inner (cognitive 18) src/librustdoc/visit_ast.rs:467 — RustdocVisitor::visit_item_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CheckAttrVisitor · ×3
  • CheckAttrVisitor::check_proc_macro (cognitive 21) compiler/rustc_passes/src/check_attr.rs:1153 — CheckAttrVisitor::check_proc_macro has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CheckAttrVisitor::check_repr (cognitive 17) compiler/rustc_passes/src/check_attr.rs:1014 — CheckAttrVisitor::check_repr has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CheckAttrVisitor::check_attributes (cognitive 16) compiler/rustc_passes/src/check_attr.rs:127 — CheckAttrVisitor::check_attributes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (9 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_type_ir · ×3
  • rustc_type_ir::relate::structurally_relate_tys (cognitive 21) compiler/rustc_type_ir/src/relate.rs:347 — rustc_type_ir::relate::structurally_relate_tys has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rustc_type_ir::region_constraint::compute_new_region_constraints (cognitive 18) compiler/rustc_type_ir/src/region_constraint.rs:656 — rustc_type_ir::region_constraint::compute_new_region_constraints has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (7 pts), match/switch 2 (6 pts), if/else 1 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_type_ir::region_constraint::pull_region_outlives_constraints_out_of_universe (cognitive 17) compiler/rustc_type_ir/src/region_constraint.rs:749 — rustc_type_ir::region_constraint::pull_region_outlives_constraints_out_of_universe has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 2 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · rustc_hir_typeck · ×3
  • rustc_hir_typeck::typeck_with_inspect (cognitive 20) compiler/rustc_hir_typeck/src/lib.rs:108 — rustc_hir_typeck::typeck_with_inspect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • rustc_hir_typeck::check::check_fn (cognitive 20) compiler/rustc_hir_typeck/src/check.rs:28 — rustc_hir_typeck::check::check_fn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_hir_typeck::fallback::compute_unsafe_infer_vars (cognitive 16) compiler/rustc_hir_typeck/src/fallback.rs:517 — rustc_hir_typeck::fallback::compute_unsafe_infer_vars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Stack · ×3
  • Stack::retain (cognitive 18) src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs:45 — Stack::retain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Stack::access (cognitive 17) src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:271 — Stack::access has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Stack::disable_uniques_starting_at (cognitive 17) src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs:380 — Stack::disable_uniques_starting_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×3
  • Duplicated block (35 lines × 2) compiler/rustc_codegen_gcc/src/back/lto.rs:141 — compiler/rustc_codegen_gcc/src/back/lto.rs:141-175 | compiler/rustc_codegen_llvm/src/back/lto.rs:219-253 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (35 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:1227 — compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:1227-1261 | compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:1291-1325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (35 lines × 2) compiler/rustc_hir_analysis/src/check/compare_eii.rs:122 — compiler/rustc_hir_analysis/src/check/compare_eii.rs:122-156 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:367-401 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) compiler/rustc_borrowck/src/type_check/free_region_relations.rs:189 — compiler/rustc_borrowck/src/type_check/free_region_relations.rs:189-218 | compiler/rustc_borrowck/src/type_check/free_region_relations.rs:349-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (30 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1575 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1575-1604 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2692-2721 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:670 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:670-699 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:32-63 — before extracting anything, compare `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs` and `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×3
  • Duplicated block (24 lines × 2) compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:957 — compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:957-980 | compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs:1080-1103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:404 — compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:404-427 | compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:443-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) library/alloc/src/rcs/arc.rs:1271 — library/alloc/src/rcs/arc.rs:1271-1294 | library/alloc/src/rcs/rc.rs:1117-1140 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×3
  • Duplicated block (13 lines × 4) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:540 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:540-552 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:554-566 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3089-3101 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3103-3115 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 4) library/alloc/src/rcs/arc.rs:741 — library/alloc/src/rcs/arc.rs:741-753 | library/alloc/src/rcs/arc.rs:779-791 | library/alloc/src/rcs/rc.rs:718-730 | library/alloc/src/rcs/rc.rs:756-768 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 4) library/alloc/src/rcs/arc.rs:965 — library/alloc/src/rcs/arc.rs:965-977 | library/alloc/src/rcs/arc.rs:1004-1016 | library/alloc/src/rcs/rc.rs:900-912 | library/alloc/src/rcs/rc.rs:939-951 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×3
  • Duplicated block (11–13 lines × 2) compiler/rustc_builtin_macros/src/autodiff.rs:346 — compiler/rustc_builtin_macros/src/autodiff.rs:346-356 | compiler/rustc_builtin_macros/src/offload.rs:138-150 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11–13 lines × 2) compiler/rustc_codegen_cranelift/src/value_and_place.rs:716 — compiler/rustc_codegen_cranelift/src/value_and_place.rs:716-726 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:742-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) library/alloc/src/collections/vec_deque/into_iter.rs:94 — library/alloc/src/collections/vec_deque/into_iter.rs:94-106 | library/alloc/src/collections/vec_deque/into_iter.rs:216-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×3
  • Duplicated block (10–13 lines × 2) compiler/rustc_codegen_cranelift/src/global_asm.rs:107 — compiler/rustc_codegen_cranelift/src/global_asm.rs:107-116 | compiler/rustc_codegen_llvm/src/asm.rs:435-447 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–13 lines × 2) compiler/rustc_trait_selection/src/traits/fulfill.rs:720 — compiler/rustc_trait_selection/src/traits/fulfill.rs:720-729 | compiler/rustc_trait_selection/src/traits/select/mod.rs:802-814 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–13 lines × 2) compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:253 — compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:253-262 | compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs:228-240 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs` and `compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:164 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:164-175 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2209-2219 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11–12 lines × 2) compiler/rustc_type_ir/src/region_constraint.rs:817 — compiler/rustc_type_ir/src/region_constraint.rs:817-827 | compiler/rustc_type_ir/src/region_constraint.rs:932-943 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) src/etc/lldb_providers.py:1401 — src/etc/lldb_providers.py:1401-1411 | src/etc/lldb_providers.py:1472-1483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:928 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:928-937 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:950-959 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:996-1005 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) compiler/rustc_codegen_llvm/src/asm.rs:1221 — compiler/rustc_codegen_llvm/src/asm.rs:1221-1230 | compiler/rustc_codegen_llvm/src/asm.rs:1418-1427 | compiler/rustc_codegen_llvm/src/asm.rs:1596-1605 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) compiler/rustc_monomorphize/src/collector.rs:1551 — compiler/rustc_monomorphize/src/collector.rs:1551-1560 | compiler/rustc_monomorphize/src/collector.rs:1562-1571 | compiler/rustc_monomorphize/src/collector.rs:1573-1582 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×3
  • Swallowed exception (caught, then discarded) src/tools/rust-analyzer/lib/smol_str/src/gdb_smolstr_printer.py:54 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/etc/debugger_tester/gdb/from_gdb.py:66 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) src/etc/debugger_tester/gdb/from_gdb.py:277 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×2
  • Focus outline removed in CSS without a :focus replacement src/librustdoc/html/static/css/rustdoc.css:1135 — `#main-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
  • Focus outline removed in CSS without a :focus replacement src/librustdoc/html/static/css/rustdoc.css:2451 — `details.toggle > summary` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D1 · Cyclomatic Complexity · stdarch_gen_loongarch · ×2
  • stdarch_gen_loongarch::gen_test_body (cyclomatic 198) library/stdarch/crates/stdarch-gen-loongarch/src/main.rs:881 — stdarch_gen_loongarch::gen_test_body has cyclomatic complexity 198 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • stdarch_gen_loongarch::gen_bind_body (cyclomatic 129) library/stdarch/crates/stdarch-gen-loongarch/src/main.rs:253 — stdarch_gen_loongarch::gen_bind_body has cyclomatic complexity 129 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ide_diagnostics · ×2
  • ide_diagnostics::semantic_diagnostics (cyclomatic 92) src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs:375 — ide_diagnostics::semantic_diagnostics has cyclomatic complexity 92 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ide_diagnostics::handlers::unlinked_file::fixes (cyclomatic 18) src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unlinked_file.rs:77 — ide_diagnostics::handlers::unlinked_file::fixes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Target · ×2
  • Target::from_rustc (cyclomatic 91) library/compiler-builtins/crates/symcheck/src/main.rs:148 — Target::from_rustc has cyclomatic complexity 91 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Target::abi_required_features (cyclomatic 37) compiler/rustc_target/src/target_features.rs:1290 — Target::abi_required_features has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · libm_test · ×2
  • libm_test::precision::default_ulp (cyclomatic 73) library/compiler-builtins/libm-test/src/precision.rs:16 — libm_test::precision::default_ulp has cyclomatic complexity 73 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • libm_test::run_cfg::arg_max_iterations (cyclomatic 19) library/compiler-builtins/libm-test/src/run_cfg.rs:244 — libm_test::run_cfg::arg_max_iterations has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConstEvalCtxt · ×2
  • ConstEvalCtxt::binop (cyclomatic 70) src/tools/clippy/clippy_utils/src/consts.rs:1010 — ConstEvalCtxt::binop has cyclomatic complexity 70 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstEvalCtxt::expr (cyclomatic 29) src/tools/clippy/clippy_utils/src/consts.rs:651 — ConstEvalCtxt::expr has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Lexer · ×2
  • Lexer::next_token_from_cursor (cyclomatic 67) compiler/rustc_parse/src/lexer/mod.rs:161 — Lexer::next_token_from_cursor has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Lexer::cook_lexer_literal (cyclomatic 29) compiler/rustc_parse/src/lexer/mod.rs:795 — Lexer::cook_lexer_literal has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThirPrinter · ×2
  • ThirPrinter::print_expr_kind (cyclomatic 60) compiler/rustc_mir_build/src/thir/print.rs:214 — ThirPrinter::print_expr_kind has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ThirPrinter::print_pat_kind (cyclomatic 26) compiler/rustc_mir_build/src/thir/print.rs:721 — ThirPrinter::print_pat_kind has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Dereferencing · ×2
  • Dereferencing::check_expr (cyclomatic 60) src/tools/clippy/clippy_lints/src/dereference.rs:242 — Dereferencing::check_expr has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Dereferencing::report (cyclomatic 40) src/tools/clippy/clippy_lints/src/dereference.rs:1095 — Dereferencing::report has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnyDiagnostic · ×2
  • AnyDiagnostic::inference_diagnostic (cyclomatic 59) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:1549 — AnyDiagnostic::inference_diagnostic has cyclomatic complexity 59 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AnyDiagnostic::body_validation_diagnostic (cyclomatic 20) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:1417 — AnyDiagnostic::body_validation_diagnostic has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · stringdex.loadDatabase · ×2
  • stringdex.loadDatabase::makeSearchTreeFromBase64 (cyclomatic 59) src/librustdoc/html/static/js/stringdex.js:3009 — stringdex.loadDatabase::makeSearchTreeFromBase64 has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (stringdex.loadDatabase, stringdex.loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • stringdex.loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData (cyclomatic 36) src/librustdoc/html/static/js/stringdex.js:3045 — stringdex.loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (stringdex.loadDatabase, stringdex.loadDatabase::makeSearchTreeFromBase64) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · EncodeContext · ×2
  • EncodeContext::encode_def_ids (cyclomatic 57) compiler/rustc_metadata/src/rmeta/encoder.rs:1487 — EncodeContext::encode_def_ids has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EncodeContext::encode_mir (cyclomatic 20) compiler/rustc_metadata/src/rmeta/encoder.rs:1932 — EncodeContext::encode_mir has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · V0SymbolMangler · ×2
  • V0SymbolMangler::print_type (cyclomatic 55) compiler/rustc_symbol_mangling/src/v0.rs:496 — V0SymbolMangler::print_type has cyclomatic complexity 55 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • V0SymbolMangler::print_const (cyclomatic 22) compiler/rustc_symbol_mangling/src/v0.rs:743 — V0SymbolMangler::print_const has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_parse · ×2
  • rustc_parse::lexer::unescape_error_reporting::emit_unescape_error (cyclomatic 51) compiler/rustc_parse/src/lexer/unescape_error_reporting.rs:15 — rustc_parse::lexer::unescape_error_reporting::emit_unescape_error has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_parse::parser::asm::parse_asm_operand (cyclomatic 19) compiler/rustc_parse/src/parser/asm.rs:98 — rustc_parse::parser::asm::parse_asm_operand has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Converter · ×2
  • Converter::extend_token (cyclomatic 51) src/tools/rust-analyzer/crates/parser/src/lexed_str.rs:206 — Converter::extend_token has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Converter::extend_literal (cyclomatic 25) src/tools/rust-analyzer/crates/parser/src/lexed_str.rs:329 — Converter::extend_literal has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: parser::lexed_str::err_to_msg (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DocParser · ×2
  • DocParser::parse_single_doc_attr_item (cyclomatic 50) compiler/rustc_attr_parsing/src/attributes/doc.rs:512 — DocParser::parse_single_doc_attr_item has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DocParser::parse_auto_cfg (cyclomatic 19) compiler/rustc_attr_parsing/src/attributes/doc.rs:387 — DocParser::parse_auto_cfg has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Install · ×2
  • Install::merge (cyclomatic 50) src/bootstrap/src/core/config/toml/install.rs:11 — Install::merge has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Install::deserialize (cyclomatic 24) src/bootstrap/src/core/config/toml/install.rs:11 — Install::deserialize has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PrintVisitor · ×2
  • PrintVisitor::expr (cyclomatic 46) src/tools/clippy/clippy_lints/src/utils/author.rs:435 — PrintVisitor::expr has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PrintVisitor::lit (cyclomatic 25) src/tools/clippy/clippy_lints/src/utils/author.rs:349 — PrintVisitor::lit has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CfgChecker · ×2
  • CfgChecker::visit_terminator (cyclomatic 45) compiler/rustc_mir_transform/src/validate.rs:340 — CfgChecker::visit_terminator has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CfgChecker::check_cleanup_control_flow (cyclomatic 17) compiler/rustc_mir_transform/src/validate.rs:168 — CfgChecker::check_cleanup_control_flow has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnsafetyVisitor · ×2
  • UnsafetyVisitor::visit_expr (cyclomatic 44) compiler/rustc_mir_build/src/check_unsafety.rs:343 — UnsafetyVisitor::visit_expr has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UnsafetyVisitor::visit_pat (cyclomatic 18) compiler/rustc_mir_build/src/check_unsafety.rs:252 — UnsafetyVisitor::visit_pat has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: UnsafeOpKind::emit_requires_unsafe_err (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Pgo · ×2
  • Pgo::merge (cyclomatic 43) src/bootstrap/src/core/config/toml/pgo.rs:23 — Pgo::merge has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Pgo::deserialize (cyclomatic 21) src/bootstrap/src/core/config/toml/pgo.rs:23 — Pgo::deserialize has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FindUsages · ×2
  • FindUsages::search (cyclomatic 39) src/tools/rust-analyzer/crates/ide-db/src/search.rs:929 — FindUsages::search has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • FindUsages::short_associated_function_fast_search::collect_possible_aliases (cyclomatic 24) src/tools/rust-analyzer/crates/ide-db/src/search.rs:654 — FindUsages::short_associated_function_fast_search::collect_possible_aliases has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Pat · ×2
  • Pat::rewrite_result (cyclomatic 37) src/tools/rustfmt/src/patterns.rs:85 — Pat::rewrite_result has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Pat::hir_fmt (cyclomatic 23) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs:306 — Pat::hir_fmt has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SerializedSearchIndex · ×2
  • SerializedSearchIndex::union (cyclomatic 36) REDACTED:314 — SerializedSearchIndex::union has cyclomatic complexity 36 (threshold 15). Of this number, 26 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • SerializedSearchIndex::sort (cyclomatic 21) REDACTED:596 — SerializedSearchIndex::sort has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · ProbeContext · ×2
  • ProbeContext::consider_probe (cyclomatic 35) compiler/rustc_hir_typeck/src/method/probe.rs:2002 — ProbeContext::consider_probe has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ProbeContext::consider_probe (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs:1567 — ProbeContext::consider_probe has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConstToPat · ×2
  • ConstToPat::valtree_to_pat (cyclomatic 35) compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:244 — ConstToPat::valtree_to_pat has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConstToPat::alias_to_pat (cyclomatic 20) compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:100 — ConstToPat::alias_to_pat has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_type_ir · ×2
  • rustc_type_ir::relate::structurally_relate_tys (cyclomatic 35) compiler/rustc_type_ir/src/relate.rs:347 — rustc_type_ir::relate::structurally_relate_tys has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_type_ir::walk::push_inner (cyclomatic 21) compiler/rustc_type_ir/src/walk.rs:74 — rustc_type_ir::walk::push_inner has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MiriMachine · ×2
  • MiriMachine::emit_diagnostic (cyclomatic 35) src/tools/miri/src/diagnostics.rs:639 — MiriMachine::emit_diagnostic has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • MiriMachine::extern_static_pointer (cyclomatic 16) src/tools/miri/src/machine.rs:1470 — MiriMachine::extern_static_pointer has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InlineAssemblyGenerator · ×2
  • InlineAssemblyGenerator::generate_asm_wrapper (cyclomatic 33) compiler/rustc_codegen_cranelift/src/inline_asm.rs:530 — InlineAssemblyGenerator::generate_asm_wrapper has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • InlineAssemblyGenerator::allocate_registers (cyclomatic 19) compiler/rustc_codegen_cranelift/src/inline_asm.rs:312 — InlineAssemblyGenerator::allocate_registers has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · std_detect · ×2
  • std_detect::detect::os::riscv::imply_features (cyclomatic 33) library/std_detect/src/detect/os/riscv.rs:21 — std_detect::detect::os::riscv::imply_features has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • std_detect::detect::os::x86::detect_features (cyclomatic 23) library/std_detect/src/detect/os/x86.rs:27 — std_detect::detect::os::x86::detect_features has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinkParser · ×2
  • LinkParser::extend (cyclomatic 32) compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:80 — LinkParser::extend has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LinkParser::parse_link_kind (cyclomatic 16) compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:316 — LinkParser::parse_link_kind has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Constructor · ×2
  • Constructor::is_covered_by (cyclomatic 32) compiler/rustc_pattern_analysis/src/constructor.rs:809 — Constructor::is_covered_by has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Constructor::fmt_fields (cyclomatic 22) compiler/rustc_pattern_analysis/src/constructor.rs:889 — Constructor::fmt_fields has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · stdarch_test · ×2
  • stdarch_test::assert (cyclomatic 31) library/stdarch/crates/stdarch-test/src/lib.rs:57 — stdarch_test::assert has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • stdarch_test::disassembly::parse (cyclomatic 19) library/stdarch/crates/stdarch-test/src/disassembly.rs:106 — stdarch_test::disassembly::parse has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TerminatorKind · ×2
  • TerminatorKind::fmt_head (cyclomatic 30) compiler/rustc_middle/src/mir/pretty.rs:990 — TerminatorKind::fmt_head has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TerminatorKind::successors_mut (cyclomatic 18) compiler/rustc_middle/src/mir/terminator.rs:564 — TerminatorKind::successors_mut has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AssertKind::fmt_assert_args (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · libm_macros · ×2
  • libm_macros::validate (cyclomatic 30) library/compiler-builtins/crates/libm-macros/src/lib.rs:140 — libm_macros::validate has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • libm_macros::expand (cyclomatic 17) library/compiler-builtins/crates/libm-macros/src/lib.rs:322 — libm_macros::expand has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: libm_macros::ty_to_tokens (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · stdarch_gen_arm · ×2
  • stdarch_gen_arm::fn_suffix::make_neon_suffix (cyclomatic 30) library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs:71 — stdarch_gen_arm::fn_suffix::make_neon_suffix has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • stdarch_gen_arm::intrinsic::create_tokens (cyclomatic 20) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1691 — stdarch_gen_arm::intrinsic::create_tokens has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnusedDelimLint · ×2
  • UnusedDelimLint::is_expr_delims_necessary (cyclomatic 27) compiler/rustc_lint/src/unused.rs:220 — UnusedDelimLint::is_expr_delims_necessary has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • UnusedDelimLint::check_expr (cyclomatic 20) compiler/rustc_lint/src/unused.rs:445 — UnusedDelimLint::check_expr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Validator · ×2
  • Validator::validate_rvalue (cyclomatic 27) compiler/rustc_mir_transform/src/promote_consts.rs:432 — Validator::validate_rvalue has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Validator::check_item (cyclomatic 26) src/tools/jsondoclint/src/validator.rs:89 — Validator::check_item has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AutoTraitFinder · ×2
  • AutoTraitFinder::evaluate_nested_obligations (cyclomatic 27) compiler/rustc_trait_selection/src/traits/auto_trait.rs:647 — AutoTraitFinder::evaluate_nested_obligations has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AutoTraitFinder::map_vid_to_region (cyclomatic 16) compiler/rustc_trait_selection/src/traits/auto_trait.rs:528 — AutoTraitFinder::map_vid_to_region has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ItemScope · ×2
  • ItemScope::push_res_with_import (cyclomatic 27) src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs:585 — ItemScope::push_res_with_import has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ItemScope::dump (cyclomatic 20) src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs:751 — ItemScope::dump has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TyLoweringContext · ×2
  • TyLoweringContext::lower_dyn_trait (cyclomatic 27) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:1034 — TyLoweringContext::lower_dyn_trait has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TyLoweringContext::lower_ty_ext (cyclomatic 22) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:593 — TyLoweringContext::lower_ty_ext has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Module · ×2
  • Module::process_def_in_sel (cyclomatic 27) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:551 — Module::process_def_in_sel has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Module::get_usages_and_record_fields (cyclomatic 23) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs:276 — Module::get_usages_and_record_fields has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Reader · ×2
  • Reader::read_tokenstream (cyclomatic 27) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:861 — Reader::read_tokenstream has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Reader::read_subtree (cyclomatic 22) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:753 — Reader::read_subtree has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_borrowck · ×2
  • rustc_borrowck::places_conflict::place_projection_conflict (cyclomatic 26) compiler/rustc_borrowck/src/places_conflict.rs:298 — rustc_borrowck::places_conflict::place_projection_conflict has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_borrowck::diagnostics::bound_region_errors::try_extract_error_from_region_constraints (cyclomatic 18) compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs:388 — rustc_borrowck::diagnostics::bound_region_errors::try_extract_error_from_region_constraints has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConfigInfo · ×2
  • ConfigInfo::setup (cyclomatic 26) compiler/rustc_codegen_gcc/build_system/src/config.rs:354 — ConfigInfo::setup has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ConfigInfo::parse_argument (cyclomatic 21) compiler/rustc_codegen_gcc/build_system/src/config.rs:153 — ConfigInfo::parse_argument has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MoveDataBuilder · ×2
  • MoveDataBuilder::move_path_for (cyclomatic 26) compiler/rustc_mir_dataflow/src/move_paths/builder.rs:107 — MoveDataBuilder::move_path_for has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MoveDataBuilder::gather_terminator (cyclomatic 17) compiler/rustc_mir_dataflow/src/move_paths/builder.rs:448 — MoveDataBuilder::gather_terminator has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Stripper · ×2
  • Stripper::fold_item (cyclomatic 26) src/librustdoc/passes/stripper.rs:41 — Stripper::fold_item has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Stripper::fold_item (cyclomatic 20) src/librustdoc/passes/strip_hidden.rs:85 — Stripper::fold_item has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RustdocVisitor · ×2
  • RustdocVisitor::maybe_inline_local (cyclomatic 26) src/librustdoc/visit_ast.rs:253 — RustdocVisitor::maybe_inline_local has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • RustdocVisitor::visit_item_inner (cyclomatic 22) src/librustdoc/visit_ast.rs:467 — RustdocVisitor::visit_item_inner has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Visitor · ×2
  • Visitor::super_rvalue (cyclomatic 25) compiler/rustc_middle/src/mir/visit.rs:683 — Visitor::super_rvalue has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (MutVisitor::super_rvalue) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Visitor::super_terminator (cyclomatic 17) compiler/rustc_middle/src/mir/visit.rs:516 — Visitor::super_terminator has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (MutVisitor::super_terminator) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · MutVisitor · ×2
  • MutVisitor::super_rvalue (cyclomatic 25) compiler/rustc_middle/src/mir/visit.rs:683 — MutVisitor::super_rvalue has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Visitor::super_rvalue) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • MutVisitor::super_terminator (cyclomatic 17) compiler/rustc_middle/src/mir/visit.rs:516 — MutVisitor::super_terminator has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (Visitor::super_terminator) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · WrongNumberOfGenericArgs · ×2
  • WrongNumberOfGenericArgs::suggest_removing_args_or_generics (cyclomatic 24) compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs:912 — WrongNumberOfGenericArgs::suggest_removing_args_or_generics has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • WrongNumberOfGenericArgs::get_lifetime_args_suggestions_from_param_names (cyclomatic 18) compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs:333 — WrongNumberOfGenericArgs::get_lifetime_args_suggestions_from_param_names has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_passes · ×2
  • rustc_passes::stability::check_unused_or_stable_features (cyclomatic 24) compiler/rustc_passes/src/stability.rs:1159 — rustc_passes::stability::check_unused_or_stable_features has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_passes::dead::lint_dead_codes (cyclomatic 18) compiler/rustc_passes/src/dead.rs:1479 — rustc_passes::dead::lint_dead_codes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TagParser · ×2
  • TagParser::extract_opening_tag (cyclomatic 24) src/librustdoc/passes/lint/html_tags.rs:596 — TagParser::extract_opening_tag has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TagParser::extract_html_tag (cyclomatic 18) src/librustdoc/passes/lint/html_tags.rs:527 — TagParser::extract_html_tag has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rustdoc::passes::lint::html_tags::markdown_tag_name (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoanInvalidationsGenerator · ×2
  • LoanInvalidationsGenerator::visit_terminator (cyclomatic 23) compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:94 — LoanInvalidationsGenerator::visit_terminator has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LoanInvalidationsGenerator::consume_rvalue (cyclomatic 17) compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:246 — LoanInvalidationsGenerator::consume_rvalue has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GccLinker · ×2
  • GccLinker::export_symbols (cyclomatic 23) compiler/rustc_codegen_ssa/src/back/linker.rs:790 — GccLinker::export_symbols has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • GccLinker::set_output_kind (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/linker.rs:513 — GccLinker::set_output_kind has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CoerceMany · ×2
  • CoerceMany::coerce_inner (cyclomatic 23) compiler/rustc_hir_typeck/src/coercion.rs:1673 — CoerceMany::coerce_inner has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CoerceMany::report_return_mismatched_types (cyclomatic 17) compiler/rustc_hir_typeck/src/coercion.rs:2005 — CoerceMany::report_return_mismatched_types has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TOFinder · ×2
  • TOFinder::process_assign (cyclomatic 23) compiler/rustc_mir_transform/src/jump_threading.rs:499 — TOFinder::process_assign has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TOFinder::process_switch_int (cyclomatic 18) compiler/rustc_mir_transform/src/jump_threading.rs:680 — TOFinder::process_switch_int has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArbitrarySourceItemOrdering · ×2
  • ArbitrarySourceItemOrdering::check_item (cyclomatic 23) src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs:396 — ArbitrarySourceItemOrdering::check_item has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ArbitrarySourceItemOrdering::check_mod (cyclomatic 18) src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs:489 — ArbitrarySourceItemOrdering::check_mod has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VarVisitor · ×2
  • VarVisitor::visit_expr (cyclomatic 23) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:369 — VarVisitor::visit_expr has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • VarVisitor::check (cyclomatic 16) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:260 — VarVisitor::check has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrirodaContext · ×2
  • PrirodaContext::render_source_shaped_op_inner (cyclomatic 22) src/tools/miri/priroda/src/debugger.rs:655 — PrirodaContext::render_source_shaped_op_inner has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PrirodaContext::resume (cyclomatic 19) src/tools/miri/priroda/src/debugger.rs:318 — PrirodaContext::resume has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CheckAttrVisitor · ×2
  • CheckAttrVisitor::check_repr (cyclomatic 21) compiler/rustc_passes/src/check_attr.rs:1014 — CheckAttrVisitor::check_repr has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: CheckAttrVisitor::check_one_parsed_attribute (cyclomatic 194) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • CheckAttrVisitor::check_proc_macro (cyclomatic 17) compiler/rustc_passes/src/check_attr.rs:1153 — CheckAttrVisitor::check_proc_macro has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: CheckAttrVisitor::check_one_parsed_attribute (cyclomatic 194) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Sysroot · ×2
  • Sysroot::run (cyclomatic 21) src/bootstrap/src/core/build_steps/compile.rs:1944 — Sysroot::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Sysroot::load_workspace (cyclomatic 17) src/tools/rust-analyzer/crates/project-model/src/sysroot.rs:249 — Sysroot::load_workspace has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FlycheckActor · ×2
  • FlycheckActor::run (cyclomatic 21) src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:579 — FlycheckActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FlycheckActor::check_command (cyclomatic 16) src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:884 — FlycheckActor::check_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodegenCx · ×2
  • CodegenCx::codegen_static_item (cyclomatic 20) compiler/rustc_codegen_llvm/src/consts.rs:474 — CodegenCx::codegen_static_item has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • CodegenCx::get_static_inner (cyclomatic 17) compiler/rustc_codegen_llvm/src/consts.rs:367 — CodegenCx::get_static_inner has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · syntax · ×2
  • syntax::validation::validate_literal (cyclomatic 20) src/tools/rust-analyzer/crates/syntax/src/validation.rs:124 — syntax::validation::validate_literal has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: syntax::validation::rustc_unescape_error_to_string (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • syntax::ast::prec::precedence (cyclomatic 19) src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs:73 — syntax::ast::prec::precedence has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Expr::is_ordered_before_parent_in_place_of::order (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Collector · ×2
  • Collector::build_dll_import (cyclomatic 19) compiler/rustc_metadata/src/native_libs.rs:229 — Collector::build_dll_import has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Collector::process_command_line (cyclomatic 16) compiler/rustc_metadata/src/native_libs.rs:116 — Collector::process_command_line has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_pattern_analysis · ×2
  • rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness (cyclomatic 19) compiler/rustc_pattern_analysis/src/usefulness.rs:1698 — rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_pattern_analysis::rustc::print::write_struct_like (cyclomatic 16) compiler/rustc_pattern_analysis/src/rustc/print.rs:46 — rustc_pattern_analysis::rustc::print::write_struct_like has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Intrinsic · ×2
  • Intrinsic::generate_big_endian (cyclomatic 19) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1061 — Intrinsic::generate_big_endian has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Intrinsic::defer_to_existing_llvm_link (cyclomatic 18) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1549 — Intrinsic::defer_to_existing_llvm_link has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinkCollector · ×2
  • LinkCollector::resolve_links (cyclomatic 19) src/librustdoc/passes/collect_intra_doc_links.rs:1075 — LinkCollector::resolve_links has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rustdoc::passes::collect_intra_doc_links::resolve_primitive (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • LinkCollector::resolve_with_disambiguator_cached (cyclomatic 16) src/librustdoc/passes/collect_intra_doc_links.rs:1547 — LinkCollector::resolve_with_disambiguator_cached has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: rustdoc::passes::collect_intra_doc_links::resolve_primitive (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Node · ×2
  • Node::trim_clone (cyclomatic 19) src/tools/generate-copyright/src/main.rs:139 — Node::trim_clone has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Node::ty (cyclomatic 16) compiler/rustc_hir/src/hir.rs:5101 — Node::ty has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: PrimTy::from_name (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Writer · ×2
  • Writer::subtree (cyclomatic 19) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:503 — Writer::subtree has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::group (cyclomatic 19) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:641 — Writer::group has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_hir_typeck · ×2
  • rustc_hir_typeck::extend_err_with_const_context (cyclomatic 18) compiler/rustc_hir_typeck/src/lib.rs:279 — rustc_hir_typeck::extend_err_with_const_context has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rustc_hir_typeck::op::is_builtin_binop (cyclomatic 16) compiler/rustc_hir_typeck/src/op.rs:1325 — rustc_hir_typeck::op::is_builtin_binop has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: rustc_hir_typeck::op::lang_item_for_binop (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rustc_next_trait_solver · ×2
  • rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_callable (cyclomatic 18) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:277 — rustc_next_trait_solver::solve::assembly::structural_traits::extract_tupled_inputs_and_output_from_callable has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • rustc_next_trait_solver::solve::eval_ctxt::should_rerun_after_erased_canonicalization (cyclomatic 16) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1919 — rustc_next_trait_solver::solve::eval_ctxt::should_rerun_after_erased_canonicalization has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BestObligation · ×2
  • BestObligation::visit_goal (cyclomatic 18) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/errors.rs:535 — BestObligation::visit_goal has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • BestObligation::visit_goal (cyclomatic 17) compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs:424 — BestObligation::visit_goal has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PathLoweringContext · ×2
  • PathLoweringContext::substs_from_args_and_bindings (cyclomatic 17) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:678 — PathLoweringContext::substs_from_args_and_bindings has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PathLoweringContext::resolve_path_in_value_ns (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:383 — PathLoweringContext::resolve_path_in_value_ns has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CStore · ×2
  • CStore::report_target_modifiers_extended (cyclomatic 16) compiler/rustc_metadata/src/creader.rs:347 — CStore::report_target_modifiers_extended has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CStore::inject_allocator_crate (cyclomatic 16) compiler/rustc_metadata/src/creader.rs:1102 — CStore::inject_allocator_crate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TwoWaySearcher · ×2
  • TwoWaySearcher::next (cyclomatic 16) library/core/src/str/pattern.rs:1541 — TwoWaySearcher::next has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (TwoWaySearcher::next_back) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • TwoWaySearcher::next_back (cyclomatic 16) library/core/src/str/pattern.rs:1636 — TwoWaySearcher::next_back has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (TwoWaySearcher::next) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · WorkspaceBuildScripts · ×2
  • WorkspaceBuildScripts::run_command (cyclomatic 16) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:328 — WorkspaceBuildScripts::run_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • WorkspaceBuildScripts::build_command (cyclomatic 16) src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs:435 — WorkspaceBuildScripts::build_command has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · xtask · ×2
  • xtask::codegen::lints::generate_lint_descriptor (cyclomatic 16) src/tools/rust-analyzer/xtask/src/codegen/lints.rs:167 — xtask::codegen::lints::generate_lint_descriptor has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • xtask::publish::notes::get_next_line_component (cyclomatic 16) src/tools/rust-analyzer/xtask/src/publish/notes.rs:479 — xtask::publish::notes::get_next_line_component has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · FixmeComment repeated across 14 files · ×2
  • FixmeComment repeated across 14 files tests/ui/sanitizer/cfi/async-closures.rs:5 — The identical FixmeComment appears in 14 files (14 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 14 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(#122848) Remove only-linux once OSX CFI binaries work". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
  • FixmeComment repeated across 14 files tests/ui/feature-gates/feature-gate-fn_align.rs:5 — The identical FixmeComment appears in 14 files (14 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 14 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · FnCallDiagCtxt · ×2
  • FnCallDiagCtxt::labels_and_suggestion_text (cognitive 120) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2612 — FnCallDiagCtxt::labels_and_suggestion_text has cognitive complexity 120 (threshold 15). Drivers by points: if/else 30 (77 pts), match/switch 11 (31 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 71). Of this number, 119 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FnCallDiagCtxt::check_wrap_args_in_tuple (cognitive 23) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2308 — FnCallDiagCtxt::check_wrap_args_in_tuple has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Install · ×2
  • Install::merge (cognitive 112) src/bootstrap/src/core/config/toml/install.rs:11 — Install::merge has cognitive complexity 112 (threshold 15). Drivers by points: if/else 49 (105 pts), match/switch 7 (nesting depth added 56). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Install::deserialize (cognitive 35) src/bootstrap/src/core/config/toml/install.rs:11 — Install::deserialize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 9 (13 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnnotateSnippetEmitter · ×2
  • AnnotateSnippetEmitter::emit_messages_default (cognitive 107) compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:159 — AnnotateSnippetEmitter::emit_messages_default has cognitive complexity 107 (threshold 15). Drivers by points: if/else 40 (92 pts), loops 5 (9 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnnotateSnippetEmitter::unannotated_messages (cognitive 21) compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:581 — AnnotateSnippetEmitter::unannotated_messages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceAnalyzer · ×2
  • SourceAnalyzer::resolve_path (cognitive 99) src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:1158 — SourceAnalyzer::resolve_path has cognitive complexity 99 (threshold 15). Drivers by points: if/else 30 (67 pts), match/switch 8 (23 pts), loops 1 (6 pts), boolean chains 3 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • SourceAnalyzer::resolve_offset_of_field (cognitive 16) src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:1084 — SourceAnalyzer::resolve_offset_of_field has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 2 (4 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FindUsages · ×2
  • FindUsages::search (cognitive 98) src/tools/rust-analyzer/crates/ide-db/src/search.rs:929 — FindUsages::search has cognitive complexity 98 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 12 (36 pts), match/switch 8 (17 pts), boolean chains 1 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FindUsages::short_associated_function_fast_search::collect_possible_aliases (cognitive 97) src/tools/rust-analyzer/crates/ide-db/src/search.rs:654 — FindUsages::short_associated_function_fast_search::collect_possible_aliases has cognitive complexity 97 (threshold 15). Drivers by points: if/else 15 (73 pts), loops 6 (20 pts), boolean chains 4 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Pgo · ×2
  • Pgo::merge (cognitive 96) src/bootstrap/src/core/config/toml/pgo.rs:23 — Pgo::merge has cognitive complexity 96 (threshold 15). Drivers by points: if/else 42 (90 pts), match/switch 6 (nesting depth added 48). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Pgo::deserialize (cognitive 31) src/bootstrap/src/core/config/toml/pgo.rs:23 — Pgo::deserialize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 8 (12 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SerializedSearchIndex · ×2
  • SerializedSearchIndex::union (cognitive 91) REDACTED:314 — SerializedSearchIndex::union has cognitive complexity 91 (threshold 15). Drivers by points: loops 19 (62 pts), if/else 10 (16 pts), match/switch 4 (13 pts) (nesting depth added 58). Of this number, 71 points are the body's own statements and 20 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • SerializedSearchIndex::sort (cognitive 40) REDACTED:596 — SerializedSearchIndex::sort has cognitive complexity 40 (threshold 15). Drivers by points: loops 11 (25 pts), if/else 5 (9 pts), match/switch 2 (6 pts) (nesting depth added 22). Of this number, 20 points are the body's own statements and 20 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Dereferencing · ×2
  • Dereferencing::check_expr (cognitive 91) src/tools/clippy/clippy_lints/src/dereference.rs:242 — Dereferencing::check_expr has cognitive complexity 91 (threshold 15). Drivers by points: if/else 32 (61 pts), boolean chains 17, match/switch 4 (10 pts), loops 1 (3 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Dereferencing::report (cognitive 66) src/tools/clippy/clippy_lints/src/dereference.rs:1095 — Dereferencing::report has cognitive complexity 66 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 13, match/switch 6 (13 pts) (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_ast_passes · ×2
  • rustc_ast_passes::feature_gate::check_crate (cognitive 89) compiler/rustc_ast_passes/src/feature_gate.rs:409 — rustc_ast_passes::feature_gate::check_crate has cognitive complexity 89 (threshold 15). Drivers by points: loops 53 (55 pts), if/else 13 (25 pts), boolean chains 9 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • rustc_ast_passes::ast_validation::validate_generic_param_order (cognitive 19) compiler/rustc_ast_passes/src/ast_validation.rs:1354 — rustc_ast_passes::ast_validation::validate_generic_param_order has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 3 (7 pts), loops 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MacroExpander · ×2
  • MacroExpander::expand_invoc (cognitive 89) compiler/rustc_expand/src/expand.rs:700 — MacroExpander::expand_invoc has cognitive complexity 89 (threshold 15). Drivers by points: if/else 21 (51 pts), match/switch 14 (36 pts), boolean chains 2 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MacroExpander::fully_expand_fragment (cognitive 31) compiler/rustc_expand/src/expand.rs:471 — MacroExpander::fully_expand_fragment has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CfgChecker · ×2
  • CfgChecker::visit_terminator (cognitive 70) compiler/rustc_mir_transform/src/validate.rs:340 — CfgChecker::visit_terminator has cognitive complexity 70 (threshold 15). Drivers by points: if/else 23 (58 pts), loops 3 (6 pts), boolean chains 5, match/switch 1 (nesting depth added 38). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • CfgChecker::check_cleanup_control_flow (cognitive 28) compiler/rustc_mir_transform/src/validate.rs:168 — CfgChecker::check_cleanup_control_flow has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 6 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnsafetyVisitor · ×2
  • UnsafetyVisitor::visit_expr (cognitive 68) compiler/rustc_mir_build/src/check_unsafety.rs:343 — UnsafetyVisitor::visit_expr has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (48 pts), match/switch 5 (11 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 35). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • UnsafetyVisitor::visit_pat (cognitive 35) compiler/rustc_mir_build/src/check_unsafety.rs:252 — UnsafetyVisitor::visit_pat has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 3 (6 pts), loops 2 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NotifyActor · ×2
  • NotifyActor::run (cognitive 63) src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs:99 — NotifyActor::run has cognitive complexity 63 (threshold 15). Drivers by points: if/else 9 (36 pts), loops 4 (13 pts), match/switch 3 (10 pts), boolean chains 4 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NotifyActor::load_entry (cognitive 24) src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs:280 — NotifyActor::load_entry has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConstAnalysis · ×2
  • ConstAnalysis::handle_assign (cognitive 56) compiler/rustc_mir_transform/src/dataflow_const_prop.rs:268 — ConstAnalysis::handle_assign has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (43 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConstAnalysis::binary_op (cognitive 16) compiler/rustc_mir_transform/src/dataflow_const_prop.rs:564 — ConstAnalysis::binary_op has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FlycheckActor · ×2
  • FlycheckActor::run (cognitive 56) src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:579 — FlycheckActor::run has cognitive complexity 56 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 6 (19 pts), loops 3 (9 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FlycheckActor::check_command (cognitive 25) src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:884 — FlycheckActor::check_command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · libm_macros · ×2
  • libm_macros::validate (cognitive 54) library/compiler-builtins/crates/libm-macros/src/lib.rs:140 — libm_macros::validate has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 8 (15 pts), boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • libm_macros::expand (cognitive 18) library/compiler-builtins/crates/libm-macros/src/lib.rs:322 — libm_macros::expand has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (7 pts), if/else 3 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MoveDataBuilder · ×2
  • MoveDataBuilder::move_path_for (cognitive 51) compiler/rustc_mir_dataflow/src/move_paths/builder.rs:107 — MoveDataBuilder::move_path_for has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (27 pts), match/switch 6 (20 pts), loops 2 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MoveDataBuilder::gather_terminator (cognitive 20) compiler/rustc_mir_dataflow/src/move_paths/builder.rs:448 — MoveDataBuilder::gather_terminator has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ItemScope · ×2
  • ItemScope::push_res_with_import (cognitive 51) src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs:585 — ItemScope::push_res_with_import has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 7 (14 pts), boolean chains 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ItemScope::dump (cognitive 24) src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs:751 — ItemScope::dump has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (9 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TyLoweringContext · ×2
  • TyLoweringContext::lower_dyn_trait (cognitive 50) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:1034 — TyLoweringContext::lower_dyn_trait has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 5 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TyLoweringContext::lower_ty_ext (cognitive 20) src/tools/rust-analyzer/crates/hir-ty/src/lower.rs:593 — TyLoweringContext::lower_ty_ext has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GetOptsOptions · ×2
  • GetOptsOptions::from_matches (cognitive 50) src/tools/rustfmt/src/bin/main.rs:564 — GetOptsOptions::from_matches has cognitive complexity 50 (threshold 15). Drivers by points: if/else 29 (46 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GetOptsOptions::apply_to (cognitive 17) src/tools/rustfmt/src/bin/main.rs:711 — GetOptsOptions::apply_to has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rustc_ast_pretty · ×2
  • rustc_ast_pretty::pprust::state::expr::reconstruct_format_args_template_string (cognitive 49) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:975 — rustc_ast_pretty::pprust::state::expr::reconstruct_format_args_template_string has cognitive complexity 49 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 7 (22 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_ast_pretty::pprust::state::gather_comments (cognitive 26) compiler/rustc_ast_pretty/src/pprust/state.rs:103 — rustc_ast_pretty::pprust::state::gather_comments has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (6 pts), loops 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · std_detect · ×2
  • std_detect::detect::os::riscv::imply_features (cognitive 49) library/std_detect/src/detect/os/riscv.rs:21 — std_detect::detect::os::riscv::imply_features has cognitive complexity 49 (threshold 15). Drivers by points: if/else 31 (48 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • std_detect::detect::os::x86::detect_features (cognitive 49) library/std_detect/src/detect/os/x86.rs:27 — std_detect::detect::os::x86::detect_features has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (45 pts), boolean chains 4 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SpanlessHash · ×2
  • SpanlessHash::hash_expr (cognitive 47) src/tools/clippy/clippy_utils/src/hir_utils.rs:1182 — SpanlessHash::hash_expr has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 5 (10 pts), match/switch 3 (7 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SpanlessHash::hash_pat (cognitive 23) src/tools/clippy/clippy_utils/src/hir_utils.rs:1462 — SpanlessHash::hash_pat has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 5 (10 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OperandRef · ×2
  • OperandRef::codegen_get_discr (cognitive 42) compiler/rustc_codegen_ssa/src/mir/operand.rs:458 — OperandRef::codegen_get_discr has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (33 pts), match/switch 5 (7 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OperandRef::extract_field (cognitive 20) compiler/rustc_codegen_ssa/src/mir/operand.rs:383 — OperandRef::extract_field has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnwindContext · ×2
  • UnwindContext::add_function (cognitive 41) compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs:117 — UnwindContext::add_function has cognitive complexity 41 (threshold 15). Drivers by points: match/switch 4 (16 pts), if/else 6 (14 pts), loops 3 (10 pts), boolean chains 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UnwindContext::new (cognitive 18) compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs:28 — UnwindContext::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GccLinker · ×2
  • GccLinker::export_symbols (cognitive 41) compiler/rustc_codegen_ssa/src/back/linker.rs:790 — GccLinker::export_symbols has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 5 (11 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GccLinker::set_output_kind (cognitive 16) compiler/rustc_codegen_ssa/src/back/linker.rs:513 — GccLinker::set_output_kind has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WrongNumberOfGenericArgs · ×2
  • WrongNumberOfGenericArgs::suggest_removing_args_or_generics (cognitive 41) compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs:912 — WrongNumberOfGenericArgs::suggest_removing_args_or_generics has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WrongNumberOfGenericArgs::get_lifetime_args_suggestions_from_param_names (cognitive 28) compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs:333 — WrongNumberOfGenericArgs::get_lifetime_args_suggestions_from_param_names has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Converter · ×2
  • Converter::extend_literal (cognitive 41) src/tools/rust-analyzer/crates/parser/src/lexed_str.rs:329 — Converter::extend_literal has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Converter::next_token (cognitive 21) src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs:663 — Converter::next_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArArchiveBuilder · ×2
  • ArArchiveBuilder::build_inner (cognitive 40) compiler/rustc_codegen_ssa/src/back/archive.rs:571 — ArArchiveBuilder::build_inner has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 4 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArArchiveBuilder::add_archive (cognitive 20) compiler/rustc_codegen_ssa/src/back/archive.rs:469 — ArArchiveBuilder::add_archive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Sysroot · ×2
  • Sysroot::load_workspace (cognitive 40) src/tools/rust-analyzer/crates/project-model/src/sysroot.rs:249 — Sysroot::load_workspace has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (11 pts), match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Sysroot::run (cognitive 36) src/bootstrap/src/core/build_steps/compile.rs:1944 — Sysroot::run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TerminatorCodegenHelper · ×2
  • TerminatorCodegenHelper::do_call (cognitive 39) compiler/rustc_codegen_ssa/src/mir/block.rs:170 — TerminatorCodegenHelper::do_call has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (29 pts), loops 2 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TerminatorCodegenHelper::do_inlineasm (cognitive 16) compiler/rustc_codegen_ssa/src/mir/block.rs:336 — TerminatorCodegenHelper::do_inlineasm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sembr · ×2
  • sembr::reformat (cognitive 39) src/doc/rustc-dev-guide/ci/sembr/src/main.rs:138 — sembr::reformat has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sembr::main (cognitive 16) src/doc/rustc-dev-guide/ci/sembr/src/main.rs:35 — sembr::main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TOFinder · ×2
  • TOFinder::process_switch_int (cognitive 37) compiler/rustc_mir_transform/src/jump_threading.rs:680 — TOFinder::process_switch_int has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (7 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TOFinder::process_assign (cognitive 33) compiler/rustc_mir_transform/src/jump_threading.rs:499 — TOFinder::process_assign has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TwoWaySearcher · ×2
  • TwoWaySearcher::next (cognitive 37) library/core/src/str/pattern.rs:1541 — TwoWaySearcher::next has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TwoWaySearcher::next_back) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • TwoWaySearcher::next_back (cognitive 37) library/core/src/str/pattern.rs:1636 — TwoWaySearcher::next_back has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TwoWaySearcher::next) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ArbitrarySourceItemOrdering · ×2
  • ArbitrarySourceItemOrdering::check_item (cognitive 37) src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs:396 — ArbitrarySourceItemOrdering::check_item has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (6 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArbitrarySourceItemOrdering::check_mod (cognitive 32) src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs:489 — ArbitrarySourceItemOrdering::check_mod has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Pat · ×2
  • Pat::hir_fmt (cognitive 36) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check.rs:306 — Pat::hir_fmt has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (11 pts), boolean chains 2 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Pat::rewrite_result (cognitive 30) src/tools/rustfmt/src/patterns.rs:85 — Pat::rewrite_result has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 6 (11 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ConstToPat · ×2
  • ConstToPat::valtree_to_pat (cognitive 35) compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:244 — ConstToPat::valtree_to_pat has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 4 (8 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConstToPat::alias_to_pat (cognitive 28) compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:100 — ConstToPat::alias_to_pat has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Stripper · ×2
  • Stripper::fold_item (cognitive 35) src/librustdoc/passes/strip_hidden.rs:85 — Stripper::fold_item has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 3, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Stripper::fold_item (cognitive 18) src/librustdoc/passes/stripper.rs:41 — Stripper::fold_item has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefMap · ×2
  • DefMap::resolve_remaining_segments (cognitive 35) src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs:448 — DefMap::resolve_remaining_segments has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (14 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DefMap::resolve_path_fp_with_macro_single (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs:242 — DefMap::resolve_path_fp_with_macro_single has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Reader · ×2
  • Reader::read_tokenstream (cognitive 35) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:861 — Reader::read_tokenstream has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 4 (11 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Reader::read_subtree (cognitive 33) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:753 — Reader::read_subtree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_incremental · ×2
  • rustc_incremental::persist::fs::garbage_collect_session_directories (cognitive 34) compiler/rustc_incremental/src/persist/fs.rs:555 — rustc_incremental::persist::fs::garbage_collect_session_directories has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (28 pts), loops 3, match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_incremental::persist::load::load_dep_graph (cognitive 23) compiler/rustc_incremental/src/persist/load.rs:35 — rustc_incremental::persist::load::load_dep_graph has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NonCopyConst · ×2
  • NonCopyConst::is_non_freeze_val_borrowed (cognitive 34) src/tools/clippy/clippy_lints/src/non_copy_const.rs:487 — NonCopyConst::is_non_freeze_val_borrowed has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 2 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NonCopyConst::is_non_freeze_init_borrowed (cognitive 33) src/tools/clippy/clippy_lints/src/non_copy_const.rs:568 — NonCopyConst::is_non_freeze_init_borrowed has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PrirodaContext · ×2
  • PrirodaContext::render_source_shaped_op_inner (cognitive 34) src/tools/miri/priroda/src/debugger.rs:655 — PrirodaContext::render_source_shaped_op_inner has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PrirodaContext::resume (cognitive 30) src/tools/miri/priroda/src/debugger.rs:318 — PrirodaContext::resume has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 5, match/switch 2 (5 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Definition · ×2
  • Definition::search_scope (cognitive 34) src/tools/rust-analyzer/crates/ide-db/src/search.rs:290 — Definition::search_scope has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 15 (25 pts), if/else 8, boolean chains 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Definition::range_for_rename (cognitive 18) src/tools/rust-analyzer/crates/ide-db/src/rename.rs:136 — Definition::range_for_rename has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (15 pts), if/else 2 (3 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Gcc · ×2
  • Gcc::merge (cognitive 32) src/bootstrap/src/core/config/toml/gcc.rs:11 — Gcc::merge has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 2 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Gcc::deserialize (cognitive 17) src/bootstrap/src/core/config/toml/gcc.rs:11 — Gcc::deserialize has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Collector · ×2
  • Collector::process_command_line (cognitive 31) compiler/rustc_metadata/src/native_libs.rs:116 — Collector::process_command_line has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 1 (4 pts), boolean chains 2, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Collector::build_dll_import (cognitive 24) compiler/rustc_metadata/src/native_libs.rs:229 — Collector::build_dll_import has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ConfigInfo · ×2
  • ConfigInfo::setup (cognitive 30) compiler/rustc_codegen_gcc/build_system/src/config.rs:354 — ConfigInfo::setup has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 6 (7 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ConfigInfo::parse_argument (cognitive 19) compiler/rustc_codegen_gcc/build_system/src/config.rs:153 — ConfigInfo::parse_argument has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 4 (6 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Classifier · ×2
  • Classifier::advance (cognitive 30) src/librustdoc/html/highlight.rs:1060 — Classifier::advance has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 5 (11 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Classifier::get_full_ident_path (cognitive 20) src/librustdoc/html/highlight.rs:984 — Classifier::get_full_ident_path has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NeedlessLateInit · ×2
  • NeedlessLateInit::check_if_or_match (cognitive 30) src/tools/clippy/clippy_lints/src/needless_late_init.rs:81 — NeedlessLateInit::check_if_or_match has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NeedlessLateInit::check_block_post (cognitive 26) src/tools/clippy/clippy_lints/src/needless_late_init.rs:446 — NeedlessLateInit::check_block_post has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · y · ×2
  • y::utils::split_args (cognitive 29) compiler/rustc_codegen_gcc/build_system/src/utils.rs:371 — y::utils::split_args has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • y::main (cognitive 19) compiler/rustc_codegen_cranelift/build_system/main.rs:52 — y::main has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 6 (7 pts), loops 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · UdpSocket · ×2
  • UdpSocket::send_to (cognitive 29) library/std/src/sys/net/connection/xous/udp.rs:225 — UdpSocket::send_to has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UdpSocket::recv_inner (cognitive 22) library/std/src/sys/net/connection/xous/udp.rs:121 — UdpSocket::recv_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stdarch_gen_arm · ×2
  • stdarch_gen_arm::intrinsic::create_tokens (cognitive 29) library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs:1691 — stdarch_gen_arm::intrinsic::create_tokens has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 3 (6 pts), match/switch 3, boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • stdarch_gen_arm::fn_suffix::make_neon_suffix (cognitive 23) library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs:71 — stdarch_gen_arm::fn_suffix::make_neon_suffix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 2 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_errors · ×2
  • rustc_errors::emitter::detect_confusion_type (cognitive 28) compiler/rustc_errors/src/emitter.rs:610 — rustc_errors::emitter::detect_confusion_type has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts), match/switch 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rustc_errors::annotate_snippet_emitter_writer::collect_annotations (cognitive 17) compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:680 — rustc_errors::annotate_snippet_emitter_writer::collect_annotations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DropCtxt · ×2
  • DropCtxt::open_drop_for_multivariant (cognitive 28) compiler/rustc_mir_transform/src/elaborate_drop.rs:1073 — DropCtxt::open_drop_for_multivariant has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DropCtxt::open_drop_for_array (cognitive 20) compiler/rustc_mir_transform/src/elaborate_drop.rs:1337 — DropCtxt::open_drop_for_array has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FunctionItemRefChecker · ×2
  • FunctionItemRefChecker::check_bound_args (cognitive 28) compiler/rustc_mir_transform/src/function_item_references.rs:71 — FunctionItemRefChecker::check_bound_args has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (20 pts), loops 3 (8 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • FunctionItemRefChecker::visit_terminator (cognitive 16) compiler/rustc_mir_transform/src/function_item_references.rs:30 — FunctionItemRefChecker::visit_terminator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 1 (4 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SolverContext · ×2
  • SolverContext::compute_goal_fast_path (cognitive 28) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/solver.rs:285 — SolverContext::compute_goal_fast_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SolverContext::fetch_eligible_assoc_item (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/solver.rs:176 — SolverContext::fetch_eligible_assoc_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatchVisitor · ×2
  • MatchVisitor::check_match (cognitive 27) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:495 — MatchVisitor::check_match has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MatchVisitor::check_binding_is_irrefutable (cognitive 16) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:657 — MatchVisitor::check_binding_is_irrefutable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · V0SymbolMangler · ×2
  • V0SymbolMangler::print_type (cognitive 27) compiler/rustc_symbol_mangling/src/v0.rs:496 — V0SymbolMangler::print_type has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 5 (7 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • V0SymbolMangler::print_const (cognitive 26) compiler/rustc_symbol_mangling/src/v0.rs:743 — V0SymbolMangler::print_const has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 6 (10 pts), loops 4 (9 pts), if/else 4 (7 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VarVisitor · ×2
  • VarVisitor::visit_expr (cognitive 27) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:369 — VarVisitor::visit_expr has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 8, loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • VarVisitor::check (cognitive 25) src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs:260 — VarVisitor::check has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Writer · ×2
  • Writer::subtree (cognitive 27) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:503 — Writer::subtree has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 3 (9 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::group (cognitive 19) src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs:641 — Writer::group has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionInferenceContextInner · ×2
  • RegionInferenceContextInner::find_constraint_path_between_regions_inner (cognitive 26) compiler/rustc_borrowck/src/region_infer/region_context.rs:446 — RegionInferenceContextInner::find_constraint_path_between_regions_inner has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (10 pts), match/switch 2 (8 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionInferenceContextInner::best_blame_constraint (cognitive 21) compiler/rustc_borrowck/src/region_infer/region_context.rs:594 — RegionInferenceContextInner::best_blame_constraint has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 6, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ThirPrinter · ×2
  • ThirPrinter::print_pat_kind (cognitive 26) compiler/rustc_mir_build/src/thir/print.rs:721 — ThirPrinter::print_pat_kind has cognitive complexity 26 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 6 (10 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ThirPrinter::print_expr_kind (cognitive 21) compiler/rustc_mir_build/src/thir/print.rs:214 — ThirPrinter::print_expr_kind has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 5 (9 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GatherBorrows · ×2
  • GatherBorrows::visit_assign (cognitive 25) compiler/rustc_borrowck/src/borrow_set.rs:421 — GatherBorrows::visit_assign has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GatherBorrows::gather_reborrows (cognitive 22) compiler/rustc_borrowck/src/borrow_set.rs:293 — GatherBorrows::gather_reborrows has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkSymbolVisitor · ×2
  • MarkSymbolVisitor::visit_node (cognitive 25) compiler/rustc_passes/src/dead.rs:469 — MarkSymbolVisitor::visit_node has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MarkSymbolVisitor::check_impl_or_impl_item_live (cognitive 20) compiler/rustc_passes/src/dead.rs:559 — MarkSymbolVisitor::check_impl_or_impl_item_live has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tt · ×2
  • tt::transform_tt (cognitive 25) src/tools/rust-analyzer/crates/tt/src/lib.rs:764 — tt::transform_tt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • tt::storage::encode (cognitive 25) src/tools/rust-analyzer/crates/tt/src/storage.rs:332 — tt::storage::encode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (7 pts), boolean chains 4 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Emitter · ×2
  • Emitter::render_multispan_macro_backtrace (cognitive 23) compiler/rustc_errors/src/emitter.rs:261 — Emitter::render_multispan_macro_backtrace has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (4 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Emitter::fix_multispans_in_extern_macros_and_render_macro_backtrace (cognitive 18) compiler/rustc_errors/src/emitter.rs:157 — Emitter::fix_multispans_in_extern_macros_and_render_macro_backtrace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WritebackCx · ×2
  • WritebackCx::fix_scalar_builtin_expr (cognitive 23) compiler/rustc_hir_typeck/src/writeback.rs:152 — WritebackCx::fix_scalar_builtin_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • WritebackCx::visit_opaque_types (cognitive 18) compiler/rustc_hir_typeck/src/writeback.rs:572 — WritebackCx::visit_opaque_types has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RootCollector · ×2
  • RootCollector::process_item (cognitive 23) compiler/rustc_monomorphize/src/collector.rs:1604 — RootCollector::process_item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RootCollector::process_nested_body (cognitive 17) compiler/rustc_monomorphize/src/collector.rs:1700 — RootCollector::process_nested_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · symcheck · ×2
  • symcheck::check_elf_exe_stack (cognitive 23) library/compiler-builtins/crates/symcheck/src/main.rs:808 — symcheck::check_elf_exe_stack has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (5 pts), match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • symcheck::exec_cargo_with_args (cognitive 16) library/compiler-builtins/crates/symcheck/src/main.rs:361 — symcheck::exec_cargo_with_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiriMachine · ×2
  • MiriMachine::extern_static_pointer (cognitive 23) src/tools/miri/src/machine.rs:1470 — MiriMachine::extern_static_pointer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 5, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MiriMachine::before_memory_write (cognitive 16) src/tools/miri/src/machine.rs:1736 — MiriMachine::before_memory_write has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr · ×2
  • Expr::gen_source_code (cognitive 23) src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs:102 — Expr::gen_source_code has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 8 (17 pts), if/else 3 (6 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Expr::needs_parens_in_expr (cognitive 20) src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs:199 — Expr::needs_parens_in_expr has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 7, match/switch 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · UnusedDelimLint · ×2
  • UnusedDelimLint::is_expr_delims_necessary (cognitive 22) compiler/rustc_lint/src/unused.rs:220 — UnusedDelimLint::is_expr_delims_necessary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 4 (8 pts), loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UnusedDelimLint::check_expr (cognitive 16) compiler/rustc_lint/src/unused.rs:445 — UnusedDelimLint::check_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TerminatorKind · ×2
  • TerminatorKind::fmt_head (cognitive 22) compiler/rustc_middle/src/mir/pretty.rs:990 — TerminatorKind::fmt_head has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • TerminatorKind::successors_mut (cognitive 19) compiler/rustc_middle/src/mir/terminator.rs:564 — TerminatorKind::successors_mut has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NeedlessPassByRefMut · ×2
  • NeedlessPassByRefMut::check_fn (cognitive 22) src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs:123 — NeedlessPassByRefMut::check_fn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NeedlessPassByRefMut::check_crate_post (cognitive 18) src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs:258 — NeedlessPassByRefMut::check_crate_post has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimilarNamesNameVisitor · ×2
  • SimilarNamesNameVisitor::check_ident (cognitive 22) src/tools/clippy/clippy_lints/src/non_expressive_names.rs:222 — SimilarNamesNameVisitor::check_ident has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SimilarNamesNameVisitor::equal_length_strs_not_similar (cognitive 17) src/tools/clippy/clippy_lints/src/non_expressive_names.rs:298 — SimilarNamesNameVisitor::equal_length_strs_not_similar has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Visibility · ×2
  • Visibility::max (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/visibility.rs:154 — Visibility::max has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::min) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Visibility::min (cognitive 22) src/tools/rust-analyzer/crates/hir-def/src/visibility.rs:220 — Visibility::min has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (Visibility::max) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FulfillmentCtxt · ×2
  • FulfillmentCtxt::try_evaluate_obligations (cognitive 22) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill.rs:156 — FulfillmentCtxt::try_evaluate_obligations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FulfillmentCtxt::try_evaluate_obligations (cognitive 21) compiler/rustc_trait_selection/src/solve/fulfill.rs:164 — FulfillmentCtxt::try_evaluate_obligations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ObligationForest · ×2
  • ObligationForest::process_obligations (cognitive 21) compiler/rustc_data_structures/src/obligation_forest/mod.rs:433 — ObligationForest::process_obligations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ObligationForest::register_obligation_at (cognitive 16) compiler/rustc_data_structures/src/obligation_forest/mod.rs:347 — ObligationForest::register_obligation_at has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteralDigitGrouping · ×2
  • LiteralDigitGrouping::check_for_mistyped_suffix (cognitive 21) src/tools/clippy/clippy_lints/src/literal_representation.rs:278 — LiteralDigitGrouping::check_for_mistyped_suffix has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • LiteralDigitGrouping::check_lit (cognitive 19) src/tools/clippy/clippy_lints/src/literal_representation.rs:229 — LiteralDigitGrouping::check_lit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnyDiagnostic · ×2
  • AnyDiagnostic::body_validation_diagnostic (cognitive 21) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:1417 — AnyDiagnostic::body_validation_diagnostic has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AnyDiagnostic::inference_diagnostic (cognitive 18) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:1549 — AnyDiagnostic::inference_diagnostic has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 10 (18 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WfCheckingCtxt · ×2
  • WfCheckingCtxt::check_test_binder_region_constraints (cognitive 20) compiler/rustc_hir_analysis/src/check/wfcheck.rs:2547 — WfCheckingCtxt::check_test_binder_region_constraints has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • WfCheckingCtxt::check_test_binder_body (cognitive 17) compiler/rustc_hir_analysis/src/check/wfcheck.rs:2382 — WfCheckingCtxt::check_test_binder_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 5 (6 pts), match/switch 3 (5 pts) (nesting depth added 5). Of this number, 9 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeadVisitor · ×2
  • DeadVisitor::lint_at_single_level (cognitive 20) compiler/rustc_passes/src/dead.rs:1222 — DeadVisitor::lint_at_single_level has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • DeadVisitor::fulfill_dead_code_expectations (cognitive 16) compiler/rustc_passes/src/dead.rs:1167 — DeadVisitor::fulfill_dead_code_expectations has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · LanguageItemCollector · ×2
  • LanguageItemCollector::collect_item (cognitive 20) compiler/rustc_passes/src/lang_items.rs:94 — LanguageItemCollector::collect_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LanguageItemCollector::check_for_lang (cognitive 16) compiler/rustc_passes/src/lang_items.rs:45 — LanguageItemCollector::check_for_lang has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RwLock · ×2
  • RwLock::lock_contended (cognitive 20) library/std/src/sys/sync/rwlock/queue.rs:359 — RwLock::lock_contended has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RwLock::unlock_queue (cognitive 20) library/std/src/sys/sync/rwlock/queue.rs:639 — RwLock::unlock_queue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Std · ×2
  • Std::run (cognitive 20) src/bootstrap/src/core/build_steps/doc.rs:682 — Std::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), match/switch 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Std::run (cognitive 19) src/bootstrap/src/core/build_steps/compile.rs:157 — Std::run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ItemNameRepetitions · ×2
  • ItemNameRepetitions::check_name_repetition (cognitive 20) src/tools/clippy/clippy_lints/src/item_name_repetitions.rs:481 — ItemNameRepetitions::check_name_repetition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ItemNameRepetitions::check_struct_name_repetition (cognitive 16) src/tools/clippy/clippy_lints/src/item_name_repetitions.rs:423 — ItemNameRepetitions::check_struct_name_repetition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConstEvalCtxt · ×2
  • ConstEvalCtxt::binop (cognitive 20) src/tools/clippy/clippy_utils/src/consts.rs:1010 — ConstEvalCtxt::binop has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 7 (14 pts), boolean chains 3, if/else 1 (3 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ConstEvalCtxt::expr (cognitive 18) src/tools/clippy/clippy_utils/src/consts.rs:651 — ConstEvalCtxt::expr has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 4 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · lintcheck · ×2
  • lintcheck::lintcheck (cognitive 20) src/tools/clippy/lintcheck/src/main.rs:316 — lintcheck::lintcheck has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • lintcheck::json::diff (cognitive 18) src/tools/clippy/lintcheck/src/json.rs:126 — lintcheck::json::diff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Canonicalizer · ×2
  • Canonicalizer::fold_ty (cognitive 19) compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:332 — Canonicalizer::fold_ty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Canonicalizer::fold_ty (cognitive 19) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/canonical/canonicalizer.rs:328 — Canonicalizer::fold_ty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Target · ×2
  • Target::from_rustc (cognitive 19) library/compiler-builtins/crates/symcheck/src/main.rs:148 — Target::from_rustc has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 3 (4 pts), loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Target::abi_required_features (cognitive 18) compiler/rustc_target/src/target_features.rs:1290 — Target::abi_required_features has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 10 (18 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ProvenanceMap · ×2
  • ProvenanceMap::read_ptr (cognitive 18) compiler/rustc_middle/src/mir/interpret/allocation/provenance_map.rs:186 — ProvenanceMap::read_ptr has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProvenanceMap::prepare_copy (cognitive 16) compiler/rustc_middle/src/mir/interpret/allocation/provenance_map.rs:380 — ProvenanceMap::prepare_copy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_span · ×2
  • rustc_span::edit_distance::edit_distance (cognitive 18) compiler/rustc_span/src/edit_distance.rs:24 — rustc_span::edit_distance::edit_distance has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rustc_span::edit_distance::find_best_match_for_name_impl (cognitive 18) compiler/rustc_span/src/edit_distance.rs:203 — rustc_span::edit_distance::find_best_match_for_name_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FetchMetadata · ×2
  • FetchMetadata::new (cognitive 18) src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs:614 — FetchMetadata::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FetchMetadata::exec (cognitive 16) src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs:722 — FetchMetadata::exec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InferenceFudger · ×2
  • InferenceFudger::fold_ty (cognitive 17) compiler/rustc_infer/src/infer/snapshot/fudge.rs:185 — InferenceFudger::fold_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InferenceFudger::fold_ty (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/snapshot/fudge.rs:179 — InferenceFudger::fold_ty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InitMaskMaterialized · ×2
  • InitMaskMaterialized::set_range_inbounds (cognitive 17) compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs:289 — InitMaskMaterialized::set_range_inbounds has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InitMaskMaterialized::find_bit::find_bit_fast (cognitive 16) compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs:379 — InitMaskMaterialized::find_bit::find_bit_fast has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InherentCollect · ×2
  • InherentCollect::check_def_id (cognitive 16) compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs:64 — InherentCollect::check_def_id has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InherentCollect::check_primitive_impl (cognitive 16) compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs:127 — InherentCollect::check_primitive_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CharSearcher · ×2
  • CharSearcher::next_match (cognitive 16) library/core/src/str/pattern.rs:434 — CharSearcher::next_match has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (CharSearcher::next_match_back) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • CharSearcher::next_match_back (cognitive 16) library/core/src/str/pattern.rs:501 — CharSearcher::next_match_back has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (CharSearcher::next_match) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Docs · ×2
  • Docs::push_doc_lines (cognitive 16) src/tools/rust-analyzer/crates/hir-def/src/attrs/docs.rs:263 — Docs::push_doc_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Docs::remove_indent (cognitive 16) src/tools/rust-analyzer/crates/hir-def/src/attrs/docs.rs:346 — Docs::remove_indent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: context.rs ↔ mod.rs compiler/rustc_infer/src/infer/context.rs:1 — `compiler/rustc_infer/src/infer/context.rs` and `compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `d1f102f5` force ambiguity when no assumptions; `7809ec46` remove `None` assumptions; `2499f6ff` rename opportunistic_resolve to shallow_resolve — run `git show` on any of them.
  • Change coupling: mod.rs ↔ intrinsic.rs compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1 — `compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs` and `compiler/rustc_hir_analysis/src/check/intrinsic.rs` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `d428655c` Make `powi` generic; `ac667d22` Make `fma` and `fmuladd` generic; `d4f1babb` Make powf generic — run `git show` on any of them.
D4 · Code Duplication · Near-duplicate member family (4 members, 17 shared lines) · ×2
  • Near-duplicate member family (4 members, 17 shared lines) library/compiler-builtins/libm/src/math/j0.rs:285 — library/compiler-builtins/libm/src/math/j0.rs:285-314 | library/compiler-builtins/libm/src/math/j0f.rs:222-251 | library/compiler-builtins/libm/src/math/j1.rs:277-306 | library/compiler-builtins/libm/src/math/j1f.rs:221-250 — These 4 members are variants of one another: a block of 17 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 17 shared lines) library/compiler-builtins/libm/src/math/j0.rs:397 — library/compiler-builtins/libm/src/math/j0.rs:397-426 | library/compiler-builtins/libm/src/math/j0f.rs:334-363 | library/compiler-builtins/libm/src/math/j1.rs:389-418 | library/compiler-builtins/libm/src/math/j1f.rs:333-362 — These 4 members are variants of one another: a block of 17 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×2
  • Duplicated block (43 lines × 2) compiler/rustc_resolve/src/ident.rs:1691 — compiler/rustc_resolve/src/ident.rs:1691-1733 | compiler/rustc_resolve/src/ident.rs:1786-1828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (43 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:45 — compiler/rustc_target/src/callconv/loongarch.rs:45-87 | compiler/rustc_target/src/callconv/riscv.rs:51-93 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:757 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:757-783 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:793-819 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) compiler/rustc_codegen_cranelift/example/std_example.rs:24 — compiler/rustc_codegen_cranelift/example/std_example.rs:24-50 | compiler/rustc_codegen_gcc/example/std_example.rs:19-45 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:602 — compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:602-624 | compiler/rustc_codegen_llvm/src/intrinsic.rs:950-972 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (23 lines × 2) library/alloc/src/rcs/arc.rs:1218 — library/alloc/src/rcs/arc.rs:1218-1240 | library/alloc/src/rcs/rc.rs:1064-1086 — before extracting anything, compare `library/alloc/src/rcs/arc.rs` and `library/alloc/src/rcs/rc.rs` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 329 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) compiler/rustc_borrowck/src/type_check/mod.rs:1269 — compiler/rustc_borrowck/src/type_check/mod.rs:1269-1286 | compiler/rustc_borrowck/src/type_check/mod.rs:1336-1354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–19 lines × 2) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1379 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1379-1396 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:1417-1435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×2
  • Duplicated block (17 lines × 4) library/compiler-builtins/libm/src/math/j0.rs:294 — library/compiler-builtins/libm/src/math/j0.rs:294-310 | library/compiler-builtins/libm/src/math/j0f.rs:231-247 | library/compiler-builtins/libm/src/math/j1.rs:286-302 | library/compiler-builtins/libm/src/math/j1f.rs:230-246 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j0f.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 4) library/compiler-builtins/libm/src/math/j0.rs:406 — library/compiler-builtins/libm/src/math/j0.rs:406-422 | library/compiler-builtins/libm/src/math/j0f.rs:343-359 | library/compiler-builtins/libm/src/math/j1.rs:398-414 | library/compiler-builtins/libm/src/math/j1f.rs:342-358 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j0f.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×2
  • Duplicated block (13–16 lines × 2) compiler/rustc_borrowck/src/lib.rs:1549 — compiler/rustc_borrowck/src/lib.rs:1549-1564 | compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:284-296 — before extracting anything, compare `compiler/rustc_borrowck/src/lib.rs` and `compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13–16 lines × 2) compiler/rustc_metadata/src/rmeta/encoder.rs:2642 — compiler/rustc_metadata/src/rmeta/encoder.rs:2642-2654 | compiler/rustc_metadata/src/rmeta/encoder.rs:2696-2711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1607 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1607-1622 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1689-1703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) library/compiler-builtins/libm/src/math/j1.rs:180 — library/compiler-builtins/libm/src/math/j1.rs:180-195 | library/compiler-builtins/libm/src/math/j1f.rs:125-139 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j1.rs` and `library/compiler-builtins/libm/src/math/j1f.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:525 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:525-539 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:582-596 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:621-635 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (15 lines × 3) library/compiler-builtins/libm/src/math/log.rs:88 — library/compiler-builtins/libm/src/math/log.rs:88-102 | library/compiler-builtins/libm/src/math/log10.rs:62-76 | library/compiler-builtins/libm/src/math/log2.rs:59-73 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10.rs` and `library/compiler-builtins/libm/src/math/log2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) compiler/rustc_hir_typeck/src/method/suggest.rs:2324 — compiler/rustc_hir_typeck/src/method/suggest.rs:2324-2338 | compiler/rustc_hir_typeck/src/method/suggest.rs:2363-2375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–15 lines × 2) compiler/rustc_lint/src/runtime_symbols.rs:144 — compiler/rustc_lint/src/runtime_symbols.rs:144-158 | compiler/rustc_lint/src/runtime_symbols.rs:165-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) library/compiler-builtins/libm-test/src/precision.rs:270 — library/compiler-builtins/libm-test/src/precision.rs:270-283 | library/compiler-builtins/libm-test/src/precision.rs:313-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) library/compiler-builtins/libm/src/math/pow.rs:196 — library/compiler-builtins/libm/src/math/pow.rs:196-210 | library/compiler-builtins/libm/src/math/powf.rs:152-165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) library/std/src/os/xous/ffi.rs:157 — library/std/src/os/xous/ffi.rs:157-169 | library/std/src/os/xous/ffi.rs:429-441 | library/std/src/os/xous/ffi.rs:476-488 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:201 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:201-213 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:216-228 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:295-307 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) compiler/rustc_attr_parsing/src/attributes/stability.rs:349 — compiler/rustc_attr_parsing/src/attributes/stability.rs:349-355 | compiler/rustc_attr_parsing/src/attributes/stability.rs:442-449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) compiler/rustc_codegen_cranelift/src/constant.rs:309 — compiler/rustc_codegen_cranelift/src/constant.rs:309-315 | compiler/rustc_codegen_cranelift/src/constant.rs:360-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×2
  • Duplicated block (6–8 lines × 2) compiler/rustc_codegen_cranelift/src/driver/jit.rs:104 — compiler/rustc_codegen_cranelift/src/driver/jit.rs:104-109 | compiler/rustc_codegen_cranelift/src/main_shim.rs:54-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6–8 lines × 2) compiler/rustc_codegen_llvm/src/consts.rs:700 — compiler/rustc_codegen_llvm/src/consts.rs:700-705 | compiler/rustc_codegen_llvm/src/consts.rs:816-823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) compiler/rustc_const_eval/src/interpret/stack.rs:521 — compiler/rustc_const_eval/src/interpret/stack.rs:521-527 | compiler/rustc_middle/src/ty/sty.rs:1970-1976 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:127-133 | compiler/rustc_trait_selection/src/traits/select/mod.rs:2030-2036 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs` and `compiler/rustc_trait_selection/src/traits/select/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) library/alloc/src/boxed.rs:1057 — library/alloc/src/boxed.rs:1057-1063 | library/alloc/src/boxed.rs:1095-1101 | library/alloc/src/boxed.rs:1193-1199 | library/alloc/src/boxed.rs:1236-1242 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×2
  • Duplicated block (5–6 lines × 2) compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs:27 — compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs:27-31 | compiler/rustc_macros/src/diagnostics/subdiagnostic.rs:37-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5–6 lines × 2) compiler/rustc_codegen_cranelift/example/std_example.rs:62 — compiler/rustc_codegen_cranelift/example/std_example.rs:62-67 | compiler/rustc_codegen_gcc/example/std_example.rs:58-62 — before extracting anything, compare `compiler/rustc_codegen_cranelift/example/std_example.rs` and `compiler/rustc_codegen_gcc/example/std_example.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
R10 · Code Duplication · Duplicated block (31 lines × 2 locations) · ×2
  • Duplicated block (31 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:27 — src/librustdoc/html/static/js/stringdex.js:27 · src/librustdoc/html/static/js/stringdex.js:118 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (31 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3117 — src/librustdoc/html/static/js/stringdex.js:3117 · src/librustdoc/html/static/js/stringdex.js:3155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (23 lines × 2 locations) · ×2
  • Duplicated block (23 lines × 2 locations) REDACTED:3182 — REDACTED:3182 · REDACTED:3381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:2160 — src/librustdoc/html/static/js/stringdex.js:2160 · src/librustdoc/html/static/js/stringdex.js:2220 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×2
  • Duplicated block (19 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:2203 — src/librustdoc/html/static/js/stringdex.js:2203 · src/librustdoc/html/static/js/stringdex.js:2259 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (19 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:4040 — src/librustdoc/html/static/js/stringdex.js:4040 · src/librustdoc/html/static/js/stringdex.js:4347 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×2
  • Duplicated block (15 lines × 2 locations) src/librustdoc/html/static/js/main.js:1595 — src/librustdoc/html/static/js/main.js:1595 · src/librustdoc/html/static/js/settings.js:354 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3632 — src/librustdoc/html/static/js/stringdex.js:3632 · src/librustdoc/html/static/js/stringdex.js:3649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×2
  • Duplicated block (14 lines × 2 locations) REDACTED:2450 — REDACTED:2450 · REDACTED:2468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:716 — src/librustdoc/html/static/js/stringdex.js:716 · src/librustdoc/html/static/js/stringdex.js:766 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×2
  • Duplicated block (13 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:3225 — src/librustdoc/html/static/js/stringdex.js:3225 · src/librustdoc/html/static/js/stringdex.js:3263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:648 — src/tools/rust-analyzer/editors/code/src/commands.ts:648 · src/tools/rust-analyzer/editors/code/src/commands.ts:817 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R11 · Import Boundaries · Boundary violation [package · ×2
  • Boundary violation [package:third-party-deep-import] src/tools/rust-analyzer/editors/code/src/client.ts:5 — src/tools/rust-analyzer/editors/code/src/client.ts:5 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] src/tools/rust-analyzer/editors/code/src/config.ts:1 — src/tools/rust-analyzer/editors/code/src/config.ts:1 imports vscode-languageclient/lib/common/utils/is, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 19 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · LangItem · ×1
  • LangItem::from_u32 (cyclomatic 227) compiler/rustc_attr_ir/src/lang_items.rs:93 — LangItem::from_u32 has cyclomatic complexity 227 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Methods · ×1
  • Methods::check_methods (cyclomatic 191) src/tools/clippy/clippy_lints/src/methods/mod.rs:5438 — Methods::check_methods has cyclomatic complexity 191 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · stringdex.loadDatabase (cyclomatic 172) · ×1
  • stringdex.loadDatabase (cyclomatic 172) src/librustdoc/html/static/js/stringdex.js:1089 — stringdex.loadDatabase has cyclomatic complexity 172 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (stringdex.loadDatabase::makeSearchTreeFromBase64, stringdex.loadDatabase::makeSearchTreeFromBase64::makeBranchesFromBinaryData) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · search.initSearch (cyclomatic 145) · ×1
  • search.initSearch (cyclomatic 145) REDACTED:12 — search.initSearch has cyclomatic complexity 145 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 12 other methods here (search.initSearch::getItemsBefore, search.initSearch::getNextElem, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ThirBuildCx · ×1
  • ThirBuildCx::make_mirror_unadjusted (cyclomatic 112) compiler/rustc_mir_build/src/thir/cx/expr.rs:392 — ThirBuildCx::make_mirror_unadjusted has cyclomatic complexity 112 (threshold 15). Of this number, 110 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Options · ×1
  • Options::from_matches (cyclomatic 88) src/librustdoc/config.rs:386 — Options::from_matches has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_ast_passes · ×1
  • rustc_ast_passes::feature_gate::check_crate (cyclomatic 75) compiler/rustc_ast_passes/src/feature_gate.rs:409 — rustc_ast_passes::feature_gate::check_crate has cyclomatic complexity 75 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · EvalContextExtPriv · ×1
  • EvalContextExtPriv::emulate_foreign_item_inner (cyclomatic 75) src/tools/miri/src/shims/foreign_items.rs:256 — EvalContextExtPriv::emulate_foreign_item_inner has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Extended · ×1
  • Extended::run (cyclomatic 67) src/bootstrap/src/core/build_steps/dist.rs:1902 — Extended::run has cyclomatic complexity 67 (threshold 15). Of this number, 63 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CompileTimeMachine · ×1
  • CompileTimeMachine::call_intrinsic (cyclomatic 65) compiler/rustc_const_eval/src/const_eval/machine.rs:477 — CompileTimeMachine::call_intrinsic has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FulfillProcessor · ×1
  • FulfillProcessor::process_obligation (cyclomatic 63) compiler/rustc_trait_selection/src/traits/fulfill.rs:381 — FulfillProcessor::process_obligation has cyclomatic complexity 63 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TokenStream · ×1
  • TokenStream::from_str (cyclomatic 61) src/tools/rust-analyzer/crates/proc-macro-srv/src/token_stream.rs:50 — TokenStream::from_str has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Llvm · ×1
  • Llvm::run (cyclomatic 60) src/bootstrap/src/core/build_steps/llvm.rs:440 — Llvm::run has cyclomatic complexity 60 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Cursor · ×1
  • Cursor::advance_token (cyclomatic 58) compiler/rustc_lexer/src/lib.rs:536 — Cursor::advance_token has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DeepRejectCtxt · ×1
  • DeepRejectCtxt::types_may_unify_inner (cyclomatic 57) compiler/rustc_type_ir/src/fast_reject.rs:263 — DeepRejectCtxt::types_may_unify_inner has cyclomatic complexity 57 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · UndefinedBehaviorInfo · ×1
  • UndefinedBehaviorInfo::fmt (cyclomatic 56) compiler/rustc_middle/src/mir/interpret/error.rs:437 — UndefinedBehaviorInfo::fmt has cyclomatic complexity 56 (threshold 15). Of this number, 52 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LowerIntrinsics · ×1
  • LowerIntrinsics::run_pass (cyclomatic 55) compiler/rustc_mir_transform/src/lower_intrinsics.rs:12 — LowerIntrinsics::run_pass has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BorrowExplanation · ×1
  • BorrowExplanation::add_explanation_to_diagnostic (cyclomatic 54) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:58 — BorrowExplanation::add_explanation_to_diagnostic has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SymbolCollector · ×1
  • SymbolCollector::collect_from_module (cyclomatic 53) src/tools/rust-analyzer/crates/hir/src/symbols.rs:197 — SymbolCollector::collect_from_module has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Classifier · ×1
  • Classifier::advance (cyclomatic 51) src/librustdoc/html/highlight.rs:1060 — Classifier::advance has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConstInt · ×1
  • ConstInt::fmt (cyclomatic 47) compiler/rustc_middle/src/ty/consts/int.rs:54 — ConstInt::fmt has cyclomatic complexity 47 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FnCallDiagCtxt · ×1
  • FnCallDiagCtxt::labels_and_suggestion_text (cyclomatic 46) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:2612 — FnCallDiagCtxt::labels_and_suggestion_text has cyclomatic complexity 46 (threshold 15). Of this number, 45 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnnotateSnippetEmitter · ×1
  • AnnotateSnippetEmitter::emit_messages_default (cyclomatic 45) compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs:159 — AnnotateSnippetEmitter::emit_messages_default has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtHwcap · ×1
  • AtHwcap::cache (cyclomatic 45) library/std_detect/src/detect/os/linux/aarch64.rs:262 — AtHwcap::cache has cyclomatic complexity 45 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SourceAnalyzer · ×1
  • SourceAnalyzer::resolve_path (cyclomatic 45) src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs:1158 — SourceAnalyzer::resolve_path has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ErasedFileAstId · ×1
  • ErasedFileAstId::kind_typed (cyclomatic 45) src/tools/rust-analyzer/crates/span/src/ast_id.rs:198 — ErasedFileAstId::kind_typed has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UselessConversion · ×1
  • UselessConversion::check_expr (cyclomatic 44) src/tools/clippy/clippy_lints/src/useless_conversion.rs:158 — UselessConversion::check_expr has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CharClasses · ×1
  • CharClasses::next (cyclomatic 44) src/tools/rustfmt/src/comment.rs:1394 — CharClasses::next has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · bootstrap.default_build_triple (cyclomatic 43) · ×1
  • bootstrap.default_build_triple (cyclomatic 43) src/bootstrap/bootstrap.py:280 — bootstrap.default_build_triple has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MacroExpander · ×1
  • MacroExpander::expand_invoc (cyclomatic 42) compiler/rustc_expand/src/expand.rs:700 — MacroExpander::expand_invoc has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TypeLimits · ×1
  • TypeLimits::check_expr (cyclomatic 42) compiler/rustc_lint/src/types.rs:656 — TypeLimits::check_expr has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 9 of the 42 points are its own statements and the rest belongs to 4 function items inside it that branch (is_valid, diag_item_cmpop, check_limits, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · Display · ×1
  • Display::fmt (cyclomatic 42) src/librustdoc/clean/cfg.rs:531 — Display::fmt has cyclomatic complexity 42 (threshold 15). Of this number, 41 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustdoc::clean::cfg::human_readable_target_os (cyclomatic 53) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · InterPat · ×1
  • InterPat::lower_thir_pat (cyclomatic 41) compiler/rustc_mir_build/src/builder/matches/match_pair.rs:209 — InterPat::lower_thir_pat has cyclomatic complexity 41 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · NiceRegionError · ×1
  • NiceRegionError::report_trait_placeholder_mismatch (cyclomatic 40) compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs:246 — NiceRegionError::report_trait_placeholder_mismatch has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Assemble · ×1
  • Assemble::run (cyclomatic 40) src/bootstrap/src/core/build_steps/compile.rs:2120 — Assemble::run has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommentRewrite · ×1
  • CommentRewrite::handle_line (cyclomatic 40) src/tools/rustfmt/src/comment.rs:713 — CommentRewrite::handle_line has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConstructorSet · ×1
  • ConstructorSet::split (cyclomatic 39) compiler/rustc_pattern_analysis/src/constructor.rs:1044 — ConstructorSet::split has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.register_type_impls (cyclomatic 39) · ×1
  • main.register_type_impls (cyclomatic 39) src/librustdoc/html/static/js/main.js:946 — main.register_type_impls has cyclomatic complexity 39 (threshold 15). Of this number, 17 points are the body's own statements and 22 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModCollector · ×1
  • ModCollector::collect (cyclomatic 38) src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs:1898 — ModCollector::collect has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Rvalue · ×1
  • Rvalue::fmt (cyclomatic 37) compiler/rustc_middle/src/mir/pretty.rs:1148 — Rvalue::fmt has cyclomatic complexity 37 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · NormalizedPat · ×1
  • NormalizedPat::from_pat (cyclomatic 37) src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs:263 — NormalizedPat::from_pat has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TargetDataLayout · ×1
  • TargetDataLayout::parse_from_llvm_datalayout_string (cyclomatic 36) compiler/rustc_abi/src/lib.rs:452 — TargetDataLayout::parse_from_llvm_datalayout_string has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · y · ×1
  • y::main (cyclomatic 36) compiler/rustc_codegen_cranelift/build_system/main.rs:52 — y::main has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CheckLoopVisitor · ×1
  • CheckLoopVisitor::visit_expr (cyclomatic 36) compiler/rustc_hir_typeck/src/loops.rs:112 — CheckLoopVisitor::visit_expr has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImproperCTypesVisitor · ×1
  • ImproperCTypesVisitor::visit_type (cyclomatic 36) compiler/rustc_lint/src/types/improper_ctypes.rs:783 — ImproperCTypesVisitor::visit_type has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConstAnalysis · ×1
  • ConstAnalysis::handle_assign (cyclomatic 36) compiler/rustc_mir_transform/src/dataflow_const_prop.rs:268 — ConstAnalysis::handle_assign has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TransformTy · ×1
  • TransformTy::fold_ty (cyclomatic 36) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs:52 — TransformTy::fold_ty has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WfPredicates · ×1
  • WfPredicates::visit_ty (cyclomatic 36) compiler/rustc_trait_selection/src/traits/wf.rs:741 — WfPredicates::visit_ty has cyclomatic complexity 36 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CacheBuilder · ×1
  • CacheBuilder::fold_item (cyclomatic 36) src/librustdoc/formats/cache.rs:301 — CacheBuilder::fold_item has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Directive · ×1
  • Directive::check (cyclomatic 36) src/tools/jsondocck/src/directive.rs:203 — Directive::check has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Format · ×1
  • Format::translate (cyclomatic 35) compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:76 — Format::translate has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LangString · ×1
  • LangString::parse (cyclomatic 35) src/librustdoc/html/markdown.rs:1238 — LangString::parse has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PkgType · ×1
  • PkgType::is_preview (cyclomatic 35) src/tools/build-manifest/src/versions.rs:21 — PkgType::is_preview has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TyKind · ×1
  • TyKind::fmt (cyclomatic 34) compiler/rustc_type_ir/src/ty_kind.rs:430 — TyKind::fmt has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DiagnosticsCollector · ×1
  • DiagnosticsCollector::collect_impl (cyclomatic 34) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:924 — DiagnosticsCollector::collect_impl has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SizeSkeleton · ×1
  • SizeSkeleton::compute_inner (cyclomatic 33) compiler/rustc_middle/src/ty/layout.rs:358 — SizeSkeleton::compute_inner has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InlineAsmClobberAbi · ×1
  • InlineAsmClobberAbi::parse (cyclomatic 33) compiler/rustc_target/src/asm/mod.rs:1034 — InlineAsmClobberAbi::parse has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Matches · ×1
  • Matches::check_expr (cyclomatic 33) src/tools/clippy/clippy_lints/src/matches/mod.rs:1055 — Matches::check_expr has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnsafeVisitor · ×1
  • UnsafeVisitor::walk_expr (cyclomatic 33) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/unsafe_check.rs:266 — UnsafeVisitor::walk_expr has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · client.createClient (cyclomatic 33) · ×1
  • client.createClient (cyclomatic 33) src/tools/rust-analyzer/editors/code/src/client.ts:13 — client.createClient has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 60, callback, a function literal at line 84, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · Cargo · ×1
  • Cargo::configure_linker (cyclomatic 32) src/bootstrap/src/core/builder/cargo.rs:317 — Cargo::configure_linker has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExpressionStore · ×1
  • ExpressionStore::visit_expr_children (cyclomatic 32) src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs:671 — ExpressionStore::visit_expr_children has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · unicode_table_generator · ×1
  • unicode_table_generator::load_data (cyclomatic 32) src/tools/unicode-table-generator/src/main.rs:137 — unicode_table_generator::load_data has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DocSearch.buildItemSearchType (cyclomatic 32) · ×1
  • DocSearch.buildItemSearchType (cyclomatic 32) REDACTED:1998 — DocSearch.buildItemSearchType has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RoaringBitmap.constructor (cyclomatic 32) · ×1
  • RoaringBitmap.constructor (cyclomatic 32) src/librustdoc/html/static/js/stringdex.js:17 — RoaringBitmap.constructor has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LintLevelsBuilder · ×1
  • LintLevelsBuilder::add (cyclomatic 31) compiler/rustc_lint/src/levels.rs:728 — LintLevelsBuilder::add has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrefixTrie.prefixMatches (cyclomatic 31) · ×1
  • PrefixTrie.prefixMatches (cyclomatic 31) src/librustdoc/html/static/js/stringdex.js:2031 — PrefixTrie.prefixMatches has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DiagCtxtInner · ×1
  • DiagCtxtInner::emit_diagnostic (cyclomatic 30) compiler/rustc_errors/src/lib.rs:1203 — DiagCtxtInner::emit_diagnostic has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GetOptsOptions · ×1
  • GetOptsOptions::from_matches (cyclomatic 30) src/tools/rustfmt/src/bin/main.rs:564 — GetOptsOptions::from_matches has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RustBuild.build_bootstrap_cmd (cyclomatic 30) · ×1
  • RustBuild.build_bootstrap_cmd (cyclomatic 30) src/bootstrap/bootstrap.py:1067 — RustBuild.build_bootstrap_cmd has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · htmldocck.check_command (cyclomatic 30) · ×1
  • htmldocck.check_command (cyclomatic 30) REDACTED:520 — htmldocck.check_command has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RoaringBitmap.intersection (cyclomatic 30) · ×1
  • RoaringBitmap.intersection (cyclomatic 30) src/librustdoc/html/static/js/stringdex.js:486 — RoaringBitmap.intersection has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_ast · ×1
  • rustc_ast::util::comments::beautify_doc_string (cyclomatic 29) compiler/rustc_ast/src/util/comments.rs:37 — rustc_ast::util::comments::beautify_doc_string has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 2 function items inside it that branch (get_horizontal_trim, get_vertical_trim). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · rustc_ast_pretty · ×1
  • rustc_ast_pretty::pprust::state::expr::reconstruct_format_args_template_string (cyclomatic 29) compiler/rustc_ast_pretty/src/pprust/state/expr.rs:975 — rustc_ast_pretty::pprust::state::expr::reconstruct_format_args_template_string has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SubdiagnosticVariant · ×1
  • SubdiagnosticVariant::from_attr (cyclomatic 29) compiler/rustc_macros/src/diagnostics/utils.rs:588 — SubdiagnosticVariant::from_attr has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SolverDelegate · ×1
  • SolverDelegate::compute_goal_fast_path (cyclomatic 29) compiler/rustc_trait_selection/src/solve/delegate.rs:152 — SolverDelegate::compute_goal_fast_path has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Path · ×1
  • Path::hir_fmt (cyclomatic 29) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:2681 — Path::hir_fmt has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DocSearch.getRow (cyclomatic 29) · ×1
  • DocSearch.getRow (cyclomatic 29) REDACTED:1896 — DocSearch.getRow has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rustc_ast_lowering · ×1
  • rustc_ast_lowering::format::expand_format_args (cyclomatic 28) compiler/rustc_ast_lowering/src/format.rs:280 — rustc_ast_lowering::format::expand_format_args has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArgMatrix · ×1
  • ArgMatrix::find_issue (cyclomatic 28) compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs:163 — ArgMatrix::find_issue has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FlagComputation · ×1
  • FlagComputation::add_kind (cyclomatic 28) compiler/rustc_type_ir/src/flags.rs:254 — FlagComputation::add_kind has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · tt · ×1
  • tt::storage::encode (cyclomatic 28) src/tools/rust-analyzer/crates/tt/src/storage.rs:332 — tt::storage::encode has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · configure.apply_args (cyclomatic 28) · ×1
  • configure.apply_args (cyclomatic 28) src/bootstrap/configure.py:507 — configure.apply_args has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check_lldb.var_matches (cyclomatic 28) · ×1
  • check_lldb.var_matches (cyclomatic 28) src/etc/debugger_tester/lldb/check_lldb.py:199 — check_lldb.var_matches has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RoaringBitmap.union (cyclomatic 28) · ×1
  • RoaringBitmap.union (cyclomatic 28) src/librustdoc/html/static/js/stringdex.js:363 — RoaringBitmap.union has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CrateError · ×1
  • CrateError::report (cyclomatic 27) compiler/rustc_metadata/src/locator.rs:1084 — CrateError::report has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · X86IntrinsicType · ×1
  • X86IntrinsicType::from_param (cyclomatic 27) library/stdarch/crates/intrinsic-test/src/x86/types.rs:196 — X86IntrinsicType::from_param has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolBuild · ×1
  • ToolBuild::run (cyclomatic 27) src/bootstrap/src/core/build_steps/tool.rs:79 — ToolBuild::run has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · IndexingSlicing · ×1
  • IndexingSlicing::check_expr (cyclomatic 27) src/tools/clippy/clippy_lints/src/indexing_slicing.rs:111 — IndexingSlicing::check_expr has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CompletionRelevance · ×1
  • CompletionRelevance::score (cyclomatic 27) src/tools/rust-analyzer/crates/ide-completion/src/item.rs:287 — CompletionRelevance::score has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: CompletionItemKind::tag (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · UnusedParens · ×1
  • UnusedParens::check_ty (cyclomatic 26) compiler/rustc_lint/src/unused.rs:956 — UnusedParens::check_ty has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PatCtxt · ×1
  • PatCtxt::lower_pattern_unadjusted (cyclomatic 26) compiler/rustc_mir_build/src/thir/pattern/mod.rs:317 — PatCtxt::lower_pattern_unadjusted has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AbortUnwindingCalls · ×1
  • AbortUnwindingCalls::run_pass (cyclomatic 26) compiler/rustc_mir_transform/src/abort_unwinding_calls.rs:28 — AbortUnwindingCalls::run_pass has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · stdarch_verify · ×1
  • stdarch_verify::functions (cyclomatic 26) library/stdarch/crates/stdarch-verify/src/lib.rs:34 — stdarch_verify::functions has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: stdarch_verify::to_type (cyclomatic 225) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TupleArrayConversions · ×1
  • TupleArrayConversions::check_expr (cyclomatic 26) src/tools/clippy/clippy_lints/src/tuple_array_conversions.rs:64 — TupleArrayConversions::check_expr has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Types · ×1
  • Types::check_ty (cyclomatic 26) src/tools/clippy/clippy_lints/src/types/mod.rs:575 — Types::check_ty has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SemanticsImpl · ×1
  • SemanticsImpl::descend_into_macros_impl (cyclomatic 26) src/tools/rust-analyzer/crates/hir/src/semantics.rs:1237 — SemanticsImpl::descend_into_macros_impl has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scip · ×1
  • Scip::run (cyclomatic 26) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:24 — Scip::run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RegionInferenceContextInner · ×1
  • RegionInferenceContextInner::best_blame_constraint (cyclomatic 25) compiler/rustc_borrowck/src/region_infer/region_context.rs:594 — RegionInferenceContextInner::best_blame_constraint has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · VisitOpaqueTypes · ×1
  • VisitOpaqueTypes::visit_ty (cyclomatic 25) compiler/rustc_lint/src/impl_trait_overcaptures.rs:245 — VisitOpaqueTypes::visit_ty has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CondChecker · ×1
  • CondChecker::visit_expr (cyclomatic 25) compiler/rustc_parse/src/parser/expr.rs:4127 — CondChecker::visit_expr has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReachableContext · ×1
  • ReachableContext::propagate_node (cyclomatic 25) compiler/rustc_passes/src/reachable.rs:176 — ReachableContext::propagate_node has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Disambiguator · ×1
  • Disambiguator::from_str (cyclomatic 25) src/librustdoc/passes/collect_intra_doc_links.rs:1768 — Disambiguator::from_str has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: rustdoc::passes::collect_intra_doc_links::resolve_primitive (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · IterFunctionVisitor · ×1
  • IterFunctionVisitor::visit_expr (cyclomatic 25) src/tools/clippy/clippy_lints/src/methods/needless_collect.rs:512 — IterFunctionVisitor::visit_expr has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LintExtractor · ×1
  • LintExtractor::lints_from_file (cyclomatic 25) src/tools/lint-docs/src/lib.rs:195 — LintExtractor::lints_from_file has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NameRefClass · ×1
  • NameRefClass::classify (cyclomatic 25) src/tools/rust-analyzer/crates/ide-db/src/defs.rs:745 — NameRefClass::classify has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Definition::docs_with_rangemap (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Ctx · ×1
  • Ctx::transform_path_ (cyclomatic 25) src/tools/rust-analyzer/crates/ide-db/src/path_transform.rs:355 — Ctx::transform_path_ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Canonicalized · ×1
  • Canonicalized::canonicalize (cyclomatic 25) src/tools/unicode-table-generator/src/raw_emitter.rs:198 — Canonicalized::canonicalize has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MSVCEnumSyntheticProvider.update (cyclomatic 25) · ×1
  • MSVCEnumSyntheticProvider.update (cyclomatic 25) src/etc/lldb_providers.py:833 — MSVCEnumSyntheticProvider.update has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_macros · ×1
  • rustc_macros::query::parse_query_modifiers (cyclomatic 24) compiler/rustc_macros/src/query.rs:152 — rustc_macros::query::parse_query_modifiers has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NeedsDropTypes · ×1
  • NeedsDropTypes::next (cyclomatic 24) compiler/rustc_ty_utils/src/needs_drop.rs:176 — NeedsDropTypes::next has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · rustc_ty_walk · ×1
  • rustc_ty_walk::walk_types (cyclomatic 24) compiler/rustc_ty_walk/src/lib.rs:20 — rustc_ty_walk::walk_types has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · NonCopyConst · ×1
  • NonCopyConst::is_non_freeze_init_borrowed (cyclomatic 24) src/tools/clippy/clippy_lints/src/non_copy_const.rs:568 — NonCopyConst::is_non_freeze_init_borrowed has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DerefDelegate · ×1
  • DerefDelegate::borrow (cyclomatic 24) src/tools/clippy/clippy_utils/src/sugg.rs:937 — DerefDelegate::borrow has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImportMap · ×1
  • ImportMap::collect_import_map (cyclomatic 24) src/tools/rust-analyzer/crates/hir-def/src/import_map.rs:136 — ImportMap::collect_import_map has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UseSegment · ×1
  • UseSegment::cmp (cyclomatic 24) src/tools/rustfmt/src/imports.rs:921 — UseSegment::cmp has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · check_gdb.var_matches (cyclomatic 24) · ×1
  • check_gdb.var_matches (cyclomatic 24) src/etc/debugger_tester/gdb/check_gdb.py:125 — check_gdb.var_matches has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TerminatorCodegenHelper · ×1
  • TerminatorCodegenHelper::do_call (cyclomatic 23) compiler/rustc_codegen_ssa/src/mir/block.rs:170 — TerminatorCodegenHelper::do_call has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalCtxt · ×1
  • EvalCtxt::term_is_fully_unconstrained (cyclomatic 23) compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1174 — EvalCtxt::term_is_fully_unconstrained has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sembr · ×1
  • sembr::reformat (cyclomatic 23) src/doc/rustc-dev-guide/ci/sembr/src/main.rs:138 — sembr::reformat has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MissingConstForFn · ×1
  • MissingConstForFn::check_fn (cyclomatic 23) src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs:89 — MissingConstForFn::check_fn has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FunctionBody · ×1
  • FunctionBody::analyze_container (cyclomatic 23) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs:844 — FunctionBody::analyze_container has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ModResolver · ×1
  • ModResolver::find_external_module (cyclomatic 23) src/tools/rustfmt/src/modules.rs:361 — ModResolver::find_external_module has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · batchmode.main (cyclomatic 23) · ×1
  • batchmode.main (cyclomatic 23) src/etc/debugger_tester/lldb/batchmode.py:214 — batchmode.main has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tester.valueCheck (cyclomatic 23) · ×1
  • tester.valueCheck (cyclomatic 23) src/tools/rustdoc-js/tester.js:156 — tester.valueCheck has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TailCallCkVisitor · ×1
  • TailCallCkVisitor::check_tail_call (cyclomatic 22) compiler/rustc_mir_build/src/check_tail_calls.rs:52 — TailCallCkVisitor::check_tail_call has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rustc_mir_build::check_tail_calls::op_trait_as_method_name (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CostChecker · ×1
  • CostChecker::visit_terminator (cyclomatic 22) compiler/rustc_mir_transform/src/cost_checker.rs:98 — CostChecker::visit_terminator has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Integrator · ×1
  • Integrator::visit_terminator (cyclomatic 22) compiler/rustc_mir_transform/src/inline.rs:1274 — Integrator::visit_terminator has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MirUsedCollector · ×1
  • MirUsedCollector::visit_terminator (cyclomatic 22) compiler/rustc_monomorphize/src/collector.rs:822 — MirUsedCollector::visit_terminator has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · OrphanChecker · ×1
  • OrphanChecker::visit_ty (cyclomatic 22) compiler/rustc_next_trait_solver/src/coherence.rs:325 — OrphanChecker::visit_ty has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AddLifetimeParamsSuggestion · ×1
  • AddLifetimeParamsSuggestion::add_to_diag (cyclomatic 22) compiler/rustc_trait_selection/src/diagnostics.rs:608 — AddLifetimeParamsSuggestion::add_to_diag has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Mode · ×1
  • Mode::fmt (cyclomatic 22) library/std/src/sys/fs/unix.rs:1818 — Mode::fmt has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · assert_instr_macro · ×1
  • assert_instr_macro::assert_instr (cyclomatic 22) library/stdarch/crates/assert-instr-macro/src/lib.rs:20 — assert_instr_macro::assert_instr has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PatState · ×1
  • PatState::add_pat (cyclomatic 22) src/tools/clippy/clippy_lints/src/matches/single_match.rs:355 — PatState::add_pat has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · opt_dist · ×1
  • opt_dist::execute_pipeline (cyclomatic 22) src/tools/opt-dist/src/main.rs:224 — opt_dist::execute_pipeline has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SourceToDefCtx · ×1
  • SourceToDefCtx::container_to_def (cyclomatic 22) src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs:616 — SourceToDefCtx::container_to_def has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SanitizeParser · ×1
  • SanitizeParser::convert (cyclomatic 21) compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs:690 — SanitizeParser::convert has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DeprecatedParser · ×1
  • DeprecatedParser::convert (cyclomatic 21) compiler/rustc_attr_parsing/src/attributes/deprecation.rs:74 — DeprecatedParser::convert has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArArchiveBuilder · ×1
  • ArArchiveBuilder::build_inner (cyclomatic 21) compiler/rustc_codegen_ssa/src/back/archive.rs:571 — ArArchiveBuilder::build_inner has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OperandRef · ×1
  • OperandRef::codegen_get_discr (cyclomatic 21) compiler/rustc_codegen_ssa/src/mir/operand.rs:458 — OperandRef::codegen_get_discr has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InherentOverlapChecker · ×1
  • InherentOverlapChecker::check_item (cyclomatic 21) compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs:174 — InherentOverlapChecker::check_item has cyclomatic complexity 21 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · ConstraintContext · ×1
  • ConstraintContext::add_constraints_from_ty (cyclomatic 21) compiler/rustc_hir_analysis/src/variance/constraints.rs:208 — ConstraintContext::add_constraints_from_ty has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReplacementVisitor · ×1
  • ReplacementVisitor::visit_statement (cyclomatic 21) compiler/rustc_mir_transform/src/sroa.rs:302 — ReplacementVisitor::visit_statement has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · MarkSymbolVisitor · ×1
  • MarkSymbolVisitor::visit_node (cyclomatic 21) compiler/rustc_passes/src/dead.rs:469 — MarkSymbolVisitor::visit_node has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · PathSource · ×1
  • PathSource::descr_expected (cyclomatic 21) compiler/rustc_resolve/src/late.rs:529 — PathSource::descr_expected has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: PathSource::is_expected (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Hir2Qmm · ×1
  • Hir2Qmm::run (cyclomatic 21) src/tools/clippy/clippy_lints/src/booleans.rs:261 — Hir2Qmm::run has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PeekableVisitor · ×1
  • PeekableVisitor::visit_expr (cyclomatic 21) src/tools/clippy/clippy_lints/src/unused_peekable.rs:118 — PeekableVisitor::visit_expr has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · clippy · ×1
  • clippy::driver::main (cyclomatic 21) src/tools/clippy/src/driver.rs:196 — clippy::driver::main has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · NotifyActor · ×1
  • NotifyActor::run (cyclomatic 21) src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs:99 — NotifyActor::run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlFlow · ×1
  • ControlFlow::rewrite_cond (cyclomatic 21) src/tools/rustfmt/src/expr.rs:981 — ControlFlow::rewrite_cond has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RustBuild.download_toolchain (cyclomatic 21) · ×1
  • RustBuild.download_toolchain (cyclomatic 21) src/bootstrap/bootstrap.py:603 — RustBuild.download_toolchain has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrefixTrie.substringMatches (cyclomatic 21) · ×1
  • PrefixTrie.substringMatches (cyclomatic 21) src/librustdoc/html/static/js/stringdex.js:1947 — PrefixTrie.substringMatches has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CrateInfo · ×1
  • CrateInfo::new (cyclomatic 20) compiler/rustc_codegen_ssa/src/base.rs:1019 — CrateInfo::new has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · IfLetRescope · ×1
  • IfLetRescope::probe_if_cascade (cyclomatic 20) compiler/rustc_lint/src/if_let_rescope.rs:121 — IfLetRescope::probe_if_cascade has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Map · ×1
  • Map::propagate_assignments (cyclomatic 20) compiler/rustc_mir_dataflow/src/value_analysis.rs:393 — Map::propagate_assignments has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConstPropagator · ×1
  • ConstPropagator::eval_rvalue (cyclomatic 20) compiler/rustc_mir_transform/src/known_panics_lint.rs:542 — ConstPropagator::eval_rvalue has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MissingStabilityAnnotations · ×1
  • MissingStabilityAnnotations::check_compatible_stability (cyclomatic 20) compiler/rustc_passes/src/stability.rs:323 — MissingStabilityAnnotations::check_compatible_stability has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Wildcard · ×1
  • Wildcard::from_str (cyclomatic 20) library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs:67 — Wildcard::from_str has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Wildcard::fmt (cyclomatic 34) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Libunwind · ×1
  • Libunwind::run (cyclomatic 20) src/bootstrap/src/core/build_steps/llvm.rs:2095 — Libunwind::run has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: bootstrap::core::build_steps::llvm::supported_sanitizers (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · HirCollector · ×1
  • HirCollector::visit_testable (cyclomatic 20) src/librustdoc/doctest/rust.rs:115 — HirCollector::visit_testable has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NumericFallbackVisitor · ×1
  • NumericFallbackVisitor::visit_expr (cyclomatic 20) src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs:128 — NumericFallbackVisitor::visit_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FloatLiteral · ×1
  • FloatLiteral::check_expr (cyclomatic 20) src/tools/clippy/clippy_lints/src/float_literal.rs:78 — FloatLiteral::check_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DecimalLiteralRepresentation · ×1
  • DecimalLiteralRepresentation::do_lint (cyclomatic 20) src/tools/clippy/clippy_lints/src/literal_representation.rs:455 — DecimalLiteralRepresentation::do_lint has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · OnlyUsedInRecursion · ×1
  • OnlyUsedInRecursion::check_expr (cyclomatic 20) src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs:365 — OnlyUsedInRecursion::check_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · PassByRefOrValue · ×1
  • PassByRefOrValue::check_poly_fn (cyclomatic 20) src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs:128 — PassByRefOrValue::check_poly_fn has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SingleComponentPathImports · ×1
  • SingleComponentPathImports::track_uses (cyclomatic 20) src/tools/clippy/clippy_lints/src/single_component_path_imports.rs:171 — SingleComponentPathImports::track_uses has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VecPushSearcher · ×1
  • VecPushSearcher::display_err (cyclomatic 20) src/tools/clippy/clippy_lints/src/vec_init_then_push.rs:64 — VecPushSearcher::display_err has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · WaitFinder · ×1
  • WaitFinder::visit_expr (cyclomatic 20) src/tools/clippy/clippy_lints/src/zombie_processes.rs:161 — WaitFinder::visit_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChromeLayer · ×1
  • ChromeLayer::new (cyclomatic 20) src/tools/miri/src/bin/log/tracing_chrome.rs:335 — ChromeLayer::new has cyclomatic complexity 20 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D1 · Cyclomatic Complexity · SolverContext · ×1
  • SolverContext::compute_goal_fast_path (cyclomatic 20) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/solver.rs:285 — SolverContext::compute_goal_fast_path has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChainFormatterShared · ×1
  • ChainFormatterShared::format_last_child (cyclomatic 20) src/tools/rustfmt/src/chains.rs:727 — ChainFormatterShared::format_last_child has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · debug.getDebugConfiguration (cyclomatic 20) · ×1
  • debug.getDebugConfiguration (cyclomatic 20) src/tools/rust-analyzer/editors/code/src/debug.ts:81 — debug.getDebugConfiguration has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Reg · ×1
  • Reg::llvm_type (cyclomatic 19) compiler/rustc_codegen_llvm/src/abi.rs:140 — Reg::llvm_type has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LitKind · ×1
  • LitKind::from_token_lit (cyclomatic 19) compiler/rustc_ast/src/util/literal.rs:68 — LitKind::from_token_lit has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rustc_incremental · ×1
  • rustc_incremental::persist::fs::garbage_collect_session_directories (cyclomatic 19) compiler/rustc_incremental/src/persist/fs.rs:555 — rustc_incremental::persist::fs::garbage_collect_session_directories has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Newtype · ×1
  • Newtype::parse (cyclomatic 19) compiler/rustc_index_macros/src/newtype.rs:11 — Newtype::parse has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MirDumper · ×1
  • MirDumper::dump_path (cyclomatic 19) compiler/rustc_middle/src/mir/pretty.rs:201 — MirDumper::dump_path has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: TerminatorKind::fmt_successor_labels (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LegacySymbolMangler · ×1
  • LegacySymbolMangler::write_str (cyclomatic 19) compiler/rustc_symbol_mangling/src/legacy.rs:512 — LegacySymbolMangler::write_str has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · proc_macro · ×1
  • proc_macro::quote::quote (cyclomatic 19) library/proc_macro/src/quote.rs:279 — proc_macro::quote::quote has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Expression · ×1
  • Expression::build (cyclomatic 19) library/stdarch/crates/stdarch-gen-arm/src/expression.rs:195 — Expression::build has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Expression::requires_unsafe_wrapper (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Type · ×1
  • Type::is_doc_subtype_of (cyclomatic 19) src/librustdoc/clean/types.rs:1472 — Type::is_doc_subtype_of has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: PrimitiveType::as_sym (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SelfTyHead · ×1
  • SelfTyHead::of (cyclomatic 19) src/librustdoc/passes/collect_trait_impls.rs:180 — SelfTyHead::of has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LiteralDigitGrouping · ×1
  • LiteralDigitGrouping::check_for_mistyped_suffix (cyclomatic 19) src/tools/clippy/clippy_lints/src/literal_representation.rs:278 — LiteralDigitGrouping::check_for_mistyped_suffix has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NeedlessPassByRefMut · ×1
  • NeedlessPassByRefMut::check_fn (cyclomatic 19) src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs:123 — NeedlessPassByRefMut::check_fn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NewPermission · ×1
  • NewPermission::new (cyclomatic 19) src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs:126 — NewPermission::new has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BuiltinDeriveImplTrait · ×1
  • BuiltinDeriveImplTrait::get_method (cyclomatic 19) src/tools/rust-analyzer/crates/hir-def/src/builtin_derive.rs:45 — BuiltinDeriveImplTrait::get_method has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MirEvalError · ×1
  • MirEvalError::pretty_print (cyclomatic 19) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty/errors.rs:112 — MirEvalError::pretty_print has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ProjectFolders · ×1
  • ProjectFolders::new (cyclomatic 19) src/tools/rust-analyzer/crates/load-cargo/src/lib.rs:215 — ProjectFolders::new has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · main.handleShortcut (cyclomatic 19) · ×1
  • main.handleShortcut (cyclomatic 19) src/librustdoc/html/static/js/main.js:647 — main.handleShortcut has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · main.register_implementors (cyclomatic 19) · ×1
  • main.register_implementors (cyclomatic 19) src/librustdoc/html/static/js/main.js:796 — main.register_implementors has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SuffixTrie.substringMatches (cyclomatic 19) · ×1
  • SuffixTrie.substringMatches (cyclomatic 19) src/librustdoc/html/static/js/stringdex.js:2447 — SuffixTrie.substringMatches has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TyAndLayout · ×1
  • TyAndLayout::homogeneous_aggregate (cyclomatic 18) compiler/rustc_abi/src/callconv.rs:69 — TyAndLayout::homogeneous_aggregate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinkingFailed · ×1
  • LinkingFailed::into_diag (cyclomatic 18) compiler/rustc_codegen_ssa/src/diagnostics.rs:338 — LinkingFailed::into_diag has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ThorinErrorWrapper::into_diag (cyclomatic 40) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LexicalResolver · ×1
  • LexicalResolver::expansion (cyclomatic 18) compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:192 — LexicalResolver::expansion has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · NonLocalDefinitions · ×1
  • NonLocalDefinitions::check_item (cyclomatic 18) compiler/rustc_lint/src/non_local_def.rs:70 — NonLocalDefinitions::check_item has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CrateLocator · ×1
  • CrateLocator::extract_one (cyclomatic 18) compiler/rustc_metadata/src/locator.rs:573 — CrateLocator::extract_one has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AddCallGuards · ×1
  • AddCallGuards::run_pass (cyclomatic 18) compiler/rustc_mir_transform/src/add_call_guards.rs:33 — AddCallGuards::run_pass has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimplifyMatch · ×1
  • SimplifyMatch::unify_by_copy (cyclomatic 18) compiler/rustc_mir_transform/src/match_branches.rs:232 — SimplifyMatch::unify_by_copy has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NormalizesTo · ×1
  • NormalizesTo::consider_impl_candidate (cyclomatic 18) compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs:255 — NormalizesTo::consider_impl_candidate has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Utf8Chunks · ×1
  • Utf8Chunks::next (cyclomatic 18) library/core/src/str/lossy.rs:201 — Utf8Chunks::next has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DocTestBuilder · ×1
  • DocTestBuilder::generate_unique_doctest (cyclomatic 18) src/librustdoc/doctest/make.rs:322 — DocTestBuilder::generate_unique_doctest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinkReplacerInner · ×1
  • LinkReplacerInner::handle_event (cyclomatic 18) src/librustdoc/html/markdown.rs:393 — LinkReplacerInner::handle_event has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FindCalls · ×1
  • FindCalls::visit_expr (cyclomatic 18) src/librustdoc/scrape_examples.rs:130 — FindCalls::visit_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostExpansionEarlyAttributes · ×1
  • PostExpansionEarlyAttributes::check_attribute (cyclomatic 18) src/tools/clippy/clippy_lints/src/attrs/mod.rs:657 — PostExpansionEarlyAttributes::check_attribute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Default · ×1
  • Default::check_block (cyclomatic 18) src/tools/clippy/clippy_lints/src/default.rs:111 — Default::check_block has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InsertSearcher · ×1
  • InsertSearcher::visit_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/entry.rs:491 — InsertSearcher::visit_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · UselessFormat · ×1
  • UselessFormat::check_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/format.rs:55 — UselessFormat::check_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Loops · ×1
  • Loops::check_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/loops/mod.rs:859 — Loops::check_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InitializeVisitor · ×1
  • InitializeVisitor::visit_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/loops/utils.rs:173 — InitializeVisitor::visit_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ManualOptionAsSlice · ×1
  • ManualOptionAsSlice::check_expr (cyclomatic 18) src/tools/clippy/clippy_lints/src/manual_option_as_slice.rs:55 — ManualOptionAsSlice::check_expr has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · OffendingFilterExpr · ×1
  • OffendingFilterExpr::check_map_call (cyclomatic 18) src/tools/clippy/clippy_lints/src/methods/filter_map.rs:109 — OffendingFilterExpr::check_map_call has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · NewWithoutDefault · ×1
  • NewWithoutDefault::check_item (cyclomatic 18) src/tools/clippy/clippy_lints/src/new_without_default.rs:61 — NewWithoutDefault::check_item has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimilarNamesNameVisitor · ×1
  • SimilarNamesNameVisitor::check_ident (cyclomatic 18) src/tools/clippy/clippy_lints/src/non_expressive_names.rs:222 — SimilarNamesNameVisitor::check_ident has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MacroCallId · ×1
  • MacroCallId::expand_speculative (cyclomatic 18) src/tools/rust-analyzer/crates/hir-expand/src/lib.rs:783 — MacroCallId::expand_speculative has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MirBody · ×1
  • MirBody::walk_places (cyclomatic 18) src/tools/rust-analyzer/crates/hir-ty/src/mir.rs:1034 — MirBody::walk_places has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TtTreeSink · ×1
  • TtTreeSink::token (cyclomatic 18) src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs:933 — TtTreeSink::token has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ungrammar · ×1
  • ungrammar::lexer::advance (cyclomatic 18) src/tools/rust-analyzer/lib/ungrammar/src/lexer.rs:73 — ungrammar::lexer::advance has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · configure.parse_example_config (cyclomatic 18) · ×1
  • configure.parse_example_config (cyclomatic 18) src/bootstrap/configure.py:592 — configure.parse_example_config has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check_lldb.children_match (cyclomatic 18) · ×1
  • check_lldb.children_match (cyclomatic 18) src/etc/debugger_tester/lldb/check_lldb.py:393 — check_lldb.children_match has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · htmldocck.compare_tree (cyclomatic 18) · ×1
  • htmldocck.compare_tree (cyclomatic 18) REDACTED:389 — htmldocck.compare_tree has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrintState · ×1
  • PrintState::print_comment (cyclomatic 17) compiler/rustc_ast_pretty/src/pprust/state.rs:510 — PrintState::print_comment has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PrintState::token_kind_to_string_ext (cyclomatic 60) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ModuleConfig · ×1
  • ModuleConfig::new (cyclomatic 17) compiler/rustc_codegen_ssa/src/back/write.rs:117 — ModuleConfig::new has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · rustc_errors · ×1
  • rustc_errors::emitter::detect_confusion_type (cyclomatic 17) compiler/rustc_errors/src/emitter.rs:610 — rustc_errors::emitter::detect_confusion_type has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TtParser · ×1
  • TtParser::match_one (cyclomatic 17) compiler/rustc_expand/src/mbe/macro_parser.rs:498 — TtParser::match_one has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Coerce · ×1
  • Coerce::coerce (cyclomatic 17) compiler/rustc_hir_typeck/src/coercion.rs:242 — Coerce::coerce has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LintStore · ×1
  • LintStore::check_lint_name (cyclomatic 17) compiler/rustc_lint/src/context.rs:343 — LintStore::check_lint_name has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NormalInliner · ×1
  • NormalInliner::check_callee_mir_body (cyclomatic 17) compiler/rustc_mir_transform/src/inline.rs:352 — NormalInliner::check_callee_mir_body has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MaybeTransmutableQuery · ×1
  • MaybeTransmutableQuery::answer_impl (cyclomatic 17) compiler/rustc_transmute/src/maybe_transmutable/mod.rs:170 — MaybeTransmutableQuery::answer_impl has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · symcheck · ×1
  • symcheck::check_elf_exe_stack (cyclomatic 17) library/compiler-builtins/crates/symcheck/src/main.rs:808 — symcheck::check_elf_exe_stack has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: symcheck::verify_expected_target (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Rustc · ×1
  • Rustc::run (cyclomatic 17) src/bootstrap/src/core/build_steps/dist.rs:529 — Rustc::run has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (prepare_image). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · DeferredCommand · ×1
  • DeferredCommand::finish_process (cyclomatic 17) src/bootstrap/src/utils/exec.rs:840 — DeferredCommand::finish_process has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · citool · ×1
  • citool::analysis::report_test_diffs (cyclomatic 17) src/ci/citool/src/analysis.rs:454 — citool::analysis::report_test_diffs has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CodeBlocks · ×1
  • CodeBlocks::next (cyclomatic 17) src/librustdoc/html/markdown.rs:235 — CodeBlocks::next has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TagIterator · ×1
  • TagIterator::parse_outside_attribute_block (cyclomatic 17) src/librustdoc/html/markdown.rs:1147 — TagIterator::parse_outside_attribute_block has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NonminimalBoolVisitor · ×1
  • NonminimalBoolVisitor::bool_expr (cyclomatic 17) src/tools/clippy/clippy_lints/src/booleans.rs:537 — NonminimalBoolVisitor::bool_expr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Documentation · ×1
  • Documentation::check_attributes (cyclomatic 17) src/tools/clippy/clippy_lints/src/doc/mod.rs:754 — Documentation::check_attributes has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LenZero · ×1
  • LenZero::check_expr (cyclomatic 17) src/tools/clippy/clippy_lints/src/len_zero.rs:103 — LenZero::check_expr has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · NeedlessLateInit · ×1
  • NeedlessLateInit::check_if_or_match (cyclomatic 17) src/tools/clippy/clippy_lints/src/needless_late_init.rs:81 — NeedlessLateInit::check_if_or_match has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Constant · ×1
  • Constant::partial_cmp (cyclomatic 17) src/tools/clippy/clippy_utils/src/consts.rs:218 — Constant::partial_cmp has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DisplayRepr · ×1
  • DisplayRepr::print (cyclomatic 17) src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs:691 — DisplayRepr::print has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CargoWorkspace · ×1
  • CargoWorkspace::new (cyclomatic 17) src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs:307 — CargoWorkspace::new has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · common.from_dict (cyclomatic 17) · ×1
  • common.from_dict (cyclomatic 17) src/etc/debugger_tester/common.py:92 — common.from_dict has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DocSearch.parseQuery · ×1
  • DocSearch.parseQuery::parseInput (cyclomatic 17) REDACTED:1419 — DocSearch.parseQuery::parseInput has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · settings.changeSetting (cyclomatic 17) · ×1
  • settings.changeSetting (cyclomatic 17) src/librustdoc/html/static/js/settings.js:19 — settings.changeSetting has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InlineNeighborsTree.decode (cyclomatic 17) · ×1
  • InlineNeighborsTree.decode (cyclomatic 17) src/librustdoc/html/static/js/stringdex.js:2597 — InlineNeighborsTree.decode has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_abi · ×1
  • rustc_abi::layout::coroutine::coroutine_saved_local_eligibility (cyclomatic 16) compiler/rustc_abi/src/layout/coroutine.rs:42 — rustc_abi::layout::coroutine::coroutine_saved_local_eligibility has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnwindContext · ×1
  • UnwindContext::add_function (cyclomatic 16) compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs:117 — UnwindContext::add_function has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · MatchVisitor · ×1
  • MatchVisitor::check_match (cyclomatic 16) compiler/rustc_mir_build/src/thir/pattern/check_match.rs:495 — MatchVisitor::check_match has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rustc_mir_dataflow · ×1
  • rustc_mir_dataflow::impls::precise_liveness::liveness_matrix (cyclomatic 16) compiler/rustc_mir_dataflow/src/impls/precise_liveness.rs:429 — rustc_mir_dataflow::impls::precise_liveness::liveness_matrix has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · DropsReachable · ×1
  • DropsReachable::visit (cyclomatic 16) compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:59 — DropsReachable::visit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RootCollector · ×1
  • RootCollector::process_item (cyclomatic 16) compiler/rustc_monomorphize/src/collector.rs:1604 — RootCollector::process_item has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PlaceInfo · ×1
  • PlaceInfo::split_column_ctors (cyclomatic 16) compiler/rustc_pattern_analysis/src/usefulness.rs:924 — PlaceInfo::split_column_ctors has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · OutlivesCollector · ×1
  • OutlivesCollector::visit_ty (cyclomatic 16) compiler/rustc_type_ir/src/outlives.rs:77 — OutlivesCollector::visit_ty has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Copier · ×1
  • Copier::copy (cyclomatic 16) library/std/src/sys/io/kernel_copy/linux.rs:274 — Copier::copy has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ClassStack · ×1
  • ClassStack::push (cyclomatic 16) src/librustdoc/html/highlight.rs:263 — ClassStack::push has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Class::as_html (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ImplStripper · ×1
  • ImplStripper::fold_item (cyclomatic 16) src/librustdoc/passes/stripper.rs:208 — ImplStripper::fold_item has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NoEffect · ×1
  • NoEffect::check_no_effect (cyclomatic 16) src/tools/clippy/clippy_lints/src/no_effect.rs:121 — NoEffect::check_no_effect has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PanicUnimplemented · ×1
  • PanicUnimplemented::check_expr (cyclomatic 16) src/tools/clippy/clippy_lints/src/panic_unimplemented.rs:107 — PanicUnimplemented::check_expr has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QuestionMark · ×1
  • QuestionMark::check_manual_let_else (cyclomatic 16) src/tools/clippy/clippy_lints/src/manual_let_else.rs:52 — QuestionMark::check_manual_let_else has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnnecessaryWraps · ×1
  • UnnecessaryWraps::check_fn (cyclomatic 16) src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs:77 — UnnecessaryWraps::check_fn has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CrateWithSource · ×1
  • CrateWithSource::download_and_extract (cyclomatic 16) src/tools/clippy/lintcheck/src/input.rs:182 — CrateWithSource::download_and_extract has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Crate · ×1
  • Crate::run_clippy_lints (cyclomatic 16) src/tools/clippy/lintcheck/src/main.rs:68 — Crate::run_clippy_lints has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VClockAlloc · ×1
  • VClockAlloc::report_data_race (cyclomatic 16) src/tools/miri/src/concurrency/data_race.rs:1111 — VClockAlloc::report_data_race has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DefMap · ×1
  • DefMap::resolve_path_fp_with_macro_single (cyclomatic 16) src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs:242 — DefMap::resolve_path_fp_with_macro_single has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · FunctionSignature · ×1
  • FunctionSignature::with_source_map (cyclomatic 16) src/tools/rust-analyzer/crates/hir-def/src/signatures.rs:631 — FunctionSignature::with_source_map has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Filler · ×1
  • Filler::fill_body (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/mir/monomorphization.rs:162 — Filler::fill_body has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Generalizer · ×1
  • Generalizer::tys (cyclomatic 16) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/relate/generalize.rs:434 — Generalizer::tys has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CompletionContext · ×1
  • CompletionContext::new (cyclomatic 16) src/tools/rust-analyzer/crates/ide-completion/src/context.rs:756 — CompletionContext::new has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProjectWorkspace · ×1
  • ProjectWorkspace::load_cargo (cyclomatic 16) src/tools/rust-analyzer/crates/project-model/src/workspace.rs:209 — ProjectWorkspace::load_cargo has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AstIdMap · ×1
  • AstIdMap::from_source (cyclomatic 16) src/tools/rust-analyzer/crates/span/src/ast_id.rs:633 — AstIdMap::from_source has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ErasedFileAstIdKind::syntax_kind (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MacroBranch · ×1
  • MacroBranch::rewrite (cyclomatic 16) src/tools/rustfmt/src/macros.rs:1306 — MacroBranch::rewrite has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · check_intrinsics_duplicates.check_duplicates (cyclomatic 16) · ×1
  • check_intrinsics_duplicates.check_duplicates (cyclomatic 16) compiler/rustc_codegen_gcc/tools/check_intrinsics_duplicates.py:4 — check_intrinsics_duplicates.check_duplicates has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bootstrap.bootstrap (cyclomatic 16) · ×1
  • bootstrap.bootstrap (cyclomatic 16) src/bootstrap/bootstrap.py:1332 — bootstrap.bootstrap has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · configure.parse_args (cyclomatic 16) · ×1
  • configure.parse_args (cyclomatic 16) src/bootstrap/configure.py:401 — configure.parse_args has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.handleHashes (cyclomatic 16) · ×1
  • main.handleHashes (cyclomatic 16) src/librustdoc/html/static/js/main.js:545 — main.handleHashes has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tester.runSearch (cyclomatic 16) · ×1
  • tester.runSearch (cyclomatic 16) src/tools/rustdoc-js/tester.js:239 — tester.runSearch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D12 · Dependency Hygiene · Yanked release · ×1
  • Yanked release: aes — `aes` resolves to 0.9.0 in the committed REDACTED, and crates.io reports that release as YANKED. A yanked release is one the publisher has withdrawn and asked you to stop using; it keeps resolving only so existing locks do not break. The current stable release is 0.9.3. Run `cargo update -p aes` and commit the updated lock.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: src/tools/clippy/clippy_lints/src/functions/must_use.rs src/tools/clippy/clippy_lints/src/functions/must_use.rs:142 — src/tools/clippy/clippy_lints/src/functions/must_use.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is clippy_lints::functions::must_use::check_needless_must_use at line 142), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Revert "Remove indirection for `Expr` in `Body`"”; “Fix clippy”; “fix clippy imports”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 20:18:47 +00:00' --until='2026-10-25 20:18:47 +00:00' --full-history --no-merges -- src/tools/clippy/clippy_lints/src/functions/must_use.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D17 · Explicit Debt · FixmeComment repeated across 50 files · ×1
  • FixmeComment repeated across 50 files tests/ui/union/union-drop-assign.rs:7 — The identical FixmeComment appears in 50 files (50 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 50 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(static_mut_refs): use raw pointers instead of references". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 77 files · ×1
  • FixmeComment repeated across 77 files tests/ui/uninhabited/privately-uninhabited-dead-code.rs:1 — The identical FixmeComment appears in 77 files (77 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 77 independent debts. Fix the systemic cause once rather than file-by-file. Text: "//@ build-pass (FIXME(62277): could be check-pass?)". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 25 files · ×1
  • FixmeComment repeated across 25 files tests/ui/threads-sendsync/sync-send-iterators-in-libcore.rs:104 — The identical FixmeComment appears in 25 files (35 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 35 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 39 files · ×1
  • FixmeComment repeated across 39 files tests/ui/eii/eii_impl_with_contract.rs:2 — The identical FixmeComment appears in 39 files (39 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 39 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(#125418): linking on Windows GNU targets is not yet supported.". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 11 files · ×1
  • FixmeComment repeated across 11 files tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs:1 — The identical FixmeComment appears in 11 files (11 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 11 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME: if/when the output of the test harness can be tested on its own, this test should be". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 59 files · ×1
  • FixmeComment repeated across 59 files tests/run-make/wasm-unexpected-features/rmake.rs:2 — The identical FixmeComment appears in 59 files (59 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 59 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 38 files · ×1
  • FixmeComment repeated across 38 files tests/incremental/change_crate_dep_kind.rs:9 — The identical FixmeComment appears in 38 files (38 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 38 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(#62277): could be check-pass?". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · FixmeComment repeated across 12 files · ×1
  • FixmeComment repeated across 12 files src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/opaque_types/table.rs:42 — The identical FixmeComment appears in 12 files (15 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 15 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(#120456) - is `swap_remove` correct?". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D2 · Cognitive Complexity · stringdex.loadDatabase (cognitive 397) · ×1
  • stringdex.loadDatabase (cognitive 397) src/librustdoc/html/static/js/stringdex.js:1089 — stringdex.loadDatabase has cognitive complexity 397 (threshold 15). Drivers by points: if/else 221 (464 pts), loops 72 (159 pts), ternaries 17 (37 pts), boolean chains 26 (nesting depth added 350). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (stringdex.loadDatabase::loadColumnFromBytes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LangItem · ×1
  • LangItem::from_u32 (cognitive 226) compiler/rustc_attr_ir/src/lang_items.rs:93 — LangItem::from_u32 has cognitive complexity 226 (threshold 15). Drivers by points: if/else 226. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ThirBuildCx · ×1
  • ThirBuildCx::make_mirror_unadjusted (cognitive 181) compiler/rustc_mir_build/src/thir/cx/expr.rs:392 — ThirBuildCx::make_mirror_unadjusted has cognitive complexity 181 (threshold 15). Drivers by points: if/else 52 (105 pts), match/switch 22 (68 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 102). Of this number, 177 points are the body's own statements and 4 belong to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · search.initSearch (cognitive 169) · ×1
  • search.initSearch (cognitive 169) REDACTED:12 — search.initSearch has cognitive complexity 169 (threshold 15). Drivers by points: if/else 520 (918 pts), boolean chains 186, loops 92 (159 pts), ternaries 82 (129 pts), error handling 2 (3 pts) (nesting depth added 513). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 15 other methods here (search.initSearch::getItemsBefore, search.initSearch::getNextElem, search.initSearch::createQueryElement, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 16 times rather than 16 independent problems. Splitting this body alone leaves the other 15 exactly as they are. Where these are variations on one operation, the change that clears all 16 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Methods · ×1
  • Methods::check_methods (cognitive 166) src/tools/clippy/clippy_lints/src/methods/mod.rs:5438 — Methods::check_methods has cognitive complexity 166 (threshold 15). Drivers by points: if/else 36 (101 pts), match/switch 19 (59 pts), boolean chains 6 (nesting depth added 105). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Options · ×1
  • Options::from_matches (cognitive 116) src/librustdoc/config.rs:386 — Options::from_matches has cognitive complexity 116 (threshold 15). Drivers by points: if/else 41 (65 pts), match/switch 20 (34 pts), boolean chains 10, loops 4 (7 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BorrowExplanation · ×1
  • BorrowExplanation::add_explanation_to_diagnostic (cognitive 105) compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs:58 — BorrowExplanation::add_explanation_to_diagnostic has cognitive complexity 105 (threshold 15). Drivers by points: if/else 34 (83 pts), match/switch 6 (10 pts), boolean chains 8, loops 1 (4 pts) (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · main.register_type_impls (cognitive 97) · ×1
  • main.register_type_impls (cognitive 97) src/librustdoc/html/static/js/main.js:946 — main.register_type_impls has cognitive complexity 97 (threshold 15). Drivers by points: if/else 21 (43 pts), ternaries 13 (42 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 55). Of this number, 35 points are the body's own statements and 62 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FulfillProcessor · ×1
  • FulfillProcessor::process_obligation (cognitive 88) compiler/rustc_trait_selection/src/traits/fulfill.rs:381 — FulfillProcessor::process_obligation has cognitive complexity 88 (threshold 15). Drivers by points: if/else 19 (44 pts), match/switch 14 (41 pts), boolean chains 3 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Extended · ×1
  • Extended::run (cognitive 88) src/bootstrap/src/core/build_steps/dist.rs:1902 — Extended::run has cognitive complexity 88 (threshold 15). Drivers by points: if/else 56 (74 pts), boolean chains 7, loops 5 (7 pts) (nesting depth added 20). Of this number, 83 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MSVCEnumSyntheticProvider.update (cognitive 88) · ×1
  • MSVCEnumSyntheticProvider.update (cognitive 88) src/etc/lldb_providers.py:833 — MSVCEnumSyntheticProvider.update has cognitive complexity 88 (threshold 15). Drivers by points: if/else 22 (79 pts), loops 2 (4 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 61). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LowerIntrinsics · ×1
  • LowerIntrinsics::run_pass (cognitive 87) compiler/rustc_mir_transform/src/lower_intrinsics.rs:12 — LowerIntrinsics::run_pass has cognitive complexity 87 (threshold 15). Drivers by points: if/else 18 (61 pts), match/switch 6 (23 pts), boolean chains 2, loops 1 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UselessConversion · ×1
  • UselessConversion::check_expr (cognitive 83) src/tools/clippy/clippy_lints/src/useless_conversion.rs:158 — UselessConversion::check_expr has cognitive complexity 83 (threshold 15). Drivers by points: if/else 25 (63 pts), boolean chains 15, match/switch 2 (5 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PrefixTrie.prefixMatches (cognitive 83) · ×1
  • PrefixTrie.prefixMatches (cognitive 83) src/librustdoc/html/static/js/stringdex.js:2031 — PrefixTrie.prefixMatches has cognitive complexity 83 (threshold 15). Drivers by points: if/else 16 (50 pts), loops 9 (21 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Assemble · ×1
  • Assemble::run (cognitive 79) src/bootstrap/src/core/build_steps/compile.rs:2120 — Assemble::run has cognitive complexity 79 (threshold 15). Drivers by points: if/else 30 (56 pts), loops 6 (14 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Llvm · ×1
  • Llvm::run (cognitive 77) src/bootstrap/src/core/build_steps/llvm.rs:440 — Llvm::run has cognitive complexity 77 (threshold 15). Drivers by points: if/else 51 (58 pts), boolean chains 12, match/switch 5 (6 pts), loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CompileTimeMachine · ×1
  • CompileTimeMachine::call_intrinsic (cognitive 76) compiler/rustc_const_eval/src/const_eval/machine.rs:477 — CompileTimeMachine::call_intrinsic has cognitive complexity 76 (threshold 15). Drivers by points: if/else 37 (62 pts), match/switch 6 (10 pts), boolean chains 4 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiagnosticsCollector · ×1
  • DiagnosticsCollector::collect_impl (cognitive 75) src/tools/rust-analyzer/crates/hir/src/diagnostics.rs:924 — DiagnosticsCollector::collect_impl has cognitive complexity 75 (threshold 15). Drivers by points: if/else 16 (45 pts), match/switch 4 (12 pts), loops 3 (11 pts), boolean chains 7 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Path · ×1
  • Path::hir_fmt (cognitive 73) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:2681 — Path::hir_fmt has cognitive complexity 73 (threshold 15). Drivers by points: if/else 14 (42 pts), match/switch 5 (18 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrefixTrie.substringMatches (cognitive 70) · ×1
  • PrefixTrie.substringMatches (cognitive 70) src/librustdoc/html/static/js/stringdex.js:1947 — PrefixTrie.substringMatches has cognitive complexity 70 (threshold 15). Drivers by points: if/else 14 (45 pts), loops 8 (21 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommentRewrite · ×1
  • CommentRewrite::handle_line (cognitive 69) src/tools/rustfmt/src/comment.rs:713 — CommentRewrite::handle_line has cognitive complexity 69 (threshold 15). Drivers by points: if/else 29 (48 pts), boolean chains 11, match/switch 4 (10 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexingSlicing · ×1
  • IndexingSlicing::check_expr (cognitive 68) src/tools/clippy/clippy_lints/src/indexing_slicing.rs:111 — IndexingSlicing::check_expr has cognitive complexity 68 (threshold 15). Drivers by points: if/else 18 (58 pts), boolean chains 7, match/switch 1 (3 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ConstructorSet · ×1
  • ConstructorSet::split (cognitive 67) compiler/rustc_pattern_analysis/src/constructor.rs:1044 — ConstructorSet::split has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (38 pts), loops 7 (14 pts), match/switch 6 (14 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DerefDelegate · ×1
  • DerefDelegate::borrow (cognitive 67) src/tools/clippy/clippy_utils/src/sugg.rs:937 — DerefDelegate::borrow has cognitive complexity 67 (threshold 15). Drivers by points: if/else 15 (47 pts), match/switch 3 (11 pts), loops 1 (5 pts), boolean chains 4 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InherentOverlapChecker · ×1
  • InherentOverlapChecker::check_item (cognitive 64) compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs:174 — InherentOverlapChecker::check_item has cognitive complexity 64 (threshold 15). Drivers by points: loops 11 (37 pts), if/else 9 (24 pts), match/switch 1 (3 pts) (nesting depth added 43). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Matches · ×1
  • Matches::check_expr (cognitive 63) src/tools/clippy/clippy_lints/src/matches/mod.rs:1055 — Matches::check_expr has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (51 pts), boolean chains 8, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Directive · ×1
  • Directive::check (cognitive 63) src/tools/jsondocck/src/directive.rs:203 — Directive::check has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (52 pts), loops 2 (6 pts), match/switch 3 (5 pts) (nesting depth added 40). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CheckLoopVisitor · ×1
  • CheckLoopVisitor::visit_expr (cognitive 61) compiler/rustc_hir_typeck/src/loops.rs:112 — CheckLoopVisitor::visit_expr has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (38 pts), match/switch 9 (21 pts), boolean chains 2 (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CacheBuilder · ×1
  • CacheBuilder::fold_item (cognitive 61) src/librustdoc/formats/cache.rs:301 — CacheBuilder::fold_item has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (38 pts), match/switch 6 (9 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 24). Of this number, 60 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SuffixTrie.substringMatches (cognitive 61) · ×1
  • SuffixTrie.substringMatches (cognitive 61) src/librustdoc/html/static/js/stringdex.js:2447 — SuffixTrie.substringMatches has cognitive complexity 61 (threshold 15). Drivers by points: if/else 12 (36 pts), loops 8 (21 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Canonicalized · ×1
  • Canonicalized::canonicalize (cognitive 60) src/tools/unicode-table-generator/src/raw_emitter.rs:198 — Canonicalized::canonicalize has cognitive complexity 60 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 13 (29 pts), match/switch 2 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · intersection (cognitive 60) · ×1
  • intersection (cognitive 60) src/librustdoc/html/static/js/stringdex.js:486 — intersection has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 4 (14 pts), boolean chains 12, ternaries 2 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VisitOpaqueTypes · ×1
  • VisitOpaqueTypes::visit_ty (cognitive 58) compiler/rustc_lint/src/impl_trait_overcaptures.rs:245 — VisitOpaqueTypes::visit_ty has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (12 pts), match/switch 3 (9 pts), boolean chains 4 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgMatrix · ×1
  • ArgMatrix::find_issue (cognitive 57) compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs:163 — ArgMatrix::find_issue has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (43 pts), loops 5 (9 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SizeSkeleton · ×1
  • SizeSkeleton::compute_inner (cognitive 57) compiler/rustc_middle/src/ty/layout.rs:358 — SizeSkeleton::compute_inner has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (32 pts), match/switch 10 (20 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scip · ×1
  • Scip::run (cognitive 57) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:24 — Scip::run has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (40 pts), match/switch 3 (9 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Rvalue · ×1
  • Rvalue::fmt (cognitive 56) compiler/rustc_middle/src/mir/pretty.rs:1148 — Rvalue::fmt has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 6 (22 pts), match/switch 5 (11 pts), boolean chains 1 (nesting depth added 33). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Cargo · ×1
  • Cargo::configure_linker (cognitive 55) src/bootstrap/src/core/builder/cargo.rs:317 — Cargo::configure_linker has cognitive complexity 55 (threshold 15). Drivers by points: if/else 22 (39 pts), match/switch 4 (8 pts), boolean chains 5, loops 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IfLetRescope · ×1
  • IfLetRescope::probe_if_cascade (cognitive 54) compiler/rustc_lint/src/if_let_rescope.rs:121 — IfLetRescope::probe_if_cascade has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (50 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NeedsDropTypes · ×1
  • NeedsDropTypes::next (cognitive 54) compiler/rustc_ty_utils/src/needs_drop.rs:176 — NeedsDropTypes::next has cognitive complexity 54 (threshold 15). Drivers by points: loops 7 (26 pts), if/else 7 (19 pts), match/switch 3 (9 pts) (nesting depth added 37). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TargetDataLayout · ×1
  • TargetDataLayout::parse_from_llvm_datalayout_string (cognitive 52) compiler/rustc_abi/src/lib.rs:452 — TargetDataLayout::parse_from_llvm_datalayout_string has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (39 pts), match/switch 4 (10 pts), boolean chains 2, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Map · ×1
  • Map::propagate_assignments (cognitive 52) compiler/rustc_mir_dataflow/src/value_analysis.rs:393 — Map::propagate_assignments has cognitive complexity 52 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 7 (16 pts), match/switch 2 (7 pts), boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TransformTy · ×1
  • TransformTy::fold_ty (cognitive 52) compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs:52 — TransformTy::fold_ty has cognitive complexity 52 (threshold 15). Drivers by points: if/else 23 (41 pts), match/switch 4 (9 pts), boolean chains 2 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · HirCollector · ×1
  • HirCollector::visit_testable (cognitive 51) src/librustdoc/doctest/rust.rs:115 — HirCollector::visit_testable has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 4 (12 pts), match/switch 1 (7 pts), boolean chains 2 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LocalizedConstraintGraph · ×1
  • LocalizedConstraintGraph::traverse (cognitive 50) compiler/rustc_borrowck/src/polonius/constraints.rs:100 — LocalizedConstraintGraph::traverse has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 6 (19 pts), boolean chains 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinkingFailed · ×1
  • LinkingFailed::into_diag (cognitive 50) compiler/rustc_codegen_ssa/src/diagnostics.rs:338 — LinkingFailed::into_diag has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · valueCheck (cognitive 50) · ×1
  • valueCheck (cognitive 50) src/tools/rustdoc-js/tester.js:156 — valueCheck has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 5 (10 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InterPat · ×1
  • InterPat::lower_thir_pat (cognitive 49) compiler/rustc_mir_build/src/builder/matches/match_pair.rs:209 — InterPat::lower_thir_pat has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 4 (9 pts), match/switch 5 (8 pts), boolean chains 5 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleComponentPathImports · ×1
  • SingleComponentPathImports::track_uses (cognitive 49) src/tools/clippy/clippy_lints/src/single_component_path_imports.rs:171 — SingleComponentPathImports::track_uses has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (38 pts), loops 2 (8 pts), boolean chains 2, match/switch 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · unicode_table_generator · ×1
  • unicode_table_generator::load_data (cognitive 49) src/tools/unicode-table-generator/src/main.rs:137 — unicode_table_generator::load_data has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 8, boolean chains 3, match/switch 1 (3 pts) (nesting depth added 16). Of this number, 46 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bootstrap.default_build_triple (cognitive 49) · ×1
  • bootstrap.default_build_triple (cognitive 49) src/bootstrap/bootstrap.py:280 — bootstrap.default_build_triple has cognitive complexity 49 (threshold 15). Drivers by points: if/else 28 (44 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RoaringBitmap.union (cognitive 49) · ×1
  • RoaringBitmap.union (cognitive 49) src/librustdoc/html/static/js/stringdex.js:363 — RoaringBitmap.union has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 14, loops 4 (13 pts), ternaries 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeepRejectCtxt · ×1
  • DeepRejectCtxt::types_may_unify_inner (cognitive 48) compiler/rustc_type_ir/src/fast_reject.rs:263 — DeepRejectCtxt::types_may_unify_inner has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 16 (30 pts), boolean chains 14, if/else 3 (4 pts) (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SymbolCollector · ×1
  • SymbolCollector::collect_from_module (cognitive 48) src/tools/rust-analyzer/crates/hir/src/symbols.rs:197 — SymbolCollector::collect_from_module has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 9 (16 pts), loops 8 (10 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImportMap · ×1
  • ImportMap::collect_import_map (cognitive 48) src/tools/rust-analyzer/crates/hir-def/src/import_map.rs:136 — ImportMap::collect_import_map has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 4 (20 pts), loops 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CharClasses · ×1
  • CharClasses::next (cognitive 48) src/tools/rustfmt/src/comment.rs:1394 — CharClasses::next has cognitive complexity 48 (threshold 15). Drivers by points: match/switch 13 (29 pts), if/else 10 (16 pts), boolean chains 3 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · check_intrinsics_duplicates.check_duplicates (cognitive 48) · ×1
  • check_intrinsics_duplicates.check_duplicates (cognitive 48) compiler/rustc_codegen_gcc/tools/check_intrinsics_duplicates.py:4 — check_intrinsics_duplicates.check_duplicates has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 4 (10 pts), ternaries 2 (8 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_lldb.var_matches (cognitive 48) · ×1
  • check_lldb.var_matches (cognitive 48) src/etc/debugger_tester/lldb/check_lldb.py:199 — check_lldb.var_matches has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 6, error handling 2 (6 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiagCtxtInner · ×1
  • DiagCtxtInner::emit_diagnostic (cognitive 47) compiler/rustc_errors/src/lib.rs:1203 — DiagCtxtInner::emit_diagnostic has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (39 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NewWithoutDefault · ×1
  • NewWithoutDefault::check_item (cognitive 47) src/tools/clippy/clippy_lints/src/new_without_default.rs:61 — NewWithoutDefault::check_item has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 4 (12 pts), boolean chains 3 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · htmldocck.check_command (cognitive 47) · ×1
  • htmldocck.check_command (cognitive 47) REDACTED:520 — htmldocck.check_command has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (30 pts), error handling 5 (12 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · constructor (cognitive 47) · ×1
  • constructor (cognitive 47) src/librustdoc/html/static/js/stringdex.js:17 — constructor has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (25 pts), loops 6 (11 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ctx · ×1
  • Ctx::transform_path_ (cognitive 46) src/tools/rust-analyzer/crates/ide-db/src/path_transform.rs:355 — Ctx::transform_path_ has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SolverDelegate · ×1
  • SolverDelegate::compute_goal_fast_path (cognitive 45) compiler/rustc_trait_selection/src/solve/delegate.rs:152 — SolverDelegate::compute_goal_fast_path has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TokenStream · ×1
  • TokenStream::from_str (cognitive 45) src/tools/rust-analyzer/crates/proc-macro-srv/src/token_stream.rs:50 — TokenStream::from_str has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CrateError · ×1
  • CrateError::report (cognitive 44) compiler/rustc_metadata/src/locator.rs:1084 — CrateError::report has cognitive complexity 44 (threshold 15). Drivers by points: loops 7 (22 pts), if/else 12 (19 pts), match/switch 2 (3 pts) (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtHwcap · ×1
  • AtHwcap::cache (cognitive 44) library/std_detect/src/detect/os/linux/aarch64.rs:262 — AtHwcap::cache has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 42, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Default · ×1
  • Default::check_block (cognitive 44) src/tools/clippy/clippy_lints/src/default.rs:111 — Default::check_block has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · client.createClient (cognitive 44) · ×1
  • client.createClient (cognitive 44) src/tools/rust-analyzer/editors/code/src/client.ts:13 — client.createClient has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 6, match/switch 1 (5 pts), loops 2, ternaries 2 (nesting depth added 16). Most of this is not in the body itself: 4 of the 44 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 60, callback, a function literal at line 169, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · UnusedParens · ×1
  • UnusedParens::check_ty (cognitive 43) compiler/rustc_lint/src/unused.rs:956 — UnusedParens::check_ty has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (26 pts), match/switch 4 (8 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stdarch_verify · ×1
  • stdarch_verify::functions (cognitive 43) library/stdarch/crates/stdarch-verify/src/lib.rs:34 — stdarch_verify::functions has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 8 (13 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IterFunctionVisitor · ×1
  • IterFunctionVisitor::visit_expr (cognitive 43) src/tools/clippy/clippy_lints/src/methods/needless_collect.rs:512 — IterFunctionVisitor::visit_expr has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (29 pts), match/switch 2 (9 pts), boolean chains 5 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · assert_instr_macro · ×1
  • assert_instr_macro::assert_instr (cognitive 42) library/stdarch/crates/assert-instr-macro/src/lib.rs:20 — assert_instr_macro::assert_instr has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 6 (9 pts), boolean chains 2, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Validator · ×1
  • Validator::validate_rvalue (cognitive 40) compiler/rustc_mir_transform/src/promote_consts.rs:432 — Validator::validate_rvalue has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AddLifetimeParamsSuggestion · ×1
  • AddLifetimeParamsSuggestion::add_to_diag (cognitive 40) compiler/rustc_trait_selection/src/diagnostics.rs:608 — AddLifetimeParamsSuggestion::add_to_diag has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 2 (7 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · X86IntrinsicType · ×1
  • X86IntrinsicType::from_param (cognitive 40) library/stdarch/crates/intrinsic-test/src/x86/types.rs:196 — X86IntrinsicType::from_param has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 5 (12 pts), boolean chains 6 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RustBuild.download_toolchain (cognitive 40) · ×1
  • RustBuild.download_toolchain (cognitive 40) src/bootstrap/bootstrap.py:603 — RustBuild.download_toolchain has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 6, loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CondChecker · ×1
  • CondChecker::visit_expr (cognitive 39) compiler/rustc_parse/src/parser/expr.rs:4127 — CondChecker::visit_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 5 (14 pts), boolean chains 3 (nesting depth added 23). Of this number, 32 points are the body's own statements and 7 belong to 2 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InitializeVisitor · ×1
  • InitializeVisitor::visit_expr (cognitive 39) src/tools/clippy/clippy_lints/src/loops/utils.rs:173 — InitializeVisitor::visit_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 2 (8 pts), boolean chains 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Types · ×1
  • Types::check_ty (cognitive 39) src/tools/clippy/clippy_lints/src/types/mod.rs:575 — Types::check_ty has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (12 pts), match/switch 5 (9 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeprecatedParser · ×1
  • DeprecatedParser::convert (cognitive 38) compiler/rustc_attr_parsing/src/attributes/deprecation.rs:74 — DeprecatedParser::convert has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (27 pts), match/switch 3 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReplacementVisitor · ×1
  • ReplacementVisitor::visit_statement (cognitive 38) compiler/rustc_mir_transform/src/sroa.rs:302 — ReplacementVisitor::visit_statement has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (15 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WfPredicates · ×1
  • WfPredicates::visit_ty (cognitive 38) compiler/rustc_trait_selection/src/traits/wf.rs:741 — WfPredicates::visit_ty has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 2 (6 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StmtsChecker · ×1
  • StmtsChecker::visit_expr (cognitive 38) src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs:270 — StmtsChecker::visit_expr has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PeekableVisitor · ×1
  • PeekableVisitor::visit_expr (cognitive 38) src/tools/clippy/clippy_lints/src/unused_peekable.rs:118 — PeekableVisitor::visit_expr has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 3 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocSearch.buildItemSearchType (cognitive 38) · ×1
  • DocSearch.buildItemSearchType (cognitive 38) REDACTED:1998 — DocSearch.buildItemSearchType has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeStats · ×1
  • CodeStats::print_type_sizes (cognitive 37) compiler/rustc_session/src/code_stats.rs:111 — CodeStats::print_type_sizes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 3 (8 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PassByRefOrValue · ×1
  • PassByRefOrValue::check_poly_fn (cognitive 37) src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs:128 — PassByRefOrValue::check_poly_fn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 4 (11 pts), boolean chains 6, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TtTreeSink · ×1
  • TtTreeSink::token (cognitive 37) src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs:933 — TtTreeSink::token has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 7 (22 pts), if/else 5 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NonminimalBoolVisitor · ×1
  • NonminimalBoolVisitor::bool_expr (cognitive 36) src/tools/clippy/clippy_lints/src/booleans.rs:537 — NonminimalBoolVisitor::bool_expr has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (7 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NumericFallbackVisitor · ×1
  • NumericFallbackVisitor::visit_expr (cognitive 36) src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs:128 — NumericFallbackVisitor::visit_expr has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (12 pts), boolean chains 2, match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · main.register_implementors (cognitive 36) · ×1
  • main.register_implementors (cognitive 36) src/librustdoc/html/static/js/main.js:796 — main.register_implementors has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (7 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 18). Of this number, 29 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UselessFormat · ×1
  • UselessFormat::check_expr (cognitive 35) src/tools/clippy/clippy_lints/src/format.rs:55 — UselessFormat::check_expr has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (9 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChromeLayer · ×1
  • ChromeLayer::new (cognitive 35) src/tools/miri/src/bin/log/tracing_chrome.rs:335 — ChromeLayer::new has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 20). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · ExprValidator · ×1
  • ExprValidator::check_for_unnecessary_else (cognitive 35) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/expr.rs:502 — ExprValidator::check_for_unnecessary_else has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 1 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Filler · ×1
  • Filler::fill_body (cognitive 35) src/tools/rust-analyzer/crates/hir-ty/src/mir/monomorphization.rs:162 — Filler::fill_body has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 5 (20 pts), loops 5 (13 pts), if/else 1 (2 pts) (nesting depth added 24). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rustc_mir_dataflow · ×1
  • rustc_mir_dataflow::impls::precise_liveness::liveness_matrix (cognitive 34) compiler/rustc_mir_dataflow/src/impls/precise_liveness.rs:429 — rustc_mir_dataflow::impls::precise_liveness::liveness_matrix has cognitive complexity 34 (threshold 15). Drivers by points: loops 7 (17 pts), if/else 6 (14 pts), boolean chains 3 (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · AmdgpuInlineAsmReg · ×1
  • AmdgpuInlineAsmReg::parse (cognitive 34) compiler/rustc_target/src/asm/amdgpu.rs:293 — AmdgpuInlineAsmReg::parse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (34 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineAsmClobberAbi · ×1
  • InlineAsmClobberAbi::parse (cognitive 34) compiler/rustc_target/src/asm/mod.rs:1034 — InlineAsmClobberAbi::parse has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 14 (22 pts), if/else 6 (12 pts) (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WorkerThread · ×1
  • WorkerThread::wait_for_jobs (cognitive 34) compiler/rustc_thread_pool/src/registry.rs:809 — WorkerThread::wait_for_jobs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (8 pts), match/switch 1 (5 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Display · ×1
  • Display::fmt (cognitive 34) src/librustdoc/clean/cfg.rs:531 — Display::fmt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 8 (15 pts) (nesting depth added 15). Of this number, 32 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NormalizedPat · ×1
  • NormalizedPat::from_pat (cognitive 34) src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs:263 — NormalizedPat::from_pat has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 13 (29 pts), if/else 3 (5 pts) (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ProjectFolders · ×1
  • ProjectFolders::new (cognitive 34) src/tools/rust-analyzer/crates/load-cargo/src/lib.rs:215 — ProjectFolders::new has cognitive complexity 34 (threshold 15). Drivers by points: loops 10 (18 pts), if/else 5 (10 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ChainFormatterShared · ×1
  • ChainFormatterShared::format_last_child (cognitive 34) src/tools/rustfmt/src/chains.rs:727 — ChainFormatterShared::format_last_child has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 6, match/switch 1 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · configure.apply_args (cognitive 34) · ×1
  • configure.apply_args (cognitive 34) src/bootstrap/configure.py:507 — configure.apply_args has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoanInvalidationsGenerator · ×1
  • LoanInvalidationsGenerator::visit_terminator (cognitive 33) compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs:94 — LoanInvalidationsGenerator::visit_terminator has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (10 pts), match/switch 2 (4 pts) (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OrphanChecker · ×1
  • OrphanChecker::visit_ty (cognitive 33) compiler/rustc_next_trait_solver/src/coherence.rs:325 — OrphanChecker::visit_ty has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 6 (14 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NoEffect · ×1
  • NoEffect::check_no_effect (cognitive 33) src/tools/clippy/clippy_lints/src/no_effect.rs:121 — NoEffect::check_no_effect has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Matcher · ×1
  • Matcher::attempt_match_token_tree (cognitive 33) src/tools/rust-analyzer/crates/ide-ssr/src/matching.rs:443 — Matcher::attempt_match_token_tree has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_gdb.var_matches (cognitive 33) · ×1
  • check_gdb.var_matches (cognitive 33) src/etc/debugger_tester/gdb/check_gdb.py:125 — check_gdb.var_matches has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, error handling 2 (6 pts), loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AddCallGuards · ×1
  • AddCallGuards::run_pass (cognitive 32) compiler/rustc_mir_transform/src/add_call_guards.rs:33 — AddCallGuards::run_pass has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (9 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Utf8Chunks · ×1
  • Utf8Chunks::next (cognitive 32) library/core/src/str/lossy.rs:201 — Utf8Chunks::next has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 3 (11 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceToDefCtx · ×1
  • SourceToDefCtx::container_to_def (cognitive 32) src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs:616 — SourceToDefCtx::container_to_def has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModResolver · ×1
  • ModResolver::find_external_module (cognitive 32) src/tools/rustfmt/src/modules.rs:361 — ModResolver::find_external_module has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 5 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TyAndLayout · ×1
  • TyAndLayout::homogeneous_aggregate (cognitive 31) compiler/rustc_abi/src/callconv.rs:69 — TyAndLayout::homogeneous_aggregate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (8 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LinkParser · ×1
  • LinkParser::extend (cognitive 31) compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:80 — LinkParser::extend has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TypeLimits · ×1
  • TypeLimits::check_expr (cognitive 31) compiler/rustc_lint/src/types.rs:656 — TypeLimits::check_expr has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 10 (16 pts), if/else 5 (8 pts), boolean chains 7 (nesting depth added 9). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to 4 function items inside it that branch (check_limits, is_valid, rev_binop, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · proc_macro · ×1
  • proc_macro::quote::quote (cognitive 31) library/proc_macro/src/quote.rs:279 — proc_macro::quote::quote has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (9 pts), match/switch 3 (9 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChildListener · ×1
  • ChildListener::next (cognitive 31) src/tools/miri/src/shims/native_lib/trace/parent.rs:119 — ChildListener::next has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnsafeVisitor · ×1
  • UnsafeVisitor::walk_expr (cognitive 31) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/unsafe_check.rs:266 — UnsafeVisitor::walk_expr has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 5 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MirEvalError · ×1
  • MirEvalError::pretty_print (cognitive 31) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty/errors.rs:112 — MirEvalError::pretty_print has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 9 (28 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ControlFlow · ×1
  • ControlFlow::rewrite_cond (cognitive 31) src/tools/rustfmt/src/expr.rs:981 — ControlFlow::rewrite_cond has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 6, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SubdiagnosticVariant · ×1
  • SubdiagnosticVariant::from_attr (cognitive 30) compiler/rustc_macros/src/diagnostics/utils.rs:588 — SubdiagnosticVariant::from_attr has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 5 (7 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReachableContext · ×1
  • ReachableContext::propagate_node (cognitive 30) compiler/rustc_passes/src/reachable.rs:176 — ReachableContext::propagate_node has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MaybeTransmutableQuery · ×1
  • MaybeTransmutableQuery::answer_impl (cognitive 30) compiler/rustc_transmute/src/maybe_transmutable/mod.rs:170 — MaybeTransmutableQuery::answer_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpaqueTypeCollector · ×1
  • OpaqueTypeCollector::visit_ty (cognitive 30) compiler/rustc_ty_utils/src/opaque_types.rs:208 — OpaqueTypeCollector::visit_ty has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 1 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Zip · ×1
  • Zip::next_back (cognitive 30) library/core/src/iter/adapters/zip.rs:349 — Zip::next_back has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (10 pts), boolean chains 5 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MultipleInherentImpl · ×1
  • MultipleInherentImpl::check_crate_post (cognitive 30) src/tools/clippy/clippy_lints/src/inherent_impl.rs:71 — MultipleInherentImpl::check_crate_post has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (11 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opt_dist · ×1
  • opt_dist::execute_pipeline (cognitive 30) src/tools/opt-dist/src/main.rs:224 — opt_dist::execute_pipeline has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22 (24 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AstIdMap · ×1
  • AstIdMap::from_source (cognitive 30) src/tools/rust-analyzer/crates/span/src/ast_id.rs:633 — AstIdMap::from_source has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 3 (7 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RustBuild.build_bootstrap_cmd (cognitive 30) · ×1
  • RustBuild.build_bootstrap_cmd (cognitive 30) src/bootstrap/bootstrap.py:1067 — RustBuild.build_bootstrap_cmd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21 (22 pts), ternaries 4, boolean chains 2, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · batchmode.main (cognitive 30) · ×1
  • batchmode.main (cognitive 30) src/etc/debugger_tester/lldb/batchmode.py:214 — batchmode.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, error handling 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · htmldocck.compare_tree (cognitive 30) · ×1
  • htmldocck.compare_tree (cognitive 30) REDACTED:389 — htmldocck.compare_tree has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocSearch.parseQuery · ×1
  • DocSearch.parseQuery::parseInput (cognitive 30) REDACTED:1419 — DocSearch.parseQuery::parseInput has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocSearch.getRow (cognitive 30) · ×1
  • DocSearch.getRow (cognitive 30) REDACTED:1896 — DocSearch.getRow has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 9, if/else 2 (nesting depth added 2). Of this number, 26 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PrintState · ×1
  • PrintState::print_comment (cognitive 29) compiler/rustc_ast_pretty/src/pprust/state.rs:510 — PrintState::print_comment has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (8 pts), match/switch 2 (3 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LintParser · ×1
  • LintParser::parse (cognitive 29) compiler/rustc_attr_parsing/src/attributes/lint.rs:27 — LintParser::parse has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3 (12 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InvocationCollector · ×1
  • InvocationCollector::flat_map_node (cognitive 29) compiler/rustc_expand/src/expand.rs:2350 — InvocationCollector::flat_map_node has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 5 (16 pts), if/else 2 (7 pts), loops 2 (6 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LintStore · ×1
  • LintStore::check_lint_name (cognitive 29) compiler/rustc_lint/src/context.rs:343 — LintStore::check_lint_name has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UndefinedBehaviorInfo · ×1
  • UndefinedBehaviorInfo::fmt (cognitive 29) compiler/rustc_middle/src/mir/interpret/error.rs:437 — UndefinedBehaviorInfo::fmt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 2 (nesting depth added 12). Of this number, 26 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConstInt · ×1
  • ConstInt::fmt (cognitive 29) compiler/rustc_middle/src/ty/consts/int.rs:54 — ConstInt::fmt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 7 (14 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SearchGraph · ×1
  • SearchGraph::rebase_provisional_cache_entries (cognitive 29) compiler/rustc_type_ir/src/search_graph/mod.rs:1013 — SearchGraph::rebase_provisional_cache_entries has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (11 pts), match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TagIterator · ×1
  • TagIterator::parse_outside_attribute_block (cognitive 29) src/librustdoc/html/markdown.rs:1147 — TagIterator::parse_outside_attribute_block has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · configure.parse_args (cognitive 29) · ×1
  • configure.parse_args (cognitive 29) src/bootstrap/configure.py:401 — configure.parse_args has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Attribute · ×1
  • Attribute::rewrite_result (cognitive 28) src/tools/rustfmt/src/attr.rs:330 — Attribute::rewrite_result has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (12 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FindCalls · ×1
  • FindCalls::visit_expr (cognitive 28) src/librustdoc/scrape_examples.rs:130 — FindCalls::visit_expr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 5 (12 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FloatLiteral · ×1
  • FloatLiteral::check_expr (cognitive 28) src/tools/clippy/clippy_lints/src/float_literal.rs:78 — FloatLiteral::check_expr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 5, match/switch 2 (4 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FormatArgsExpr · ×1
  • FormatArgsExpr::check_templates (cognitive 28) src/tools/clippy/clippy_lints/src/format_args.rs:430 — FormatArgsExpr::check_templates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MacroUseImports · ×1
  • MacroUseImports::check_crate_post (cognitive 28) src/tools/clippy/clippy_lints/src/macro_use.rs:136 — MacroUseImports::check_crate_post has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TupleArrayConversions · ×1
  • TupleArrayConversions::check_expr (cognitive 28) src/tools/clippy/clippy_lints/src/tuple_array_conversions.rs:64 — TupleArrayConversions::check_expr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 10, match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · debug.getDebugConfiguration (cognitive 28) · ×1
  • debug.getDebugConfiguration (cognitive 28) src/tools/rust-analyzer/editors/code/src/debug.ts:81 — debug.getDebugConfiguration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Local · ×1
  • Local::rewrite_result (cognitive 27) src/tools/rustfmt/src/items.rs:55 — Local::rewrite_result has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Format · ×1
  • Format::translate (cognitive 27) compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs:76 — Format::translate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 7 (8 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TailCallCkVisitor · ×1
  • TailCallCkVisitor::check_tail_call (cognitive 27) compiler/rustc_mir_build/src/check_tail_calls.rs:52 — TailCallCkVisitor::check_tail_call has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DerefChecker · ×1
  • DerefChecker::visit_place (cognitive 27) compiler/rustc_mir_transform/src/deref_separator.rs:23 — DerefChecker::visit_place has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnreachableEnumBranching · ×1
  • UnreachableEnumBranching::run_pass (cognitive 27) compiler/rustc_mir_transform/src/unreachable_enum_branching.rs:85 — UnreachableEnumBranching::run_pass has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MissingStabilityAnnotations · ×1
  • MissingStabilityAnnotations::check_compatible_stability (cognitive 27) compiler/rustc_passes/src/stability.rs:323 — MissingStabilityAnnotations::check_compatible_stability has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_ty_walk · ×1
  • rustc_ty_walk::walk_types (cognitive 27) compiler/rustc_ty_walk/src/lib.rs:20 — rustc_ty_walk::walk_types has cognitive complexity 27 (threshold 15). Drivers by points: loops 8 (15 pts), if/else 5 (9 pts), match/switch 2 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · BufWriter · ×1
  • BufWriter::write_vectored (cognitive 27) library/alloc/src/io/buffered/bufwriter.rs:587 — BufWriter::write_vectored has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Libunwind · ×1
  • Libunwind::run (cognitive 27) src/bootstrap/src/core/build_steps/llvm.rs:2095 — Libunwind::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolBuild · ×1
  • ToolBuild::run (cognitive 27) src/bootstrap/src/core/build_steps/tool.rs:79 — ToolBuild::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 5 (7 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocTestBuilder · ×1
  • DocTestBuilder::generate_unique_doctest (cognitive 27) src/librustdoc/doctest/make.rs:322 — DocTestBuilder::generate_unique_doctest has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OffendingFilterExpr · ×1
  • OffendingFilterExpr::check_map_call (cognitive 27) src/tools/clippy/clippy_lints/src/methods/filter_map.rs:109 — OffendingFilterExpr::check_map_call has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 4 (8 pts), boolean chains 7 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WaitFinder · ×1
  • WaitFinder::visit_expr (cognitive 27) src/tools/clippy/clippy_lints/src/zombie_processes.rs:161 — WaitFinder::visit_expr has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompletionRelevance · ×1
  • CompletionRelevance::score (cognitive 27) src/tools/rust-analyzer/crates/ide-completion/src/item.rs:287 — CompletionRelevance::score has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 4 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · configure.parse_example_config (cognitive 27) · ×1
  • configure.parse_example_config (cognitive 27) src/bootstrap/configure.py:592 — configure.parse_example_config has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_abi · ×1
  • rustc_abi::layout::coroutine::coroutine_saved_local_eligibility (cognitive 26) compiler/rustc_abi/src/layout/coroutine.rs:42 — rustc_abi::layout::coroutine::coroutine_saved_local_eligibility has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 7 (10 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PatchableFunctionEntryParser · ×1
  • PatchableFunctionEntryParser::convert (cognitive 26) compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs:823 — PatchableFunctionEntryParser::convert has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FindOpaqueRegion · ×1
  • FindOpaqueRegion::visit_ty (cognitive 26) compiler/rustc_borrowck/src/diagnostics/opaque_types.rs:217 — FindOpaqueRegion::visit_ty has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GccCodegenBackend · ×1
  • GccCodegenBackend::init (cognitive 26) compiler/rustc_codegen_gcc/src/lib.rs:188 — GccCodegenBackend::init has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (12 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Newtype · ×1
  • Newtype::parse (cognitive 26) compiler/rustc_index_macros/src/newtype.rs:11 — Newtype::parse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PanicMessageNotLiteral · ×1
  • PanicMessageNotLiteral::into_diag (cognitive 26) compiler/rustc_lint/src/non_fmt_panic.rs:100 — PanicMessageNotLiteral::into_diag has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DropsReachable · ×1
  • DropsReachable::visit (cognitive 26) compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs:59 — DropsReachable::visit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexItemFunctionType · ×1
  • IndexItemFunctionType::write_to_string_without_param_names (cognitive 26) src/librustdoc/html/render/mod.rs:407 — IndexItemFunctionType::write_to_string_without_param_names has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 4 (6 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ImplStripper · ×1
  • ImplStripper::fold_item (cognitive 26) src/librustdoc/passes/stripper.rs:208 — ImplStripper::fold_item has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QuestionMark · ×1
  • QuestionMark::check_manual_let_else (cognitive 26) src/tools/clippy/clippy_lints/src/manual_let_else.rs:52 — QuestionMark::check_manual_let_else has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MirBody · ×1
  • MirBody::walk_places (cognitive 26) src/tools/rust-analyzer/crates/hir-ty/src/mir.rs:1034 — MirBody::walk_places has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 6 (18 pts), loops 3 (8 pts) (nesting depth added 17). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NameRefClass · ×1
  • NameRefClass::classify (cognitive 26) src/tools/rust-analyzer/crates/ide-db/src/defs.rs:745 — NameRefClass::classify has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 6 (11 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImportScope · ×1
  • ImportScope::find_insert_use_container (cognitive 26) src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs:74 — ImportScope::find_insert_use_container has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ErasedFileAstId · ×1
  • ErasedFileAstId::kind_typed (cognitive 26) src/tools/rust-analyzer/crates/span/src/ast_id.rs:198 — ErasedFileAstId::kind_typed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SyntaxEditor · ×1
  • SyntaxEditor::add_generic_param (cognitive 26) src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs:113 — SyntaxEditor::add_generic_param has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · tester.runSearch (cognitive 26) · ×1
  • tester.runSearch (cognitive 26) src/tools/rustdoc-js/tester.js:239 — tester.runSearch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadSearchJS.doSearch (cognitive 26) · ×1
  • loadSearchJS.doSearch (cognitive 26) src/tools/rustdoc-js/tester.js:484 — loadSearchJS.doSearch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 15). Of this number, 21 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_data_structures · ×1
  • rustc_data_structures::graph::dominators::dominators_impl (cognitive 25) compiler/rustc_data_structures/src/graph/dominators/mod.rs:64 — rustc_data_structures::graph::dominators::dominators_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 7 (10 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Highlighter · ×1
  • Highlighter::highlight_rustc_lexer (cognitive 25) compiler/rustc_driver_impl/src/highlighter.rs:69 — Highlighter::highlight_rustc_lexer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NonLocalDefinitions · ×1
  • NonLocalDefinitions::check_item (cognitive 25) compiler/rustc_lint/src/non_local_def.rs:70 — NonLocalDefinitions::check_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbortUnwindingCalls · ×1
  • AbortUnwindingCalls::run_pass (cognitive 25) compiler/rustc_mir_transform/src/abort_unwinding_calls.rs:28 — AbortUnwindingCalls::run_pass has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConstPropagator · ×1
  • ConstPropagator::visit_terminator (cognitive 25) compiler/rustc_mir_transform/src/known_panics_lint.rs:753 — ConstPropagator::visit_terminator has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DeferredCommand · ×1
  • DeferredCommand::finish_process (cognitive 25) src/bootstrap/src/utils/exec.rs:840 — DeferredCommand::finish_process has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 5 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeBlocks · ×1
  • CodeBlocks::next (cognitive 25) src/librustdoc/html/markdown.rs:235 — CodeBlocks::next has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LinkReplacerInner · ×1
  • LinkReplacerInner::handle_event (cognitive 25) src/librustdoc/html/markdown.rs:393 — LinkReplacerInner::handle_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 4, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SuggestContext · ×1
  • SuggestContext::recurse (cognitive 25) src/tools/clippy/clippy_lints/src/booleans.rs:337 — SuggestContext::recurse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OnlyUsedInRecursion · ×1
  • OnlyUsedInRecursion::check_expr (cognitive 25) src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs:365 — OnlyUsedInRecursion::check_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (11 pts), match/switch 2 (7 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnnecessaryWraps · ×1
  • UnnecessaryWraps::check_fn (cognitive 25) src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs:77 — UnnecessaryWraps::check_fn has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UselessVec · ×1
  • UselessVec::check_expr (cognitive 25) src/tools/clippy/clippy_lints/src/useless_vec.rs:173 — UselessVec::check_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WildcardImports · ×1
  • WildcardImports::check_use_tree (cognitive 25) src/tools/clippy/clippy_lints/src/wildcard_imports.rs:136 — WildcardImports::check_use_tree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlmostStandardFormulation · ×1
  • AlmostStandardFormulation::check_item (cognitive 25) src/tools/clippy/clippy_lints_internal/src/almost_standard_lint_formulation.rs:48 — AlmostStandardFormulation::check_item has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (8 pts), boolean chains 2 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TraitImpls · ×1
  • TraitImpls::collect_def_map::collect (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs:732 — TraitImpls::collect_def_map::collect has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (9 pts), match/switch 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdtDef · ×1
  • AdtDef::new (cognitive 25) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:482 — AdtDef::new has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CrateInfo · ×1
  • CrateInfo::new (cognitive 24) compiler/rustc_codegen_ssa/src/base.rs:1019 — CrateInfo::new has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 4 (8 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TriColorDepthFirstSearch · ×1
  • TriColorDepthFirstSearch::run_from (cognitive 24) compiler/rustc_data_structures/src/graph/iterate/mod.rs:240 — TriColorDepthFirstSearch::run_from has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FmtPrinter · ×1
  • FmtPrinter::name_all_regions (cognitive 24) compiler/rustc_middle/src/ty/print/pretty.rs:2800 — FmtPrinter::name_all_regions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CostChecker · ×1
  • CostChecker::visit_terminator (cognitive 24) compiler/rustc_mir_transform/src/cost_checker.rs:98 — CostChecker::visit_terminator has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Slice · ×1
  • Slice::split (cognitive 24) compiler/rustc_pattern_analysis/src/constructor.rs:575 — Slice::split has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 4 (8 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DescriptionCtx · ×1
  • DescriptionCtx::new (cognitive 24) compiler/rustc_trait_selection/src/diagnostics/note_and_explain.rs:16 — DescriptionCtx::new has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Socket · ×1
  • Socket::poll_connected (cognitive 24) library/std/src/sys/net/connection/socket/unix.rs:174 — Socket::poll_connected has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LargeStackFrames · ×1
  • LargeStackFrames::check_fn (cognitive 24) src/tools/clippy/clippy_lints/src/large_stack_frames.rs:139 — LargeStackFrames::check_fn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Loops · ×1
  • Loops::check_expr (cognitive 24) src/tools/clippy/clippy_lints/src/loops/mod.rs:859 — Loops::check_expr has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MissingConstForFn · ×1
  • MissingConstForFn::check_fn (cognitive 24) src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs:89 — MissingConstForFn::check_fn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 7, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · coverage_dump · ×1
  • coverage_dump::covfun::dump_covfun_mappings (cognitive 24) src/tools/coverage-dump/src/covfun.rs:16 — coverage_dump::covfun::dump_covfun_mappings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5 (10 pts), match/switch 1 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayRepr · ×1
  • DisplayRepr::print (cognitive 24) src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs:691 — DisplayRepr::print has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 7 (8 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · publish_toolstate.update_latest (cognitive 24) · ×1
  • publish_toolstate.update_latest (cognitive 24) src/tools/publish_toolstate.py:151 — publish_toolstate.update_latest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 3 (9 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.substituteVariablesInEnv (cognitive 24) · ×1
  • config.substituteVariablesInEnv (cognitive 24) src/tools/rust-analyzer/editors/code/src/config.ts:482 — config.substituteVariablesInEnv has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 9). Of this number, 18 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bootstrap.getServer (cognitive 24) · ×1
  • bootstrap.getServer (cognitive 24) REDACTED:36 — bootstrap.getServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CollectProcMacros · ×1
  • CollectProcMacros::visit_item (cognitive 23) compiler/rustc_builtin_macros/src/proc_macro_harness.rs:167 — CollectProcMacros::visit_item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntervalSet · ×1
  • IntervalSet::insert_range (cognitive 23) compiler/rustc_index/src/interval.rs:75 — IntervalSet::insert_range has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (23 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NormalInliner · ×1
  • NormalInliner::check_callee_mir_body (cognitive 23) compiler/rustc_mir_transform/src/inline.rs:352 — NormalInliner::check_callee_mir_body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CfgSimplifier · ×1
  • CfgSimplifier::simplify (cognitive 23) compiler/rustc_mir_transform/src/simplify.rs:142 — CfgSimplifier::simplify has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (10 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RangeSet · ×1
  • RangeSet::visit_terminator (cognitive 23) compiler/rustc_mir_transform/src/ssa_range_prop.rs:151 — RangeSet::visit_terminator has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LegacyNumericConstants · ×1
  • LegacyNumericConstants::check_use_tree (cognitive 23) src/tools/clippy/clippy_lints/src/legacy_numeric_constants.rs:47 — LegacyNumericConstants::check_use_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DecimalLiteralRepresentation · ×1
  • DecimalLiteralRepresentation::do_lint (cognitive 23) src/tools/clippy/clippy_lints/src/literal_representation.rs:455 — DecimalLiteralRepresentation::do_lint has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (9 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · NonCanonicalImpls · ×1
  • NonCanonicalImpls::check_item (cognitive 23) src/tools/clippy/clippy_lints/src/non_canonical_impls.rs:150 — NonCanonicalImpls::check_item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 1 (4 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NonSendFieldInSendTy · ×1
  • NonSendFieldInSendTy::check_item (cognitive 23) src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs:72 — NonSendFieldInSendTy::check_item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (8 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnwrappableVariablesVisitor · ×1
  • UnwrappableVariablesVisitor::visit_expr (cognitive 23) src/tools/clippy/clippy_lints/src/unwrap.rs:429 — UnwrappableVariablesVisitor::visit_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_copyright · ×1
  • generate_copyright::cargo_metadata::load_important_files (cognitive 23) src/tools/generate-copyright/src/cargo_metadata.rs:116 — generate_copyright::cargo_metadata::load_important_files has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NewPermission · ×1
  • NewPermission::new (cognitive 23) src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs:126 — NewPermission::new has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DedupRangeMap · ×1
  • DedupRangeMap::iter_mut (cognitive 23) src/tools/miri/src/data_structures/dedup_range_map.rs:137 — DedupRangeMap::iter_mut has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FileMetadata · ×1
  • FileMetadata::at (cognitive 23) src/tools/miri/src/shims/unix/fs.rs:2242 — FileMetadata::at has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Diagnostics · ×1
  • Diagnostics::run_ (cognitive 23) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/diagnostics.rs:25 — Diagnostics::run_ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Chain · ×1
  • Chain::from_ast (cognitive 23) src/tools/rustfmt/src/chains.rs:387 — Chain::from_ast has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bootstrap.bootstrap (cognitive 23) · ×1
  • bootstrap.bootstrap (cognitive 23) src/bootstrap/bootstrap.py:1332 — bootstrap.bootstrap has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineNeighborsTree.decode (cognitive 23) · ×1
  • InlineNeighborsTree.decode (cognitive 23) src/librustdoc/html/static/js/stringdex.js:2597 — InlineNeighborsTree.decode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgMatchingCtxt · ×1
  • ArgMatchingCtxt::detect_missing_turbofish (cognitive 22) compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:3235 — ArgMatchingCtxt::detect_missing_turbofish has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectedUserTypesNode · ×1
  • ProjectedUserTypesNode::build_user_type_projections (cognitive 22) compiler/rustc_mir_build/src/builder/matches/user_ty.rs:96 — ProjectedUserTypesNode::build_user_type_projections has cognitive complexity 22 (threshold 15). Drivers by points: loops 7 (19 pts), match/switch 1 (2 pts), if/else 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Promoter · ×1
  • Promoter::promote_temp (cognitive 22) compiler/rustc_mir_transform/src/promote_consts.rs:778 — Promoter::promote_temp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (6 pts), loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceMap · ×1
  • SourceMap::span_wrapped_by_angle_or_parentheses (cognitive 22) compiler/rustc_span/src/source_map.rs:826 — SourceMap::span_wrapped_by_angle_or_parentheses has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LangString · ×1
  • LangString::parse (cognitive 22) src/librustdoc/html/markdown.rs:1238 — LangString::parse has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisallowedFields · ×1
  • DisallowedFields::check_pat (cognitive 22) src/tools/clippy/clippy_lints/src/disallowed_fields.rs:107 — DisallowedFields::check_pat has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LargeEnumVariant · ×1
  • LargeEnumVariant::check_item (cognitive 22) src/tools/clippy/clippy_lints/src/large_enum_variant.rs:75 — LargeEnumVariant::check_item has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CrateWithSource · ×1
  • CrateWithSource::download_and_extract (cognitive 22) src/tools/clippy/lintcheck/src/input.rs:182 — CrateWithSource::download_and_extract has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clippy · ×1
  • clippy::driver::main (cognitive 22) src/tools/clippy/src/driver.rs:196 — clippy::driver::main has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 9, match/switch 2 (3 pts) (nesting depth added 1). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MainThreadState · ×1
  • MainThreadState::on_main_stack_empty (cognitive 22) src/tools/miri/src/eval.rs:243 — MainThreadState::on_main_stack_empty has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 4 (7 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Query · ×1
  • Query::search_maps (cognitive 22) src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs:581 — Query::search_maps has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CargoWorkspace · ×1
  • CargoWorkspace::new (cognitive 22) src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs:307 — CargoWorkspace::new has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UseSegment · ×1
  • UseSegment::cmp (cognitive 22) src/tools/rustfmt/src/imports.rs:921 — UseSegment::cmp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Type.print_field_errors (cognitive 22) · ×1
  • Type.print_field_errors (cognitive 22) src/etc/debugger_tester/common.py:240 — Type.print_field_errors has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_lldb.children_match (cognitive 22) · ×1
  • check_lldb.children_match (cognitive 22) src/etc/debugger_tester/lldb/check_lldb.py:393 — check_lldb.children_match has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.handleHashes (cognitive 22) · ×1
  • main.handleHashes (cognitive 22) src/librustdoc/html/static/js/main.js:545 — main.handleHashes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5 (nesting depth added 8). Of this number, 12 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · setup (cognitive 22) · ×1
  • setup (cognitive 22) src/librustdoc/html/static/js/main.js:423 — setup has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2 (nesting depth added 9). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (onpageshow, a function literal at line 442, onclick). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · UniversalRegionRelationsBuilder · ×1
  • UniversalRegionRelationsBuilder::create_old (cognitive 21) compiler/rustc_borrowck/src/type_check/free_region_relations.rs:188 — UniversalRegionRelationsBuilder::create_old has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CguReuseTracker · ×1
  • CguReuseTracker::check_expected_reuse (cognitive 21) compiler/rustc_codegen_ssa/src/assert_module_sources.rs:264 — CguReuseTracker::check_expected_reuse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (4 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TtParser · ×1
  • TtParser::match_one (cognitive 21) compiler/rustc_expand/src/mbe/macro_parser.rs:498 — TtParser::match_one has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CleanVisitor · ×1
  • CleanVisitor::check_item (cognitive 21) compiler/rustc_incremental/src/persist/clean.rs:340 — CleanVisitor::check_item has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PatCtxt · ×1
  • PatCtxt::lower_pattern_unadjusted (cognitive 21) compiler/rustc_mir_build/src/thir/pattern/mod.rs:317 — PatCtxt::lower_pattern_unadjusted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SimplifyMatch · ×1
  • SimplifyMatch::unify_by_copy (cognitive 21) compiler/rustc_mir_transform/src/match_branches.rs:232 — SimplifyMatch::unify_by_copy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AliasFixup · ×1
  • AliasFixup::visit_statement (cognitive 21) compiler/rustc_mir_transform/src/move_elimination.rs:779 — AliasFixup::visit_statement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleUseConsts · ×1
  • SingleUseConsts::run_pass (cognitive 21) compiler/rustc_mir_transform/src/single_use_consts.rs:32 — SingleUseConsts::run_pass has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MirUsedCollector · ×1
  • MirUsedCollector::visit_terminator (cognitive 21) compiler/rustc_monomorphize/src/collector.rs:822 — MirUsedCollector::visit_terminator has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NormalizesTo · ×1
  • NormalizesTo::consider_impl_candidate (cognitive 21) compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs:255 — NormalizesTo::consider_impl_candidate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 6 (8 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · libm_test · ×1
  • libm_test::run_cfg::arg_max_iterations (cognitive 21) library/compiler-builtins/libm-test/src/run_cfg.rs:244 — libm_test::run_cfg::arg_max_iterations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expression · ×1
  • Expression::build (cognitive 21) library/stdarch/crates/stdarch-gen-arm/src/expression.rs:195 — Expression::build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ToolStateCheck · ×1
  • ToolStateCheck::run (cognitive 21) REDACTED:153 — ToolStateCheck::run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SummaryLine · ×1
  • SummaryLine::next (cognitive 21) src/librustdoc/html/markdown.rs:651 — SummaryLine::next has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostExpansionEarlyAttributes · ×1
  • PostExpansionEarlyAttributes::check_attribute (cognitive 21) src/tools/clippy/clippy_lints/src/attrs/mod.rs:657 — PostExpansionEarlyAttributes::check_attribute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Casts · ×1
  • Casts::check_expr (cognitive 21) src/tools/clippy/clippy_lints/src/casts/mod.rs:890 — Casts::check_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InsertSearcher · ×1
  • InsertSearcher::visit_expr (cognitive 21) src/tools/clippy/clippy_lints/src/entry.rs:491 — InsertSearcher::visit_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToDigitIsSome · ×1
  • ToDigitIsSome::check_expr (cognitive 21) src/tools/clippy/clippy_lints/src/to_digit_is_some.rs:50 — ToDigitIsSome::check_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PossibleBorrowerVisitor · ×1
  • PossibleBorrowerVisitor::visit_terminator (cognitive 21) src/tools/clippy/clippy_utils/src/mir/possible_borrower.rs:89 — PossibleBorrowerVisitor::visit_terminator has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (8 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Trait · ×1
  • Trait::hir_fmt (cognitive 21) src/tools/rust-analyzer/crates/hir/src/display.rs:908 — Trait::hir_fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BuiltinDeriveImplTrait · ×1
  • BuiltinDeriveImplTrait::get_method (cognitive 21) src/tools/rust-analyzer/crates/hir-def/src/builtin_derive.rs:45 — BuiltinDeriveImplTrait::get_method has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 13 (21 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BindingsBuilder · ×1
  • BindingsBuilder::build_inner (cognitive 21) src/tools/rust-analyzer/crates/mbe/src/expander/matcher.rs:220 — BindingsBuilder::build_inner has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (14 pts), if/else 1 (5 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · EditPlan · ×1
  • EditPlan::build (cognitive 21) src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edit_algo.rs:71 — EditPlan::build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustdoc_gui_test · ×1
  • rustdoc_gui_test::main (cognitive 21) src/tools/rustdoc-gui-test/src/main.rs:22 — rustdoc_gui_test::main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common.from_dict (cognitive 21) · ×1
  • common.from_dict (cognitive 21) src/etc/debugger_tester/common.py:92 — common.from_dict has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocSearch.getTypeData (cognitive 21) · ×1
  • DocSearch.getTypeData (cognitive 21) REDACTED:1780 — DocSearch.getTypeData has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tester.loadSearchJS.doSearch (cognitive 21) · ×1
  • tester.loadSearchJS.doSearch (cognitive 21) src/tools/rustdoc-js/tester.js:484 — tester.loadSearchJS.doSearch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TransferFunction · ×1
  • TransferFunction::visit_rvalue (cognitive 20) compiler/rustc_const_eval/src/check_consts/resolver.rs:169 — TransferFunction::visit_rvalue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 4, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DiagCtxtHandle · ×1
  • DiagCtxtHandle::print_error_count (cognitive 20) compiler/rustc_errors/src/lib.rs:764 — DiagCtxtHandle::print_error_count has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_graphviz · ×1
  • rustc_graphviz::render_opts (cognitive 20) compiler/rustc_graphviz/src/lib.rs:579 — rustc_graphviz::render_opts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiagnosticDeriveVariantBuilder · ×1
  • DiagnosticDeriveVariantBuilder::generate_structure_code_for_attr (cognitive 20) compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs:175 — DiagnosticDeriveVariantBuilder::generate_structure_code_for_attr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CannotFindCrate · ×1
  • CannotFindCrate::into_diag (cognitive 20) compiler/rustc_metadata/src/diagnostics.rs:455 — CannotFindCrate::into_diag has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Children · ×1
  • Children::insert (cognitive 20) compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs:76 — Children::insert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Analysis · ×1
  • Analysis::iterate_to_fixpoint (cognitive 20) compiler/rustc_mir_dataflow/src/framework/mod.rs:288 — Analysis::iterate_to_fixpoint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimplifyConstCondition · ×1
  • SimplifyConstCondition::run_pass (cognitive 20) compiler/rustc_mir_transform/src/simplify_branches.rs:30 — SimplifyConstCondition::run_pass has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 7). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_symbol_mangling · ×1
  • rustc_symbol_mangling::compute_symbol_name (cognitive 20) compiler/rustc_symbol_mangling/src/lib.rs:256 — rustc_symbol_mangling::compute_symbol_name has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyKey · ×1
  • LazyKey::init (cognitive 20) library/std/src/sys/thread_local/key/windows.rs:81 — LazyKey::init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Wildcard · ×1
  • Wildcard::from_str (cognitive 20) library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs:67 — Wildcard::from_str has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Vendor · ×1
  • Vendor::run (cognitive 20) src/bootstrap/src/core/build_steps/vendor.rs:95 — Vendor::run has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 6 (8 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ClassStack · ×1
  • ClassStack::push (cognitive 20) src/librustdoc/html/highlight.rs:263 — ClassStack::push has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Disambiguator · ×1
  • Disambiguator::from_str (cognitive 20) src/librustdoc/passes/collect_intra_doc_links.rs:1768 — Disambiguator::from_str has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManualStrip · ×1
  • ManualStrip::check_expr (cognitive 20) src/tools/clippy/clippy_lints/src/manual_strip.rs:70 — ManualStrip::check_expr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraitBounds · ×1
  • TraitBounds::check_trait_item (cognitive 20) src/tools/clippy/clippy_lints/src/trait_bounds.rs:126 — TraitBounds::check_trait_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Crate · ×1
  • Crate::run_clippy_lints (cognitive 20) src/tools/clippy/lintcheck/src/main.rs:68 — Crate::run_clippy_lints has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Frontend · ×1
  • Frontend::parse_from_args (cognitive 20) src/tools/miri/priroda/src/main.rs:57 — Frontend::parse_from_args has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InactiveReason · ×1
  • InactiveReason::fmt (cognitive 20) src/tools/rust-analyzer/crates/cfg/src/lib.rs:244 — InactiveReason::fmt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MacroCallId · ×1
  • MacroCallId::expand_speculative (cognitive 20) src/tools/rust-analyzer/crates/hir-expand/src/lib.rs:783 — MacroCallId::expand_speculative has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3, boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Anchor · ×1
  • Anchor::from (cognitive 20) src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs:488 — Anchor::from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReplacementRenderer · ×1
  • ReplacementRenderer::render_token (cognitive 20) src/tools/rust-analyzer/crates/ide-ssr/src/replacing.rs:129 — ReplacementRenderer::render_token has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CargoOptions · ×1
  • CargoOptions::apply_on_command (cognitive 20) src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs:67 — CargoOptions::apply_on_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rustc_traits · ×1
  • rustc_traits::codegen::codegen_select_candidate (cognitive 20) compiler/rustc_traits/src/codegen.rs:24 — rustc_traits::codegen::codegen_select_candidate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 4 (7 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Crate._init_defs (cognitive 20) · ×1
  • Crate._init_defs (cognitive 20) library/compiler-builtins/etc/update-api-list.py:119 — Crate._init_defs has cognitive complexity 20 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 4 (9 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · PrefixSearchTree.searchLev (cognitive 20) · ×1
  • PrefixSearchTree.searchLev (cognitive 20) src/librustdoc/html/static/js/stringdex.js:1855 — PrefixSearchTree.searchLev has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Lev2TParametricDescription.transition (cognitive 20) · ×1
  • Lev2TParametricDescription.transition (cognitive 20) src/librustdoc/html/static/js/stringdex.js:4010 — Lev2TParametricDescription.transition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (20 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · showTooltip (cognitive 20) · ×1
  • showTooltip (cognitive 20) src/librustdoc/html/static/js/main.js:1331 — showTooltip has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4 (nesting depth added 3). Of this number, 15 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · buildSettingsPageSections (cognitive 20) · ×1
  • buildSettingsPageSections (cognitive 20) src/librustdoc/html/static/js/settings.js:126 — buildSettingsPageSections has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 2 (4 pts), loops 3 (4 pts) (nesting depth added 11). Of this number, 16 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · switchTheme (cognitive 20) · ×1
  • switchTheme (cognitive 20) src/librustdoc/html/static/js/storage.js:219 — switchTheme has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 7). Of this number, 16 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModuleConfig · ×1
  • ModuleConfig::new (cognitive 19) compiler/rustc_codegen_ssa/src/back/write.rs:117 — ModuleConfig::new has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 6, match/switch 3 (4 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TransformVisitor · ×1
  • TransformVisitor::make_state (cognitive 19) compiler/rustc_mir_transform/src/coroutine/mod.rs:268 — TransformVisitor::make_state has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ElaborateBoxDerefs · ×1
  • ElaborateBoxDerefs::run_pass (cognitive 19) compiler/rustc_mir_transform/src/elaborate_box_derefs.rs:80 — ElaborateBoxDerefs::run_pass has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OmpOffload · ×1
  • OmpOffload::run (cognitive 19) src/bootstrap/src/core/build_steps/llvm.rs:1336 — OmpOffload::run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ParseCxImpl · ×1
  • ParseCxImpl::parse_lint_src_file (cognitive 19) src/tools/clippy/clippy_dev/src/parse.rs:230 — ParseCxImpl::parse_lint_src_file has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Hir2Qmm · ×1
  • Hir2Qmm::run (cognitive 19) src/tools/clippy/clippy_lints/src/booleans.rs:261 — Hir2Qmm::run has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 6 (8 pts), boolean chains 1, loops 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IfThenSomeElseNone · ×1
  • IfThenSomeElseNone::check_expr (cognitive 19) src/tools/clippy/clippy_lints/src/if_then_some_else_none.rs:65 — IfThenSomeElseNone::check_expr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IncrementVisitor · ×1
  • IncrementVisitor::visit_expr (cognitive 19) src/tools/clippy/clippy_lints/src/loops/utils.rs:60 — IncrementVisitor::visit_expr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModStyle · ×1
  • ModStyle::check_item (cognitive 19) src/tools/clippy/clippy_lints/src/module_style.rs:138 — ModStyle::check_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VClockAlloc · ×1
  • VClockAlloc::report_data_race (cognitive 19) src/tools/miri/src/concurrency/data_race.rs:1111 — VClockAlloc::report_data_race has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MirPrettyCtx · ×1
  • MirPrettyCtx::blocks (cognitive 19) src/tools/rust-analyzer/crates/hir-ide/src/mir_pretty.rs:243 — MirPrettyCtx::blocks has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (12 pts), loops 3 (7 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CompletionContext · ×1
  • CompletionContext::new (cognitive 19) src/tools/rust-analyzer/crates/ide-completion/src/context.rs:756 — CompletionContext::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeclarativeMacro · ×1
  • DeclarativeMacro::parse_macro2 (cognitive 19) src/tools/rust-analyzer/crates/mbe/src/lib.rs:193 — DeclarativeMacro::parse_macro2 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MacroArgParser · ×1
  • MacroArgParser::parse (cognitive 19) src/tools/rustfmt/src/macros.rs:939 — MacroArgParser::parse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MacroBranch · ×1
  • MacroBranch::rewrite (cognitive 19) src/tools/rustfmt/src/macros.rs:1306 — MacroBranch::rewrite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · from_lldb.variable_from_lldb (cognitive 19) · ×1
  • from_lldb.variable_from_lldb (cognitive 19) src/etc/debugger_tester/lldb/from_lldb.py:284 — from_lldb.variable_from_lldb has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · remove (cognitive 19) · ×1
  • remove (cognitive 19) src/librustdoc/html/static/js/stringdex.js:604 — remove has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Param · ×1
  • Param::rewrite_result (cognitive 18) src/tools/rustfmt/src/items.rs:2299 — Param::rewrite_result has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TokenCursor · ×1
  • TokenCursor::inlined_next_and_bump (cognitive 18) compiler/rustc_ast/src/tokenstream.rs:1028 — TokenCursor::inlined_next_and_bump has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CPlace · ×1
  • CPlace::write_cvalue_maybe_transmute (cognitive 18) compiler/rustc_codegen_cranelift/src/value_and_place.rs:517 — CPlace::write_cvalue_maybe_transmute has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 4 (5 pts) (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SharedEmitterMain · ×1
  • SharedEmitterMain::check (cognitive 18) compiler/rustc_codegen_ssa/src/back/write.rs:2022 — SharedEmitterMain::check has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAnalyzer · ×1
  • LocalAnalyzer::process_place (cognitive 18) compiler/rustc_codegen_ssa/src/mir/analyze.rs:97 — LocalAnalyzer::process_place has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IfThisChanged · ×1
  • IfThisChanged::process_attrs (cognitive 18) compiler/rustc_incremental/src/assert_dep_graph.rs:113 — IfThisChanged::process_attrs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 2 (7 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EllipsisInclusiveRangePatterns · ×1
  • EllipsisInclusiveRangePatterns::check_pat (cognitive 18) compiler/rustc_lint/src/builtin.rs:1570 — EllipsisInclusiveRangePatterns::check_pat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (5 pts) (nesting depth added 7). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PatMigration · ×1
  • PatMigration::format_subdiagnostics (cognitive 18) compiler/rustc_mir_build/src/thir/pattern/migration.rs:93 — PatMigration::format_subdiagnostics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Forward · ×1
  • Forward::apply_effects_in_block (cognitive 18) compiler/rustc_mir_dataflow/src/framework/direction.rs:153 — Forward::apply_effects_in_block has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (7 pts), match/switch 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · EverInitializedPlaces · ×1
  • EverInitializedPlaces::init_reaches_location (cognitive 18) compiler/rustc_mir_dataflow/src/impls/initialized.rs:609 — EverInitializedPlaces::init_reaches_location has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DestinationPropagation · ×1
  • DestinationPropagation::run_pass (cognitive 18) compiler/rustc_mir_transform/src/dest_prop.rs:164 — DestinationPropagation::run_pass has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TailCopyToMove · ×1
  • TailCopyToMove::run_pass (cognitive 18) compiler/rustc_mir_transform/src/tail_copy_to_move.rs:58 — TailCopyToMove::run_pass has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Constructor · ×1
  • Constructor::fmt_fields (cognitive 18) compiler/rustc_pattern_analysis/src/constructor.rs:889 — Constructor::fmt_fields has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (13 pts), match/switch 2 (3 pts), if/else 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · File · ×1
  • File::open_native (cognitive 18) library/std/src/sys/fs/windows.rs:339 — File::open_native has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Copier · ×1
  • Copier::copy (cognitive 18) library/std/src/sys/io/kernel_copy/linux.rs:274 — Copier::copy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TcpListener · ×1
  • TcpListener::accept (cognitive 18) library/std/src/sys/net/connection/xous/tcplistener.rs:113 — TcpListener::accept has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (18 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WaiterQueue · ×1
  • WaiterQueue::insert (cognitive 18) library/std/src/sys/sync/condvar/itron.rs:183 — WaiterQueue::insert has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Rustc · ×1
  • Rustc::run::prepare_image (cognitive 18) src/bootstrap/src/core/build_steps/dist.rs:552 — Rustc::run::prepare_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LlvmTools · ×1
  • LlvmTools::run (cognitive 18) src/bootstrap/src/core/build_steps/dist.rs:2685 — LlvmTools::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 7). Of this number, 9 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RenderType · ×1
  • RenderType::read_from_bytes (cognitive 18) src/librustdoc/html/render/mod.rs:246 — RenderType::read_from_bytes has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 6 (8 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · EmptyLineAfter · ×1
  • EmptyLineAfter::check_gaps (cognitive 18) src/tools/clippy/clippy_lints/src/empty_line_after.rs:341 — EmptyLineAfter::check_gaps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 3 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PanicUnimplemented · ×1
  • PanicUnimplemented::check_expr (cognitive 18) src/tools/clippy/clippy_lints/src/panic_unimplemented.rs:107 — PanicUnimplemented::check_expr has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VecPushSearcher · ×1
  • VecPushSearcher::display_err (cognitive 18) src/tools/clippy/clippy_lints/src/vec_init_then_push.rs:64 — VecPushSearcher::display_err has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 1 (2 pts), match/switch 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CfgExpr · ×1
  • CfgExpr::parse_from_ast (cognitive 18) src/tools/rust-analyzer/crates/cfg/src/cfg_expr.rs:109 — CfgExpr::parse_from_ast has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 4 (8 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MatchCheckCtx · ×1
  • MatchCheckCtx::ctors_for_ty (cognitive 18) src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check/pat_analysis.rs:406 — MatchCheckCtx::ctors_for_ty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 1 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ProcMacroServerProcess · ×1
  • ProcMacroServerProcess::run (cognitive 18) src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs:125 — ProcMacroServerProcess::run has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stdx · ×1
  • stdx::process::imp::read2 (cognitive 18) src/tools/rust-analyzer/crates/stdx/src/process.rs:88 — stdx::process::imp::read2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommentCodeSlices · ×1
  • CommentCodeSlices::next (cognitive 18) src/tools/rustfmt/src/comment.rs:1698 — CommentCodeSlices::next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SyntaxTreeProvider.getElementByRange (cognitive 18) · ×1
  • SyntaxTreeProvider.getElementByRange (cognitive 18) src/tools/rust-analyzer/editors/code/src/syntax_tree_provider.ts:138 — SyntaxTreeProvider.getElementByRange has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · commands.asWorkspaceSnippetEdit (cognitive 18) · ×1
  • commands.asWorkspaceSnippetEdit (cognitive 18) src/tools/rust-analyzer/editors/code/src/commands.ts:1147 — commands.asWorkspaceSnippetEdit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetaItem · ×1
  • MetaItem::from_tokens (cognitive 17) compiler/rustc_ast/src/attr/mod.rs:510 — MetaItem::from_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (2 pts), match/switch 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NakedParser · ×1
  • NakedParser::finalize (cognitive 17) compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs:239 — NakedParser::finalize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssertModuleSource · ×1
  • AssertModuleSource::check_attrs (cognitive 17) compiler/rustc_codegen_ssa/src/assert_module_sources.rs:89 — AssertModuleSource::check_attrs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NonLocalDefinitionsDiag · ×1
  • NonLocalDefinitionsDiag::into_diag (cognitive 17) compiler/rustc_lint/src/diagnostics.rs:1861 — NonLocalDefinitionsDiag::into_diag has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ShadowedIntoIter · ×1
  • ShadowedIntoIter::check_expr (cognitive 17) compiler/rustc_lint/src/shadowed_into_iter.rs:71 — ShadowedIntoIter::check_expr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 4. Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OpportunitySet · ×1
  • OpportunitySet::apply_once (cognitive 17) compiler/rustc_mir_transform/src/jump_threading.rs:987 — OpportunitySet::apply_once has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Lint · ×1
  • Lint::visit_terminator (cognitive 17) compiler/rustc_mir_transform/src/lint.rs:133 — Lint::visit_terminator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LintAndRemoveUninhabited · ×1
  • LintAndRemoveUninhabited::run_pass (cognitive 17) compiler/rustc_mir_transform/src/lint_and_remove_uninhabited.rs:15 — LintAndRemoveUninhabited::run_pass has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpanData · ×1
  • SpanData::encode (cognitive 17) compiler/rustc_metadata/src/rmeta/encoder.rs:280 — SpanData::encode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SourceFile · ×1
  • SourceFile::encode (cognitive 17) compiler/rustc_span/src/lib.rs:2044 — SourceFile::encode has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Once · ×1
  • Once::call (cognitive 17) library/std/src/sys/sync/once/futex.rs:146 — Once::call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Impl · ×1
  • Impl::print_type (cognitive 17) src/librustdoc/html/format.rs:1418 — Impl::print_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SourceItemOrderingModuleItemGroupings · ×1
  • SourceItemOrderingModuleItemGroupings::deserialize (cognitive 17) src/tools/clippy/clippy_config/src/types.rs:552 — SourceItemOrderingModuleItemGroupings::deserialize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PatState · ×1
  • PatState::add_struct_pats (cognitive 17) src/tools/clippy/clippy_lints/src/matches/single_match.rs:304 — PatState::add_struct_pats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MinIdentChars · ×1
  • MinIdentChars::check_impl_item (cognitive 17) src/tools/clippy/clippy_lints/src/min_ident_chars.rs:193 — MinIdentChars::check_impl_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrintVisitor · ×1
  • PrintVisitor::expr (cognitive 17) src/tools/clippy/clippy_lints/src/utils/author.rs:435 — PrintVisitor::expr has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 4 (5 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · jsondoclint · ×1
  • jsondoclint::main (cognitive 17) src/tools/jsondoclint/src/main.rs:46 — jsondoclint::main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (7 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DapSession · ×1
  • DapSession::run_requests (cognitive 17) src/tools/miri/priroda/src/frontend/dap.rs:140 — DapSession::run_requests has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (7 pts), if/else 2 (6 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UseTreeLowering · ×1
  • UseTreeLowering::lower_use_tree (cognitive 17) src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs:462 — UseTreeLowering::lower_use_tree has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Scope · ×1
  • Scope::process_names (cognitive 17) src/tools/rust-analyzer/crates/hir-def/src/resolver.rs:1053 — Scope::process_names has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FunctionSignature · ×1
  • FunctionSignature::with_source_map (cognitive 17) src/tools/rust-analyzer/crates/hir-def/src/signatures.rs:631 — FunctionSignature::with_source_map has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PathLoweringContext · ×1
  • PathLoweringContext::substs_from_args_and_bindings (cognitive 17) src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs:678 — PathLoweringContext::substs_from_args_and_bindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4, boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeneratedFunctionTarget · ×1
  • GeneratedFunctionTarget::insert_fn_at (cognitive 17) src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_function.rs:623 — GeneratedFunctionTarget::insert_fn_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ScriptSource · ×1
  • ScriptSource::parse (cognitive 17) src/tools/rust-analyzer/crates/parser/src/frontmatter.rs:28 — ScriptSource::parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · LexedStr · ×1
  • LexedStr::to_input (cognitive 17) src/tools/rust-analyzer/crates/parser/src/shortcuts.rs:28 — LexedStr::to_input has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · configure.set (cognitive 17) · ×1
  • configure.set (cognitive 17) src/bootstrap/configure.py:476 — configure.set has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tester.parseOptions (cognitive 17) · ×1
  • tester.parseOptions (cognitive 17) src/tools/rustdoc-js/tester.js:569 — tester.parseOptions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RustcAutodiffParser · ×1
  • RustcAutodiffParser::convert (cognitive 16) compiler/rustc_attr_parsing/src/attributes/autodiff.rs:35 — RustcAutodiffParser::convert has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LivenessComputation · ×1
  • LivenessComputation::compute_drop_live_points_for_block (cognitive 16) compiler/rustc_borrowck/src/type_check/liveness/trace.rs:576 — LivenessComputation::compute_drop_live_points_for_block has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Option · ×1
  • Option::merge (cognitive 16) src/bootstrap/src/core/config/mod.rs:48 — Option::merge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TaitConstraintLocator · ×1
  • TaitConstraintLocator::check (cognitive 16) compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs:140 — TaitConstraintLocator::check has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DepGraph · ×1
  • DepGraph::read_index (cognitive 16) compiler/rustc_middle/src/dep_graph/graph.rs:507 — DepGraph::read_index has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MonoItem · ×1
  • MonoItem::instantiation_mode (cognitive 16) compiler/rustc_middle/src/mono.rs:132 — MonoItem::instantiation_mode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MutRestrictionChecker · ×1
  • MutRestrictionChecker::visit_place (cognitive 16) compiler/rustc_mir_transform/src/check_mut_restriction.rs:72 — MutRestrictionChecker::visit_place has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DuplicateLangItem · ×1
  • DuplicateLangItem::into_diag (cognitive 16) compiler/rustc_passes/src/diagnostics.rs:390 — DuplicateLangItem::into_diag has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UnusedImportCheckVisitor · ×1
  • UnusedImportCheckVisitor::report_unused_extern_crate_items (cognitive 16) compiler/rustc_resolve/src/check_unused.rs:157 — UnusedImportCheckVisitor::report_unused_extern_crate_items has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeRef · ×1
  • NodeRef::fix_node_through_parent (cognitive 16) library/alloc/src/collections/btree/fix.rs:13 — NodeRef::fix_node_through_parent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Handle · ×1
  • Handle::remove_leaf_kv (cognitive 16) library/alloc/src/collections/btree/remove.rs:26 — Handle::remove_leaf_kv has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DirBuilder · ×1
  • DirBuilder::create_dir_all (cognitive 16) library/std/src/fs.rs:3914 — DirBuilder::create_dir_all has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mode · ×1
  • Mode::fmt (cognitive 16) library/std/src/sys/fs/unix.rs:1818 — Mode::fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Invoc · ×1
  • Invoc::parse (cognitive 16) library/stdarch/crates/assert-instr-macro/src/lib.rs:199 — Invoc::parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Standalone · ×1
  • Standalone::run (cognitive 16) src/bootstrap/src/core/build_steps/doc.rs:388 — Standalone::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session · ×1
  • Session::copy_link_internal (cognitive 16) src/bootstrap/src/core/session.rs:1512 — Session::copy_link_internal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Markdown · ×1
  • Markdown::split_summary_and_content (cognitive 16) src/librustdoc/html/markdown.rs:1445 — Markdown::split_summary_and_content has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Tool · ×1
  • Tool::collect_checksums (cognitive 16) src/tools/bump-stage0/src/main.rs:183 — Tool::collect_checksums has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 1 (4 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Documentation · ×1
  • Documentation::check_attributes (cognitive 16) src/tools/clippy/clippy_lints/src/doc/mod.rs:754 — Documentation::check_attributes has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 3 (5 pts), boolean chains 3 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InconsistentStructConstructor · ×1
  • InconsistentStructConstructor::check_expr (cognitive 16) src/tools/clippy/clippy_lints/src/inconsistent_struct_constructor.rs:84 — InconsistentStructConstructor::check_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoopVisitor · ×1
  • LoopVisitor::visit_expr (cognitive 16) src/tools/clippy/clippy_lints/src/loops/infinite_loop.rs:164 — LoopVisitor::visit_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MutMut · ×1
  • MutMut::check_expr (cognitive 16) src/tools/clippy/clippy_lints/src/mut_mut.rs:48 — MutMut::check_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RawStrings · ×1
  • RawStrings::check_raw_string (cognitive 16) src/tools/clippy/clippy_lints/src/raw_strings.rs:107 — RawStrings::check_raw_string has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadVecVisitor · ×1
  • ReadVecVisitor::visit_expr (cognitive 16) src/tools/clippy/clippy_lints/src/read_zero_byte_vec.rs:153 — ReadVecVisitor::visit_expr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnconditionalRecursion · ×1
  • UnconditionalRecursion::init_default_impl_for_type_if_needed (cognitive 16) src/tools/clippy/clippy_lints/src/unconditional_recursion.rs:334 — UnconditionalRecursion::init_default_impl_for_type_if_needed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NumericLiteral · ×1
  • NumericLiteral::split_digit_parts (cognitive 16) src/tools/clippy/clippy_utils/src/numeric_literal.rs:117 — NumericLiteral::split_digit_parts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cli · ×1
  • Cli::print_command_result (cognitive 16) src/tools/miri/priroda/src/frontend/cli.rs:45 — Cli::print_command_result has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 2 (3 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Function · ×1
  • Function::hir_fmt (cognitive 16) src/tools/rust-analyzer/crates/hir/src/display.rs:90 — Function::hir_fmt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssocItemCollector · ×1
  • AssocItemCollector::record_item (cognitive 16) src/tools/rust-analyzer/crates/hir-def/src/nameres/assoc.rs:261 — AssocItemCollector::record_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · HirFormatter · ×1
  • HirFormatter::format_bounds_with (cognitive 16) src/tools/rust-analyzer/crates/hir-ide/src/display.rs:179 — HirFormatter::format_bounds_with has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbInterner · ×1
  • DbInterner::unsizing_params_for_adt (cognitive 16) src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:1863 — DbInterner::unsizing_params_for_adt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), match/switch 4 (6 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatchFinder · ×1
  • MatchFinder::output_debug_for_nodes_at_range (cognitive 16) src/tools/rust-analyzer/crates/ide-ssr/src/lib.rs:252 — MatchFinder::output_debug_for_nodes_at_range has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceRootConfig · ×1
  • SourceRootConfig::source_root_parent_map (cognitive 16) src/tools/rust-analyzer/crates/load-cargo/src/lib.rs:427 — SourceRootConfig::source_root_parent_map has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LsifManager · ×1
  • LsifManager::add_token (cognitive 16) src/tools/rust-analyzer/crates/rust-analyzer/src/cli/lsif.rs:155 — LsifManager::add_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · line_index · ×1
  • line_index::analyze_source_file_sse2 (cognitive 16) src/tools/rust-analyzer/lib/line-index/src/lib.rs:262 — line_index::analyze_source_file_sse2 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SilentOnIgnoredFilesEmitter · ×1
  • SilentOnIgnoredFilesEmitter::emit_diagnostic (cognitive 16) src/tools/rustfmt/src/parse/session.rs:54 — SilentOnIgnoredFilesEmitter::emit_diagnostic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (16 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · bootstrap.get (cognitive 16) · ×1
  • bootstrap.get (cognitive 16) src/bootstrap/bootstrap.py:52 — bootstrap.get has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · android-sdk-manager.fetch_repository (cognitive 16) · ×1
  • android-sdk-manager.fetch_repository (cognitive 16) src/ci/docker/scripts/android-sdk-manager.py:76 — android-sdk-manager.fetch_repository has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · batchmode.execute_command (cognitive 16) · ×1
  • batchmode.execute_command (cognitive 16) src/etc/debugger_tester/lldb/batchmode.py:68 — batchmode.execute_command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_lldb.type_matches (cognitive 16) · ×1
  • check_lldb.type_matches (cognitive 16) src/etc/debugger_tester/lldb/check_lldb.py:83 — check_lldb.type_matches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.changeSetting (cognitive 16) · ×1
  • settings.changeSetting (cognitive 16) src/librustdoc/html/static/js/settings.js:19 — settings.changeSetting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrefixTrie.children (cognitive 16) · ×1
  • PrefixTrie.children (cognitive 16) src/librustdoc/html/static/js/stringdex.js:2180 — PrefixTrie.children has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stringdex.loadDatabase · ×1
  • stringdex.loadDatabase::loadColumnFromBytes (cognitive 16) src/librustdoc/html/static/js/stringdex.js:2968 — stringdex.loadDatabase::loadColumnFromBytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (stringdex.loadDatabase) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: builtin_attrs.rs → data_structures.rs, encode_cross_crate.rs, check_attr.rs compiler/rustc_feature/src/builtin_attrs.rs — `compiler/rustc_feature/src/builtin_attrs.rs` changes together with 3 other files — `compiler/rustc_attr_ir/src/data_structures.rs`, `compiler/rustc_attr_ir/src/encode_cross_crate.rs`, `compiler/rustc_passes/src/check_attr.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (89 shared lines) · ×1
  • Near-duplicate member pair (89 shared lines) library/compiler-builtins/libm/src/math/lgamma_r.rs:171 — library/compiler-builtins/libm/src/math/lgamma_r.rs:171-323 | library/compiler-builtins/libm/src/math/lgammaf_r.rs:106-258 — These two members are variants of one another: 89 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (88 shared lines) · ×1
  • Near-duplicate member pair (88 shared lines) compiler/rustc_target/src/callconv/loongarch.rs:288 — compiler/rustc_target/src/callconv/loongarch.rs:288-395 | compiler/rustc_target/src/callconv/riscv.rs:293-401 — These two members are variants of one another: 88 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (77 shared lines) · ×1
  • Near-duplicate member pair (77 shared lines) compiler/rustc_codegen_llvm/src/asm.rs:1177 — compiler/rustc_codegen_llvm/src/asm.rs:1177-1371 | compiler/rustc_codegen_llvm/src/asm.rs:1380-1555 — These two members are variants of one another: 77 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:200 — compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:200-274 | compiler/rustc_trait_selection/src/traits/effects.rs:353-443 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×1
  • Edited copy of a member (39 corresponding lines) library/core/src/slice/sort/shared/smallsort.rs:423 — library/core/src/slice/sort/shared/smallsort.rs:423-461 | library/core/src/slice/sort/shared/smallsort.rs:472-530 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) library/compiler-builtins/libm/src/math/j1.rs:165 — library/compiler-builtins/libm/src/math/j1.rs:165-198 | library/compiler-builtins/libm/src/math/j1f.rs:114-142 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×1
  • Edited copy of a member (26 corresponding lines) src/etc/debugger_tester/gdb/check_gdb.py:32 — src/etc/debugger_tester/gdb/check_gdb.py:32-68 | src/etc/debugger_tester/lldb/check_lldb.py:39-80 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) library/std/src/os/xous/ffi.rs:141 — library/std/src/os/xous/ffi.rs:141-174 | library/std/src/os/xous/ffi.rs:241-275 | library/std/src/os/xous/ffi.rs:413-446 | library/std/src/os/xous/ffi.rs:459-493 | library/std/src/os/xous/ffi.rs:503-537 | library/std/src/os/xous/ffi.rs:540-577 | library/std/src/os/xous/ffi.rs:580-613 | library/std/src/os/xous/ffi.rs:623-658 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:293 — compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:293-314 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:322-394 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:400-413 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:440-455 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:461-492 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (65–66 lines × 2) · ×1
  • Duplicated block (65–66 lines × 2) library/compiler-builtins/libm/src/math/remquo.rs:13 — library/compiler-builtins/libm/src/math/remquo.rs:13-78 | library/compiler-builtins/libm/src/math/remquof.rs:13-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (61–63 lines × 2) · ×1
  • Duplicated block (61–63 lines × 2) library/compiler-builtins/libm/src/math/log10.rs:35 — library/compiler-builtins/libm/src/math/log10.rs:35-97 | library/compiler-builtins/libm/src/math/log2.rs:33-93 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10.rs` and `library/compiler-builtins/libm/src/math/log2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (58–59 lines × 2) · ×1
  • Duplicated block (58–59 lines × 2) library/compiler-builtins/libm/src/math/log10f.rs:29 — library/compiler-builtins/libm/src/math/log10f.rs:29-87 | library/compiler-builtins/libm/src/math/log2f.rs:27-84 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10f.rs` and `library/compiler-builtins/libm/src/math/log2f.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (56 lines × 2) · ×1
  • Duplicated block (56 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:93 — compiler/rustc_target/src/callconv/loongarch.rs:93-148 | compiler/rustc_target/src/callconv/riscv.rs:98-153 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (52–53 lines × 2) · ×1
  • Duplicated block (52–53 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:289 — compiler/rustc_target/src/callconv/loongarch.rs:289-340 | compiler/rustc_target/src/callconv/riscv.rs:294-346 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (51 lines × 2) · ×1
  • Duplicated block (51 lines × 2) compiler/rustc_target/src/callconv/loongarch.rs:159 — compiler/rustc_target/src/callconv/loongarch.rs:159-209 | compiler/rustc_target/src/callconv/riscv.rs:164-214 — before extracting anything, compare `compiler/rustc_target/src/callconv/loongarch.rs` and `compiler/rustc_target/src/callconv/riscv.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 328 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (30–35 lines × 2) · ×1
  • Duplicated block (30–35 lines × 2) compiler/rustc_borrowck/src/type_check/mod.rs:1087 — compiler/rustc_borrowck/src/type_check/mod.rs:1087-1116 | compiler/rustc_borrowck/src/type_check/mod.rs:1125-1159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (4–35 lines × 3) · ×1
  • Duplicated block (4–35 lines × 3) compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs:9 — compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs:9-12 | compiler/rustc_codegen_cranelift/scripts/rustc-clif.rs:9-43 | compiler/rustc_codegen_cranelift/scripts/rustdoc-clif.rs:9-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) compiler/rustc_symbol_mangling/src/legacy.rs:420 — compiler/rustc_symbol_mangling/src/legacy.rs:420-453 | compiler/rustc_symbol_mangling/src/v0.rs:370-403 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) library/alloc/src/collections/vec_deque/splice.rs:73 — library/alloc/src/collections/vec_deque/splice.rs:73-103 | library/alloc/src/vec/splice.rs:68-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (28–29 lines × 2) · ×1
  • Duplicated block (28–29 lines × 2) compiler/rustc_codegen_gcc/src/common.rs:73 — compiler/rustc_codegen_gcc/src/common.rs:73-100 | compiler/rustc_codegen_llvm/src/common.rs:199-227 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) library/compiler-builtins/libm/src/math/lgamma_r.rs:230 — library/compiler-builtins/libm/src/math/lgamma_r.rs:230-258 | library/compiler-builtins/libm/src/math/lgammaf_r.rs:165-193 — before extracting anything, compare `library/compiler-builtins/libm/src/math/lgamma_r.rs` and `library/compiler-builtins/libm/src/math/lgammaf_r.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1661 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:1661-1686 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2777-2802 — before extracting anything, compare `compiler/rustc_codegen_gcc/src/intrinsic/simd.rs` and `compiler/rustc_codegen_llvm/src/intrinsic.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–23 lines × 2) · ×1
  • Duplicated block (12–23 lines × 2) compiler/rustc_trait_selection/src/traits/normalize.rs:201 — compiler/rustc_trait_selection/src/traits/normalize.rs:201-223 | compiler/rustc_trait_selection/src/traits/normalize.rs:262-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–22 lines × 3) · ×1
  • Duplicated block (20–22 lines × 3) compiler/rustc_borrowck/src/type_check/mod.rs:1141 — compiler/rustc_borrowck/src/type_check/mod.rs:1141-1162 | compiler/rustc_borrowck/src/type_check/mod.rs:1174-1195 | compiler/rustc_borrowck/src/type_check/mod.rs:1211-1230 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17–22 lines × 2) · ×1
  • Duplicated block (17–22 lines × 2) compiler/rustc_borrowck/src/dataflow.rs:206 — compiler/rustc_borrowck/src/dataflow.rs:206-227 | compiler/rustc_borrowck/src/dataflow.rs:315-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) library/core/src/io/io_slice.rs:129 — library/core/src/io/io_slice.rs:129-147 | library/core/src/io/io_slice.rs:287-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×1
  • Duplicated block (19–21 lines × 2) compiler/rustc_codegen_cranelift/src/inline_asm.rs:385 — compiler/rustc_codegen_cranelift/src/inline_asm.rs:385-403 | compiler/rustc_codegen_cranelift/src/inline_asm.rs:407-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:2622 — compiler/rustc_codegen_llvm/src/intrinsic.rs:2622-2641 | compiler/rustc_codegen_llvm/src/intrinsic.rs:2888-2908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) library/compiler-builtins/libm/src/math/j0.rs:181 — library/compiler-builtins/libm/src/math/j0.rs:181-201 | library/compiler-builtins/libm/src/math/j0f.rs:122-139 — before extracting anything, compare `library/compiler-builtins/libm/src/math/j0.rs` and `library/compiler-builtins/libm/src/math/j0f.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×1
  • Duplicated block (20 lines × 3) compiler/rustc_codegen_llvm/src/builder.rs:474 — compiler/rustc_codegen_llvm/src/builder.rs:474-493 | compiler/rustc_codegen_llvm/src/builder.rs:1489-1508 | compiler/rustc_codegen_llvm/src/builder.rs:1961-1980 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) compiler/rustc_thread_pool/src/scope/mod.rs:535 — compiler/rustc_thread_pool/src/scope/mod.rs:535-553 | compiler/rustc_thread_pool/src/scope/mod.rs:608-627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:531 — compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:531-549 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:556-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) library/core/src/num/imp/flt2dec/mod.rs:386 — library/core/src/num/imp/flt2dec/mod.rs:386-403 | library/core/src/num/imp/flt2dec/mod.rs:631-648 | library/core/src/num/imp/flt2dec/mod.rs:663-679 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) compiler/rustc_hir_typeck/src/pat.rs:2824 — compiler/rustc_hir_typeck/src/pat.rs:2824-2837 | compiler/rustc_hir_typeck/src/pat.rs:2858-2875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) compiler/rustc_codegen_llvm/src/intrinsic.rs:676 — compiler/rustc_codegen_llvm/src/intrinsic.rs:676-692 | compiler/rustc_codegen_llvm/src/intrinsic.rs:697-713 | compiler/rustc_codegen_llvm/src/intrinsic.rs:719-735 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14–17 lines × 3) · ×1
  • Duplicated block (14–17 lines × 3) compiler/rustc_const_eval/src/interpret/stack.rs:520 — compiler/rustc_const_eval/src/interpret/stack.rs:520-533 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:123-139 | compiler/rustc_trait_selection/src/traits/select/mod.rs:2029-2042 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs` and `compiler/rustc_trait_selection/src/traits/select/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) compiler/rustc_codegen_cranelift/src/allocator.rs:15 — compiler/rustc_codegen_cranelift/src/allocator.rs:15-30 | compiler/rustc_codegen_gcc/src/allocator.rs:31-46 | compiler/rustc_codegen_llvm/src/allocator.rs:34-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (12–16 lines × 3) · ×1
  • Duplicated block (12–16 lines × 3) compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:268 — compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:268-279 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:293-308 | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs:2505-2520 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–16 lines × 2) · ×1
  • Duplicated block (8–16 lines × 2) compiler/rustc_borrowck/src/region_infer/opaque_types/region_ctxt.rs:79 — compiler/rustc_borrowck/src/region_infer/opaque_types/region_ctxt.rs:79-86 | compiler/rustc_borrowck/src/region_infer/region_context.rs:140-155 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (15 lines × 5) · ×1
  • Duplicated block (15 lines × 5) library/std/src/os/xous/ffi.rs:151 — library/std/src/os/xous/ffi.rs:151-165 | library/std/src/os/xous/ffi.rs:423-437 | library/std/src/os/xous/ffi.rs:550-564 | library/std/src/os/xous/ffi.rs:590-604 | library/std/src/os/xous/ffi.rs:633-647 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–15 lines × 2) · ×1
  • Duplicated block (8–15 lines × 2) compiler/rustc_codegen_cranelift/src/unsize.rs:32 — compiler/rustc_codegen_cranelift/src/unsize.rs:32-39 | compiler/rustc_codegen_ssa/src/base.rs:174-188 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) compiler/rustc_codegen_llvm/src/typetree.rs:117 — compiler/rustc_codegen_llvm/src/typetree.rs:117-131 | compiler/rustc_codegen_llvm/src/typetree.rs:134-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13–14 lines × 5) · ×1
  • Duplicated block (13–14 lines × 5) compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:179 — compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:179-192 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:524-537 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:581-594 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:620-633 | compiler/rustc_codegen_gcc/src/intrinsic/simd.rs:693-705 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) library/core/src/num/imp/flt2dec/mod.rs:372 — library/core/src/num/imp/flt2dec/mod.rs:372-385 | library/core/src/num/imp/flt2dec/mod.rs:448-461 | library/core/src/num/imp/flt2dec/mod.rs:540-553 | library/core/src/num/imp/flt2dec/mod.rs:617-630 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) compiler/rustc_codegen_llvm/src/asm.rs:1285 — compiler/rustc_codegen_llvm/src/asm.rs:1285-1298 | compiler/rustc_codegen_llvm/src/asm.rs:1478-1491 | compiler/rustc_codegen_llvm/src/asm.rs:1653-1666 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) compiler/rustc_arena/src/lib.rs:226 — compiler/rustc_arena/src/lib.rs:226-239 | compiler/rustc_arena/src/lib.rs:578-588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) compiler/rustc_codegen_llvm/src/intrinsic.rs:3219 — compiler/rustc_codegen_llvm/src/intrinsic.rs:3219-3232 | compiler/rustc_codegen_llvm/src/intrinsic.rs:3233-3244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 4) · ×1
  • Duplicated block (12–13 lines × 4) library/compiler-builtins/libm/src/math/log10.rs:56 — library/compiler-builtins/libm/src/math/log10.rs:56-67 | library/compiler-builtins/libm/src/math/log10f.rs:47-59 | library/compiler-builtins/libm/src/math/log2.rs:53-64 | library/compiler-builtins/libm/src/math/log2f.rs:44-56 — before extracting anything, compare `library/compiler-builtins/libm/src/math/log10.rs` and `library/compiler-builtins/libm/src/math/log2.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:871 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:871-882 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:893-904 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:915-926 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:937-948 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:959-970 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:981-992 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:803 — compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:803-814 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:947-958 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:564-575 | compiler/rustc_type_ir/src/ty_kind.rs:395-406 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs` and `compiler/rustc_type_ir/src/ty_kind.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) library/compiler-builtins/libm/src/math/arch/i586/rounding.rs:15 — library/compiler-builtins/libm/src/math/arch/i586/rounding.rs:15-26 | library/compiler-builtins/libm/src/math/arch/i586/rounding.rs:42-53 | library/compiler-builtins/libm/src/math/arch/i586/rounding.rs:62-73 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) library/compiler-builtins/libm/src/math/rem_pio2.rs:107 — library/compiler-builtins/libm/src/math/rem_pio2.rs:107-117 | library/compiler-builtins/libm/src/math/rem_pio2.rs:126-136 | library/compiler-builtins/libm/src/math/rem_pio2.rs:142-153 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs:51 — compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs:51-62 | compiler/rustc_borrowck/src/diagnostics/region_name.rs:74-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) compiler/rustc_codegen_gcc/src/int.rs:115 — compiler/rustc_codegen_gcc/src/int.rs:115-126 | compiler/rustc_codegen_gcc/src/int.rs:734-743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×1
  • Duplicated block (8–12 lines × 2) compiler/rustc_mir_build/src/builder/scope.rs:1018 — compiler/rustc_mir_build/src/builder/scope.rs:1018-1025 | compiler/rustc_mir_build/src/builder/scope.rs:1031-1042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–12 lines × 2) · ×1
  • Duplicated block (7–12 lines × 2) compiler/rustc_next_trait_solver/src/canonical/mod.rs:366 — compiler/rustc_next_trait_solver/src/canonical/mod.rs:366-377 | compiler/rustc_type_ir/src/relate/combine.rs:53-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (3–12 lines × 5) · ×1
  • Duplicated block (3–12 lines × 5) compiler/rustc_target/src/asm/mod.rs:1187 — compiler/rustc_target/src/asm/mod.rs:1187-1189 | compiler/rustc_target/src/asm/mod.rs:1205-1207 | compiler/rustc_target/src/asm/mod.rs:1272-1283 | compiler/rustc_target/src/asm/mod.rs:1297-1308 | compiler/rustc_target/src/asm/mod.rs:1394-1401 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 6) · ×1
  • Duplicated block (10–11 lines × 6) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:270 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:270-279 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:286-295 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:319-328 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:338-347 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:572-581 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:594-604 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–11 lines × 5) · ×1
  • Duplicated block (4–11 lines × 5) compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:294 — compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:294-297 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:324-332 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:402-410 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:442-452 | compiler/rustc_attr_parsing/src/attributes/link_attrs.rs:463-472 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) compiler/rustc_trait_selection/src/traits/project.rs:1474 — compiler/rustc_trait_selection/src/traits/project.rs:1474-1484 | compiler/rustc_trait_selection/src/traits/project.rs:1519-1529 | compiler/rustc_trait_selection/src/traits/project.rs:1574-1582 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) compiler/rustc_abi/src/layout.rs:1007 — compiler/rustc_abi/src/layout.rs:1007-1014 | compiler/rustc_abi/src/layout.rs:1372-1382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 11) · ×1
  • Duplicated block (10 lines × 11) compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:832 — compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:832-841 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:877-886 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:899-908 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:921-930 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:943-952 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:965-974 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:987-996 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1009-1018 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1031-1040 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1053-1062 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:1075-1084 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 7) · ×1
  • Duplicated block (10 lines × 7) library/std/src/os/xous/ffi.rs:156 — library/std/src/os/xous/ffi.rs:156-165 | library/std/src/os/xous/ffi.rs:428-437 | library/std/src/os/xous/ffi.rs:475-484 | library/std/src/os/xous/ffi.rs:519-528 | library/std/src/os/xous/ffi.rs:555-564 | library/std/src/os/xous/ffi.rs:595-604 | library/std/src/os/xous/ffi.rs:638-647 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9 lines × 7) · ×1
  • Duplicated block (9 lines × 7) compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs:381 — compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs:381-389 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:802-810 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:946-954 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:383-391 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:563-571 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:734-742 | compiler/rustc_type_ir/src/ty_kind.rs:394-402 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs` and `compiler/rustc_type_ir/src/ty_kind.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) compiler/rustc_mir_transform/src/coroutine/mod.rs:229 — compiler/rustc_mir_transform/src/coroutine/mod.rs:229-235 | compiler/rustc_mir_transform/src/coroutine/mod.rs:301-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) compiler/rustc_borrowck/src/lib.rs:1973 — compiler/rustc_borrowck/src/lib.rs:1973-1980 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:809-816 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:953-960 | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:1467-1474 | compiler/rustc_type_ir/src/ty_kind.rs:401-408 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs` and `compiler/rustc_type_ir/src/ty_kind.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) compiler/rustc_borrowck/src/lib.rs:1972 — compiler/rustc_borrowck/src/lib.rs:1972-1978 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:808-814 | compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:952-958 | compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs:569-575 | compiler/rustc_type_ir/src/ty_kind.rs:400-406 — before extracting anything, compare `compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs` and `compiler/rustc_type_ir/src/ty_kind.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) compiler/rustc_middle/src/mir/pretty.rs:226 — compiler/rustc_middle/src/mir/pretty.rs:226-232 | compiler/rustc_middle/src/mir/pretty.rs:235-241 | compiler/rustc_middle/src/mir/pretty.rs:257-262 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) compiler/rustc_const_eval/src/const_eval/machine.rs:840 — compiler/rustc_const_eval/src/const_eval/machine.rs:840-846 | compiler/rustc_const_eval/src/const_eval/machine.rs:881-886 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:650 — compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:650-656 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:691-697 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:733-738 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:744-749 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:755-760 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:766-771 | compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs:785-790 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–6 lines × 6) · ×1
  • Duplicated block (4–6 lines × 6) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:522 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:522-527 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:598-603 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:633-638 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1271-1276 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1490-1493 | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs:97-100 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (4–6 lines × 4) · ×1
  • Duplicated block (4–6 lines × 4) compiler/rustc_codegen_cranelift/src/value_and_place.rs:913 — compiler/rustc_codegen_cranelift/src/value_and_place.rs:913-916 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:925-930 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:938-943 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:951-956 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:193 — compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:193-197 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:376-380 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:592-596 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:622-626 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:668-672 | compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs:734-738 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) compiler/rustc_codegen_cranelift/src/value_and_place.rs:905 — compiler/rustc_codegen_cranelift/src/value_and_place.rs:905-909 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:918-922 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:932-936 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:945-949 | compiler/rustc_codegen_cranelift/src/value_and_place.rs:958-962 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) library/core/src/num/saturating.rs:46 — library/core/src/num/saturating.rs:46-83 | library/core/src/num/wrapping.rs:47-84 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (48 lines × 5) · ×1
  • Duplicated block (48 lines × 5) library/std/src/os/aix/fs.rs:316 — library/std/src/os/aix/fs.rs:316-363 | library/std/src/os/hurd/fs.rs:316-363 | library/std/src/os/nto/fs.rs:44-91 | library/std/src/os/nuttx/fs.rs:44-91 | library/std/src/os/vxworks/fs.rs:48-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (51 lines × 8) · ×1
  • Duplicated block (51 lines × 8) library/std/src/os/android/fs.rs:65 — library/std/src/os/android/fs.rs:65-115 | library/std/src/os/dragonfly/fs.rs:71-130 | library/std/src/os/emscripten/fs.rs:65-115 | library/std/src/os/haiku/fs.rs:69-125 | library/std/src/os/illumos/fs.rs:64-114 | library/std/src/os/openbsd/fs.rs:73-135 | library/std/src/os/redox/fs.rs:347-397 | library/std/src/os/solaris/fs.rs:65-115 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 8 times.
D4 · Code Duplication · Duplicated block (54 lines × 2) · ×1
  • Duplicated block (54 lines × 2) library/std/src/os/cygwin/fs.rs:48 — library/std/src/os/cygwin/fs.rs:48-101 | library/std/src/os/freebsd/fs.rs:75-142 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (48 lines × 3) · ×1
  • Duplicated block (48 lines × 3) library/std/src/os/cygwin/fs.rs:48 — library/std/src/os/cygwin/fs.rs:48-101 | library/std/src/os/freebsd/fs.rs:75-142 | library/std/src/os/fuchsia/fs.rs:47-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (48 lines × 2) · ×1
  • Duplicated block (48 lines × 2) library/std/src/os/rtems/fs.rs:327 — library/std/src/os/rtems/fs.rs:327-389 | library/std/src/os/vita/fs.rs:47-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) compiler/rustc_middle/src/ty/print/pretty.rs:2743 — compiler/rustc_middle/src/ty/print/pretty.rs:2743-2748 | compiler/rustc_next_trait_solver/src/placeholder.rs:110-115 | compiler/rustc_type_ir/src/fold.rs:430-435 | compiler/rustc_type_ir/src/fold.rs:562-567 | compiler/rustc_type_ir/src/fold.rs:730-735 | compiler/rustc_type_ir/src/region_constraint.rs:1185-1190 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) compiler/rustc_target/src/callconv/bpf.rs:58 — compiler/rustc_target/src/callconv/bpf.rs:58-69 | compiler/rustc_target/src/callconv/csky.rs:62-73 | compiler/rustc_target/src/callconv/m68k.rs:35-46 | compiler/rustc_target/src/callconv/msp430.rs:40-51 | compiler/rustc_target/src/callconv/nvptx64.rs:93-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (12 lines × 12) · ×1
  • Duplicated block (12 lines × 12) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:732 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:732-743 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:803-814 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:910-921 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:1103-1114 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:975-998 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1001-1024 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1027-1050 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1091-1114 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1117-1140 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1143-1166 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1196-1224 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs:1227-1250 — before extracting anything, compare `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs` and `compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:342 — compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:342-352 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:354-364 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:366-376 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:378-388 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:390-400 | compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs:402-412 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) compiler/rustc_mir_build/src/thir/print.rs:276 — compiler/rustc_mir_build/src/thir/print.rs:276-281 | compiler/rustc_mir_build/src/thir/print.rs:285-290 | compiler/rustc_mir_build/src/thir/print.rs:376-381 | compiler/rustc_mir_build/src/thir/print.rs:385-390 | compiler/rustc_mir_build/src/thir/print.rs:401-406 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:612 — compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:612-615 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:709-713 | compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs:719-723 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (34–37 lines × 2) · ×1
  • Duplicated block (34–37 lines × 2) src/etc/debugger_tester/gdb/check_gdb.py:228 — src/etc/debugger_tester/gdb/check_gdb.py:228-261 | src/etc/debugger_tester/lldb/check_lldb.py:310-346 — `src/etc/debugger_tester/gdb/check_gdb.py` and `src/etc/debugger_tester/lldb/check_lldb.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×1
  • Duplicated block (26–28 lines × 2) src/etc/lldb_providers.py:420 — src/etc/lldb_providers.py:420-447 | src/etc/lldb_providers.py:458-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/etc/lldb_providers.py:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) src/etc/lldb_providers.py:880 — src/etc/lldb_providers.py:880-895 | src/etc/lldb_providers.py:959-972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) src/etc/lldb_providers.py:1175 — src/etc/lldb_providers.py:1175-1182 | src/etc/lldb_providers.py:1340-1349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/etc/lldb_providers.py:1340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Near-duplicate member pair (57 shared lines) · ×1
  • Near-duplicate member pair (57 shared lines) compiler/rustc_codegen_cranelift/example/std_example.rs:17 — compiler/rustc_codegen_cranelift/example/std_example.rs:17-187 | compiler/rustc_codegen_gcc/example/std_example.rs:14-111 — These two members are variants of one another: 57 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (54 shared lines) · ×1
  • Near-duplicate member pair (54 shared lines) compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:163 — compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs:163-365 | compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs:145-310 — These two members are variants of one another: 54 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (34 shared lines) · ×1
  • Near-duplicate member pair (34 shared lines) compiler/rustc_codegen_cranelift/example/dst-field-align.rs:27 — compiler/rustc_codegen_cranelift/example/dst-field-align.rs:27-66 | compiler/rustc_codegen_gcc/example/dst-field-align.rs:25-67 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs:73 — compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs:73-102 | compiler/rustc_codegen_gcc/example/subslice-patterns-const-eval.rs:68-97 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) compiler/rustc_codegen_cranelift/example/std_example.rs:315 — compiler/rustc_codegen_cranelift/example/std_example.rs:315-338 | compiler/rustc_codegen_gcc/example/std_example.rs:145-168 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×1
  • Edited copy of a member (13 corresponding lines) compiler/rustc_codegen_cranelift/example/std_example.rs:365 — compiler/rustc_codegen_cranelift/example/std_example.rs:365-377 | compiler/rustc_codegen_gcc/example/std_example.rs:199-211 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×1
  • Edited copy of a member (21 corresponding lines) compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:177 — compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:177-220 | compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:223-261 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (10–18 lines × 3) · ×1
  • Duplicated block (10–18 lines × 3) compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:178 — compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:178-187 | compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:224-235 | compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs:265-282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D5 · Coupling · Unstable project hir-ide · ×1
  • Unstable project hir-ide — hir-ide has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project ide · ×1
  • Unstable project ide — ide has instability 0.93 with 1 dependents.
D5 · Coupling · Unstable project ide-diagnostics · ×1
  • Unstable project ide-diagnostics — ide-diagnostics has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project load-cargo · ×1
  • Unstable project load-cargo — load-cargo has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project mbe · ×1
  • Unstable project mbe — mbe has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project rustc_ast_lowering · ×1
  • Unstable project rustc_ast_lowering — rustc_ast_lowering has instability 0.88 with 2 dependents.
D5 · Coupling · Unstable project rustc_ast_passes · ×1
  • Unstable project rustc_ast_passes — rustc_ast_passes has instability 0.93 with 1 dependents.
D5 · Coupling · Unstable project rustc_borrowck · ×1
  • Unstable project rustc_borrowck — rustc_borrowck has instability 0.94 with 1 dependents.
D5 · Coupling · Unstable project rustc_builtin_macros · ×1
  • Unstable project rustc_builtin_macros — rustc_builtin_macros has instability 0.95 with 1 dependents.
D5 · Coupling · Unstable project rustc_codegen_llvm · ×1
  • Unstable project rustc_codegen_llvm — rustc_codegen_llvm has instability 0.96 with 1 dependents.
D5 · Coupling · Unstable project rustc_codegen_ssa · ×1
  • Unstable project rustc_codegen_ssa — rustc_codegen_ssa has instability 0.86 with 4 dependents.
D5 · Coupling · Unstable project rustc_const_eval · ×1
  • Unstable project rustc_const_eval — rustc_const_eval has instability 0.85 with 3 dependents.
D5 · Coupling · Unstable project rustc_driver_impl · ×1
  • Unstable project rustc_driver_impl — rustc_driver_impl has instability 0.94 with 2 dependents.
D5 · Coupling · Unstable project rustc_expand_queries · ×1
  • Unstable project rustc_expand_queries — rustc_expand_queries has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project rustc_hir_analysis · ×1
  • Unstable project rustc_hir_analysis — rustc_hir_analysis has instability 0.86 with 3 dependents.
D5 · Coupling · Unstable project rustc_hir_typeck · ×1
  • Unstable project rustc_hir_typeck — rustc_hir_typeck has instability 0.95 with 1 dependents.
D5 · Coupling · Unstable project rustc_incremental · ×1
  • Unstable project rustc_incremental — rustc_incremental has instability 0.86 with 2 dependents.
D5 · Coupling · Unstable project rustc_interface · ×1
  • Unstable project rustc_interface — rustc_interface has instability 0.98 with 1 dependents.
D5 · Coupling · Unstable project rustc_lint · ×1
  • Unstable project rustc_lint — rustc_lint has instability 0.88 with 3 dependents.
D5 · Coupling · Unstable project rustc_metadata · ×1
  • Unstable project rustc_metadata — rustc_metadata has instability 0.82 with 5 dependents.
D5 · Coupling · Unstable project rustc_mir_build · ×1
  • Unstable project rustc_mir_build — rustc_mir_build has instability 0.88 with 2 dependents.
D5 · Coupling · Unstable project rustc_mir_transform · ×1
  • Unstable project rustc_mir_transform — rustc_mir_transform has instability 0.95 with 1 dependents.
D5 · Coupling · Unstable project rustc_monomorphize · ×1
  • Unstable project rustc_monomorphize — rustc_monomorphize has instability 0.94 with 1 dependents.
D5 · Coupling · Unstable project rustc_next_trait_solver · ×1
  • Unstable project rustc_next_trait_solver — rustc_next_trait_solver has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project rustc_passes · ×1
  • Unstable project rustc_passes — rustc_passes has instability 0.95 with 1 dependents.
D5 · Coupling · Unstable project rustc_pattern_analysis · ×1
  • Unstable project rustc_pattern_analysis — rustc_pattern_analysis has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project rustc_privacy · ×1
  • Unstable project rustc_privacy — rustc_privacy has instability 0.83 with 2 dependents.
D5 · Coupling · Unstable project rustc_public_bridge · ×1
  • Unstable project rustc_public_bridge — rustc_public_bridge has instability 0.82 with 2 dependents.
D5 · Coupling · Unstable project rustc_query_impl · ×1
  • Unstable project rustc_query_impl — rustc_query_impl has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project rustc_resolve · ×1
  • Unstable project rustc_resolve — rustc_resolve has instability 0.90 with 2 dependents.
D5 · Coupling · Unstable project rustc_sanitizers · ×1
  • Unstable project rustc_sanitizers — rustc_sanitizers has instability 0.89 with 1 dependents.
D5 · Coupling · Unstable project rustc_traits · ×1
  • Unstable project rustc_traits — rustc_traits has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project rustc_transmute · ×1
  • Unstable project rustc_transmute — rustc_transmute has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project rustc_ty_utils · ×1
  • Unstable project rustc_ty_utils — rustc_ty_utils has instability 0.94 with 1 dependents.
D5 · Coupling · Unstable project test-fixture · ×1
  • Unstable project test-fixture — test-fixture has instability 0.90 with 1 dependents.
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
R10 · Code Duplication · Wholesale file copy (66 identical lines × 2 files) · ×1
  • Wholesale file copy (66 identical lines × 2 files) src/librustdoc/html/static/.eslintrc.js:1 — src/librustdoc/html/static/.eslintrc.js:1 · src/tools/rustdoc-js/.eslintrc.js:1 — these 2 files are line-for-line copies of one another — 66 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block (42 lines × 2 locations) · ×1
  • Duplicated block (42 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:1941 — src/librustdoc/html/static/js/stringdex.js:1941 · src/librustdoc/html/static/js/stringdex.js:2441 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (36 lines × 2 locations) · ×1
  • Duplicated block (36 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:210 — src/tools/rust-analyzer/editors/code/src/commands.ts:210 · src/tools/rust-analyzer/editors/code/src/commands.ts:247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (34 lines × 2 locations) · ×1
  • Duplicated block (34 lines × 2 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:722 — src/tools/rust-analyzer/editors/code/src/commands.ts:722 · src/tools/rust-analyzer/editors/code/src/commands.ts:786 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (29 lines × 2 locations) · ×1
  • Duplicated block (29 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:2646 — src/librustdoc/html/static/js/stringdex.js:2646 · src/librustdoc/html/static/js/stringdex.js:2710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (25 lines × 2 locations) · ×1
  • Duplicated block (25 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:1805 — src/librustdoc/html/static/js/stringdex.js:1805 · src/librustdoc/html/static/js/stringdex.js:2355 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (24 lines × 2 locations) · ×1
  • Duplicated block (24 lines × 2 locations) REDACTED:3437 — REDACTED:3437 · REDACTED:3473 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) REDACTED:2979 — REDACTED:2979 · REDACTED:3312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (18 lines × 2 locations) · ×1
  • Duplicated block (18 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:371 — src/librustdoc/html/static/js/stringdex.js:371 · src/librustdoc/html/static/js/stringdex.js:494 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (17 lines × 2 locations) · ×1
  • Duplicated block (17 lines × 2 locations) src/librustdoc/html/static/js/stringdex.js:404 — src/librustdoc/html/static/js/stringdex.js:404 · src/librustdoc/html/static/js/stringdex.js:517 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (16 lines × 3 locations) · ×1
  • Duplicated block (16 lines × 3 locations) src/tools/rust-analyzer/editors/code/src/commands.ts:622 — src/tools/rust-analyzer/editors/code/src/commands.ts:622 · src/tools/rust-analyzer/editors/code/src/commands.ts:727 · src/tools/rust-analyzer/editors/code/src/commands.ts:791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication · Duplicated block (11 lines × 4 locations) · ×1
  • Duplicated block (11 lines × 4 locations) REDACTED:1616 — REDACTED:1616 · REDACTED:1672 · REDACTED:1697 · REDACTED:1774 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (11 lines × 3 locations) · ×1
  • Duplicated block (11 lines × 3 locations) REDACTED:1811 — REDACTED:1811 · REDACTED:1824 · REDACTED:1877 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication · Duplicated block (10 lines × 3 locations) · ×1
  • Duplicated block (10 lines × 3 locations) REDACTED:4096 — REDACTED:4096 · REDACTED:4120 · REDACTED:4143 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function makeSearchTreeFromBase64 (cyclomatic 59, cognitive 195) · ×1
  • Complex function makeSearchTreeFromBase64 (cyclomatic 59, cognitive 195) src/librustdoc/html/static/js/stringdex.js:3009 — makeSearchTreeFromBase64 has cyclomatic complexity 59 and cognitive complexity 195; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function unifyFunctionTypes (cyclomatic 47, cognitive 87) · ×1
  • Complex function unifyFunctionTypes (cyclomatic 47, cognitive 87) REDACTED:2979 — unifyFunctionTypes has cyclomatic complexity 47 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function unpackPostingsList (cyclomatic 37, cognitive 80) · ×1
  • Complex function unpackPostingsList (cyclomatic 37, cognitive 80) REDACTED:4256 — unpackPostingsList has cyclomatic complexity 37 and cognitive complexity 80; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function makeBranchesFromBinaryData (cyclomatic 36, cognitive 93) · ×1
  • Complex function makeBranchesFromBinaryData (cyclomatic 36, cognitive 93) src/librustdoc/html/static/js/stringdex.js:3045 — makeBranchesFromBinaryData has cyclomatic complexity 36 and cognitive complexity 93; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getNextElem (cyclomatic 36, cognitive 71) · ×1
  • Complex function getNextElem (cyclomatic 36, cognitive 71) REDACTED:594 — getNextElem has cyclomatic complexity 36 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function innerRunNameQuery (cyclomatic 34, cognitive 71) · ×1
  • Complex function innerRunNameQuery (cyclomatic 34, cognitive 71) REDACTED:3940 — innerRunNameQuery has cyclomatic complexity 34 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function unifyFunctionTypeIsMatchCandidate (cyclomatic 33, cognitive 49) · ×1
  • Complex function unifyFunctionTypeIsMatchCandidate (cyclomatic 33, cognitive 49) REDACTED:3524 — unifyFunctionTypeIsMatchCandidate has cyclomatic complexity 33 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function constructor (cyclomatic 32, cognitive 47) · ×1
  • Complex function constructor (cyclomatic 32, cognitive 47) src/librustdoc/html/static/js/stringdex.js:17 — constructor has cyclomatic complexity 32 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function prefixMatches (cyclomatic 31, cognitive 83) · ×1
  • Complex function prefixMatches (cyclomatic 31, cognitive 83) src/librustdoc/html/static/js/stringdex.js:2031 — prefixMatches has cyclomatic complexity 31 and cognitive complexity 83; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function buildItemSearchType (cyclomatic 31, cognitive 41) · ×1
  • Complex function buildItemSearchType (cyclomatic 31, cognitive 41) REDACTED:1998 — buildItemSearchType has cyclomatic complexity 31 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function intersection (cyclomatic 30, cognitive 60) · ×1
  • Complex function intersection (cyclomatic 30, cognitive 60) src/librustdoc/html/static/js/stringdex.js:486 — intersection has cyclomatic complexity 30 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function union (cyclomatic 28, cognitive 49) · ×1
  • Complex function union (cyclomatic 28, cognitive 49) src/librustdoc/html/static/js/stringdex.js:363 — union has cyclomatic complexity 28 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 28, cognitive 44) · ×1
  • Complex function (anonymous) (cyclomatic 28, cognitive 44) REDACTED:2809 — (anonymous) has cyclomatic complexity 28 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getItemsBefore (cyclomatic 28, cognitive 41) · ×1
  • Complex function getItemsBefore (cyclomatic 28, cognitive 41) REDACTED:440 — getItemsBefore has cyclomatic complexity 28 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function writeFn (cyclomatic 27, cognitive 47) · ×1
  • Complex function writeFn (cyclomatic 27, cognitive 47) REDACTED:2504 — writeFn has cyclomatic complexity 27 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getRow (cyclomatic 25, cognitive 24) · ×1
  • Complex function getRow (cyclomatic 25, cognitive 24) REDACTED:1896 — getRow has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function valueCheck (cyclomatic 23, cognitive 50) · ×1
  • Complex function valueCheck (cyclomatic 23, cognitive 50) src/tools/rustdoc-js/tester.js:156 — valueCheck has cyclomatic complexity 23 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function unifyGenericTypes (cyclomatic 23, cognitive 36) · ×1
  • Complex function unifyGenericTypes (cyclomatic 23, cognitive 36) REDACTED:3312 — unifyGenericTypes has cyclomatic complexity 23 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function transformResults (cyclomatic 22, cognitive 53) · ×1
  • Complex function transformResults (cyclomatic 22, cognitive 53) REDACTED:2660 — transformResults has cyclomatic complexity 22 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getIdentEndPosition (cyclomatic 22, cognitive 43) · ×1
  • Complex function getIdentEndPosition (cyclomatic 22, cognitive 43) REDACTED:964 — getIdentEndPosition has cyclomatic complexity 22 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 5386 lines of code REDACTED:1 — REDACTED has 5386 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/librustdoc/html/static/js/stringdex.js · ×1
  • src/librustdoc/html/static/js/stringdex.js: 4322 lines of code src/librustdoc/html/static/js/stringdex.js:1 — src/librustdoc/html/static/js/stringdex.js has 4322 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/librustdoc/html/static/js/main.js · ×1
  • src/librustdoc/html/static/js/main.js: 2107 lines of code src/librustdoc/html/static/js/main.js:1 — src/librustdoc/html/static/js/main.js has 2107 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/tools/rust-analyzer/editors/code/src/commands.ts · ×1
  • src/tools/rust-analyzer/editors/code/src/commands.ts: 1416 lines of code src/tools/rust-analyzer/editors/code/src/commands.ts:1 — src/tools/rust-analyzer/editors/code/src/commands.ts has 1416 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/tools/rustdoc-js/tester.js · ×1
  • src/tools/rustdoc-js/tester.js: 619 lines of code src/tools/rustdoc-js/tester.js:1 — src/tools/rustdoc-js/tester.js has 619 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/tools/rust-analyzer/editors/code/src/ctx.ts · ×1
  • src/tools/rust-analyzer/editors/code/src/ctx.ts: 572 lines of code src/tools/rust-analyzer/editors/code/src/ctx.ts:1 — src/tools/rust-analyzer/editors/code/src/ctx.ts has 572 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/tools/rust-analyzer/editors/code/src/config.ts · ×1
  • src/tools/rust-analyzer/editors/code/src/config.ts: 546 lines of code src/tools/rust-analyzer/editors/code/src/config.ts:1 — src/tools/rust-analyzer/editors/code/src/config.ts has 546 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · src/librustdoc/html/static/js/storage.js · ×1
  • src/librustdoc/html/static/js/storage.js: 409 lines of code src/librustdoc/html/static/js/storage.js:1 — src/librustdoc/html/static/js/storage.js has 409 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~12 LoC) · ×1
  • Dead file (~12 LoC) src/tools/error_index_generator/redirect.js — no import path from any entry point (20 application, 6 tooling, 157 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~9 LoC) · ×1
  • Dead file (~9 LoC) src/tools/error_index_generator/error-index.js — no import path from any entry point (20 application, 6 tooling, 157 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unused dependency 'browser-ui-test' · ×1
  • Unused dependency 'browser-ui-test' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'es-check' · ×1
  • Unused dependency 'es-check' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency '@hpcc-js/wasm' · ×1
  • Unused dependency '@hpcc-js/wasm' — Declared in src/tools/rust-analyzer/editors/code/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
S1 · Web-Security Posture · Third-party script without Subresource Integrity · ×1
  • Third-party script without Subresource Integrity compiler/rustc_borrowck/src/polonius/dump/polonius-mir-dump.template.html:90 — `https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×1
  • Recursive walk over a caller-supplied document has no depth cap src/etc/debugger_tester/common.py:119 — `from_dict` is public and takes `data: JsonType` from its caller, and it calls itself at line 119 (`from_dict`) with a piece of `data` (and at line 123, line 130, line 137, line 151) — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Minor — 161 finding(s)
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/attr.rs:152 — `debug!` at line 152 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/chains.rs:150 — `debug!` at line 150 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/chains.rs:560 — `debug!` at line 560 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/closures.rs:43 — `debug!` at line 43 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/closures.rs:363 — `debug!` at line 363 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/comment.rs:162 — `trace!` at line 162 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/comment.rs:1813 — `debug!` at line 1813 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:936 — `debug!` at line 936 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:1201 — `debug!` at line 1201 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:1669 — `debug!` at line 1669 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:1819 — `debug!` at line 1819 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:2038 — `debug!` at line 2038 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/expr.rs:2123 — `debug!` at line 2123 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/formatting.rs:476 — `debug!` at line 476 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/items.rs:56 — `debug!` at line 56 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/items.rs:2549 — `debug!` at line 2549 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/items.rs:2943 — `debug!` at line 2943 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/macros.rs:588 — `debug!` at line 588 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/macros.rs:1090 — `debug!` at line 1090 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/macros.rs:1142 — `debug!` at line 1142 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/macros.rs:1417 — `debug!` at line 1417 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/matches.rs:614 — `debug!` at line 614 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/missed_spans.rs:159 — `debug!` at line 159 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/missed_spans.rs:198 — `debug!` at line 198 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/tools/rustfmt/src/modules.rs:484 — `warn!` at line 484 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on Err · ×28
  • Silent fallback default on Err compiler/rustc_codegen_llvm/src/back/write.rs:1045 — `demangle_callback` (in `codegen`) turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_hir_typeck/src/method/suggest.rs:5038 — `print_disambiguation_help` turns every `Err` into `"_".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_lint/src/disallowed_pass_by_ref.rs:75 — `gen_args` turns every `Err` into `"_".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_mir_build/src/thir/print.rs:17 — `thir_tree` turns every `Err` into `"error".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_mir_build/src/thir/print.rs:25 — `thir_flat` turns every `Err` into `"error".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs:244 — `record_elided_lifetimes` (in `visit_qpath`) turns every `Err` into `"..".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:279 — `suggest_param_env_shadowing` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs:60 — `compute_applicable_impls_for_diagnostics` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_trait_selection/src/traits/outlives_bounds.rs:56 — `implied_outlives_bounds` turns every `Err` into `vec![]` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_ty_utils/src/needs_drop.rs:78 — `filter_array_elements` turns every `Err` into `true` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err compiler/rustc_ty_utils/src/needs_drop.rs:90 — `filter_array_elements_async` turns every `Err` into `true` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err library/std/src/sys/args/windows.rs:27 — `args` turns every `Err` into `OsString::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err library/std/src/thread/spawnhook.rs:134 — `run_spawn_hooks` turns every `Err` into `ChildSpawnHooks::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err REDACTED:298 — `toolstate_repo` turns every `Err` into `"https://github.com/rust-lang-nursery/rust-toolstate.git".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/librustdoc/html/render/write_shared.rs:503 — `hack_get_external_crate_names` turns every `Err` into `Ok(Vec::default())` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/shim_utils/src/shared_helpers.rs:65 — `parse_rustc_verbose` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/clippy/lintcheck/src/main.rs:46 — `target_dir` turns every `Err` into `"target".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir/src/lib.rs:3050 — `params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir/src/lib.rs:3070 — `lifetime_params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir/src/lib.rs:3082 — `type_or_const_params` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir/src/semantics.rs:1981 — `get_unsafe_ops` turns every `Err` into `Default::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:1957 — `opaque_types_defined_by` turns every `Err` into `SolverDefIds::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:1968 — `opaque_types_and_coroutines_defined_by` turns every `Err` into `SolverDefIds::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/ide-assists/src/utils.rs:757 — `type_to_string` turns every `Err` into `"_".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs:119 — `spawn` turns every `Err` into `"unknown version".to_owned()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • + 3 more in this group — see findings.md.
D16 · Bus Factor · Off-boarding risk · ×26
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 21 significant file(s) lose their only recent owner: compiler/rustc_const_eval/src/interpret/validity.rs, src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs, src/tools/miri/src/shims/windows/fs.rs, src/tools/miri/src/shims/unix/macos/sync.rs, compiler/rustc_graphviz/src/lib.rs, compiler/rustc_const_eval/src/interpret/operator.rs, src/tools/miri/miri-script/src/commands.rs, src/tools/miri/src/borrow_tracker/mod.rs (+13 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 19 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/tt/src/storage.rs, src/tools/rust-analyzer/crates/ide/src/annotations.rs, src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs, src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs, src/tools/rust-analyzer/crates/hir-ide/src/diagnostics/match_check/pat_analysis.rs, src/tools/rust-analyzer/crates/hir-ty/src/infer/fallback.rs, src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs, src/tools/rust-analyzer/crates/mbe/src/lib.rs (+11 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 16 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_to_guarded_return.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_local_variable.rs, src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs, src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs, src/tools/rust-analyzer/crates/ide-completion/src/completions/keyword.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_return_type.rs (+8 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 13 significant file(s) lose their only recent owner: src/tools/rustfmt/src/imports.rs, compiler/rustc_ast/src/tokenstream.rs, compiler/rustc_mir_transform/src/dataflow_const_prop.rs, compiler/rustc_mir_dataflow/src/framework/graphviz.rs, src/tools/clippy/clippy_lints/src/attrs/mod.rs, compiler/rustc_errors/src/json.rs, compiler/rustc_mir_dataflow/src/framework/mod.rs, compiler/rustc_ast/src/mut_visit.rs (+5 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 11 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_bool_to_enum.rs, src/tools/rust-analyzer/crates/syntax/src/syntax_editor.rs, src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edit_algo.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_dbg.rs, src/tools/rust-analyzer/crates/syntax/src/ast.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_range_for_to_while.rs (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 11 significant file(s) lose their only recent owner: compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs, REDACTED, src/bootstrap/src/core/build_steps/gcc.rs, compiler/rustc_mir_build/src/builder/coverageinfo.rs, compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs, src/bootstrap/src/cli_main.rs, src/bootstrap/src/utils/metrics.rs, compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 10 significant file(s) lose their only recent owner: src/tools/opt-dist/src/main.rs, src/ci/citool/src/analysis.rs, library/std_detect/src/detect/os/linux/aarch64.rs, src/ci/citool/src/main.rs, src/tools/compiletest/src/executor.rs, src/tools/opt-dist/src/training.rs, src/tools/opt-dist/src/exec.rs, src/ci/citool/src/test_dashboard.rs (+2 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 10 significant file(s) lose their only recent owner: library/compiler-builtins/ci/ci-util.py, library/compiler-builtins/libm-test/src/run_cfg.rs, library/compiler-builtins/libm-test/src/generate/spaced.rs, library/compiler-builtins/libm-test/src/test_traits.rs, library/compiler-builtins/crates/libm-macros/src/parse.rs, library/compiler-builtins/libm/src/math/fmaf16.rs, library/compiler-builtins/libm/src/math/lgammaf_r.rs, library/compiler-builtins/compiler-builtins/src/math/mod.rs (+2 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #9 — If anonymized user #9 becomes unavailable, 8 significant file(s) lose their only recent owner: src/etc/debugger_tester/common.py, src/etc/lldb_lookup.py, src/etc/debugger_tester/lldb/check_lldb.py, src/etc/debugger_tester/lldb/from_lldb.py, src/etc/debugger_tester/lldb/batchmode.py, src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/gdb/from_gdb.py, src/tools/compiletest/src/runtest/debugger.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #10 — If anonymized user #10 becomes unavailable, 7 significant file(s) lose their only recent owner: compiler/rustc_builtin_macros/src/format_foreign/printf/mod.rs, compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs, compiler/rustc_builtin_macros/src/deriving/default.rs, compiler/rustc_builtin_macros/src/deriving/clone.rs, compiler/rustc_builtin_macros/src/deriving/partial_eq.rs, compiler/rustc_ast/src/util/parser.rs, compiler/rustc_expand/src/stats.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #11 — If anonymized user #11 becomes unavailable, 6 significant file(s) lose their only recent owner: library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs, library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs, library/compiler-builtins/compiler-builtins/src/int/specialized_div_rem/mod.rs, library/stdarch/crates/intrinsic-test/src/loongarch/types.rs, compiler/rustc_target/src/asm/loongarch.rs, library/compiler-builtins/compiler-builtins/src/int/leading_zeros.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #12 — If anonymized user #12 becomes unavailable, 6 significant file(s) lose their only recent owner: src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs, src/tools/clippy/clippy_lints/src/operators/identity_op.rs, compiler/rustc_type_ir/src/sty/consts.rs, compiler/rustc_type_ir/src/sty/mod.rs, library/core/src/num/bfloat.rs, src/tools/clippy/clippy_lints/src/methods/utils.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #13 — If anonymized user #13 becomes unavailable, 6 significant file(s) lose their only recent owner: library/std/src/error.rs, library/std/src/sys/args/windows.rs, library/std/src/sys/pal/windows/api.rs, library/core/src/slice/sort/select.rs, library/std/src/sys/path/windows.rs, compiler/rustc_driver_impl/src/signal_handler.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #14 — If anonymized user #14 becomes unavailable, 5 significant file(s) lose their only recent owner: library/stdarch/crates/core_arch/src/x86_64/amx.rs, library/stdarch/crates/stdarch-verify/src/lib.rs, library/stdarch/crates/stdarch-gen-arm/src/expression.rs, library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs, library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #15 — If anonymized user #15 becomes unavailable, 5 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/ide-db/src/defs.rs, src/tools/rust-analyzer/crates/test-utils/src/lib.rs, src/tools/rust-analyzer/crates/intern/src/gc.rs, src/tools/rust-analyzer/crates/ide/src/inlay_hints/closure_captures.rs, src/tools/rust-analyzer/crates/rust-analyzer/src/session.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #16 — If anonymized user #16 becomes unavailable, 5 significant file(s) lose their only recent owner: library/core/src/io/cursor.rs, library/core/src/io/write.rs, library/alloc/src/io/util.rs, library/alloc/src/io/mod.rs, library/alloc/src/io/buffered/mod.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #17 — If anonymized user #17 becomes unavailable, 5 significant file(s) lose their only recent owner: src/tools/rustfmt/src/rustfmt_diff.rs, src/tools/rustfmt/src/emitter/json.rs, REDACTED, src/tools/rust-analyzer/editors/code/src/new_project.ts, src/tools/rust-analyzer/editors/code/src/toolchain.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #18 — If anonymized user #18 becomes unavailable, 4 significant file(s) lose their only recent owner: library/stdarch/crates/core_arch/src/s390x/vector.rs, compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs, library/stdarch/crates/stdarch-test/src/disassembly.rs, library/portable-simd/crates/std_float/src/lib.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #19 — If anonymized user #19 becomes unavailable, 4 significant file(s) lose their only recent owner: library/std/src/os/xous/ffi.rs, compiler/rustc_incremental/src/diagnostics.rs, library/compiler-builtins/compiler-builtins/src/int/mul.rs, compiler/rustc_codegen_gcc/src/debuginfo.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #20 — If anonymized user #20 becomes unavailable, 4 significant file(s) lose their only recent owner: library/std/src/sys/pal/sgx/abi/usercalls/mod.rs, library/std/src/sys/sync/unsafe_list.rs, library/std/src/sys/pal/sgx/waitqueue/mod.rs, library/std/src/sys/sync/unsafe_list/tests.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #21 — If anonymized user #21 becomes unavailable, 4 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs, src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unresolved_method.rs, src/tools/rust-analyzer/crates/stdx/src/variance.rs, src/tools/rust-analyzer/crates/hir-def/src/src.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #22 — If anonymized user #22 becomes unavailable, 3 significant file(s) lose their only recent owner: src/tools/rust-analyzer/crates/hir-ty/src/target_feature.rs, library/std_detect/src/detect/arch/riscv.rs, library/std_detect/src/detect/os/riscv.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #23 — If anonymized user #23 becomes unavailable, 3 significant file(s) lose their only recent owner: compiler/rustc_borrowck/src/session_diagnostics.rs, compiler/rustc_driver_impl/src/highlighter.rs, library/core/src/async_iter/async_iter.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #24 — If anonymized user #24 becomes unavailable, 3 significant file(s) lose their only recent owner: compiler/rustc_attr_ir/src/attribute_docs.rs, src/tools/clippy/clippy_utils/src/msrvs.rs, compiler/rustc_attr_ir/src/attr.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #25 — If anonymized user #25 becomes unavailable, 3 significant file(s) lose their only recent owner: src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs, compiler/rustc_data_structures/src/sync/parallel.rs, compiler/rustc_data_structures/src/sync.rs. Pair on, review, or document these before any departure.
  • + 1 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate src/librustdoc/html/static/js/main.js:650 — `ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts` appears character-identically in 2 files — src/librustdoc/html/static/js/main.js, src/tools/clippy/util/gh-pages/script.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/librustdoc/html/static/js/main.js:1605 — `menu.contains(document.activeElement) || menu.contains(event.relatedTarget)` appears character-identically in 2 files — src/librustdoc/html/static/js/main.js, src/librustdoc/html/static/js/settings.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:172 — `child_types_ok == Result.Mismatch and all_providers_ok` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/lldb_lookup.py:535 — `fields[0].name == ENUM_DISR_FIELD_NAME or fields[0].name == ENUM_LLDB_ENCODED_VARIANTS` appears character-identically in 2 files — src/etc/lldb_lookup.py, src/etc/rust_types.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:300 — `got.name != exp.name or got.type != exp.type or got.value != exp.value` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:260 — `not children_ok and var.synthetic is not None` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:152 — `type_match_ok == Result.Mismatch and all_providers_ok` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:178 — `type_ok and type_match_ok and pretty_type_name_ok and pretty_print_ok and value_ok and synthetic_ok and summary_ok and format_ok and childre…` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/etc/debugger_tester/gdb/check_gdb.py:142 — `var.has_visualizer() or expected.has_visualizer()` appears character-identically in 2 files — src/etc/debugger_tester/gdb/check_gdb.py, src/etc/debugger_tester/lldb/check_lldb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/tools/rustfmt/src/imports.rs:365 — `!attrs.first().unwrap().is_doc_comment() && context.config.inline_attribute_width() >= line_len` appears character-identically in 2 files — src/tools/rustfmt/src/imports.rs, src/tools/rustfmt/src/items.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_target/src/callconv/mips64.rs:243 — `!fn_abi.ret.is_ignore() && fn_abi.ret.layout.is_sized()` appears character-identically in 2 files — compiler/rustc_target/src/callconv/mips64.rs, compiler/rustc_target/src/callconv/sparc64.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_target/src/callconv/powerpc64.rs:100 — `!is_ret && arg.layout.pass_indirectly_in_non_rustic_abis(cx)` appears character-identically in 2 files — compiler/rustc_target/src/callconv/powerpc64.rs, compiler/rustc_target/src/callconv/xtensa.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_hir_typeck/src/op.rs:41 — `!lhs_ty.is_ty_var() && !rhs_ty.is_ty_var() && is_builtin_binop(lhs_ty, rhs_ty, category)` appears character-identically in 2 files — compiler/rustc_hir_typeck/src/op.rs, src/tools/rust-analyzer/crates/hir-ty/src/infer/op.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:571 — `!out_value.has_infer() && !out_value.has_placeholders()` appears character-identically in 2 files — compiler/rustc_infer/src/infer/canonical/canonicalizer.rs, src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/canonical/canonicalizer.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_next_trait_solver/src/normalize.rs:154 — `!self.cx().renormalize_rigid_aliases() && !ct.has_non_rigid_aliases()` appears character-identically in 2 files — compiler/rustc_next_trait_solver/src/normalize.rs, compiler/rustc_trait_selection/src/solve/normalize.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_next_trait_solver/src/normalize.rs:103 — `!self.cx().renormalize_rigid_aliases() && !ty.has_non_rigid_aliases()` appears character-identically in 2 files — compiler/rustc_next_trait_solver/src/normalize.rs, compiler/rustc_trait_selection/src/solve/normalize.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_next_trait_solver/src/normalize.rs:113 — `!self.cx().renormalize_rigid_aliases() && orig_is_rigid == ty::IsRigid::Yes` appears character-identically in 2 files — compiler/rustc_next_trait_solver/src/normalize.rs, compiler/rustc_trait_selection/src/solve/normalize.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate library/std/src/sync/mpmc/array.rs:396 — `!self.is_empty() || self.is_disconnected()` appears character-identically in 2 files — library/std/src/sync/mpmc/array.rs, library/std/src/sync/mpmc/list.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_ast_lowering/src/lib.rs:1272 — `!self.tcx.features().return_type_notation() && self.tcx.sess.is_nightly_build()` appears character-identically in 2 files — compiler/rustc_ast_lowering/src/lib.rs, compiler/rustc_ast_lowering/src/path.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_hir_typeck/src/method/probe.rs:2741 — `!trait_ref.skip_binder().args.has_infer() && !trait_ref.skip_binder().args.has_placeholders()` appears character-identically in 2 files — compiler/rustc_hir_typeck/src/method/probe.rs, src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate library/stdarch/crates/core_arch/src/x86/macros.rs:18 — `$imm == 4 || $imm == 8 || $imm == 9 || $imm == 10 || $imm == 11` appears character-identically in 2 files — library/stdarch/crates/core_arch/src/x86/macros.rs, library/stdarch/crates/core_arch/src/x86_64/macros.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_base.rs:22 — `F32(f32_consts::E) == value || F64(f64_consts::E) == value` appears character-identically in 2 files — src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_base.rs, src/tools/clippy/clippy_lints/src/floating_point_arithmetic/powf.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_infer/src/infer/relate/lattice.rs:238 — `a.skip_binder().has_escaping_bound_vars() || b.skip_binder().has_escaping_bound_vars()` appears character-identically in 2 files — compiler/rustc_infer/src/infer/relate/lattice.rs, src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/relate/lattice.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_target/src/callconv/mips64.rs:248 — `arg.is_ignore() || !arg.layout.is_sized()` appears character-identically in 4 files — compiler/rustc_target/src/callconv/mips64.rs, compiler/rustc_target/src/callconv/powerpc64.rs, compiler/rustc_target/src/callconv/x86.rs, compiler/rustc_target/src/callconv/x86_win32.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate compiler/rustc_lint/src/drop_forget_useless.rs:182 — `arg_ty.is_ref() && !drop_is_single_call_in_arm` appears character-identically in 2 files — compiler/rustc_lint/src/drop_forget_useless.rs, src/tools/clippy/clippy_lints/src/drop_forget_ref.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
D34 · Knowledge Freshness · Orphaned file · ×20
  • Orphaned file library/std/src/sys/net/connection/motor.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/jsondocck/src/directive.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/compiletest/src/runtest/coverage.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rust-analyzer/crates/parser/src/parser.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/config/file_lines.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/reorder.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file library/std/src/thread/scoped.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/sort.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file compiler/rustc_span/src/analyze_source_file.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/shape.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file library/std/src/sys/process/unix/fuchsia.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file library/core/src/ops/drop.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file library/core/src/num/imp/int_sqrt.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/vertical.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file library/core/src/num/imp/traits.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/config_proc_macro/src/item_enum.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/formatting/newline_style.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/format-diff/main.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/git-rustfmt/main.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/tools/rustfmt/src/rewrite.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
X9 · Subsumed condition operand · Subsumed condition operand · ×2
  • Subsumed condition operand src/bootstrap/src/core/build_steps/compile.rs:1162 — `filename.contains("rustc_public_bridge")` can never decide this `||` — every value satisfying `filename.contains("rustc_public_bridge")` also satisfies `filename.contains("rustc_public")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand library/stdarch/crates/stdarch-gen-hexagon/src/hvx.rs:1384 — `name.ends_with("nq")` can never decide this `||` — every value satisfying `name.ends_with("nq")` also satisfies `name.ends_with("q")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 84 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (294 single-owned of 2618 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2618 of the 6258 production source files in this repository met that bar). They are anonymized user #27 (2 file(s)), anonymized user #28 (2 file(s)), anonymized user #29 (2 file(s)), anonymized user #30 (2 file(s)), anonymized user #31 (2 file(s)), anonymized user #32 (2 file(s)) (+78 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src/tools/miri/src/shims/unix/tcp_socket.rs, src/tools/miri/src/shims/unix/socket.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/unwrap_return_type.rs, src/tools/rust-analyzer/crates/ide-assists/src/handlers/promote_local_to_const.rs, compiler/rustc_data_structures/src/profiling.rs, library/core/src/iter/traits/collect.rs, compiler/rustc_thread_pool/src/registry.rs, compiler/rustc_thread_pool/src/sleep/mod.rs (+91 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. The recognised ADR directories in this tree were read — `src/tools/clippy/book/src/development/proposals`, `tests/ui/rfcs` — and none of their files is a decision record (a README, index or template page does not count). What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 27 of 235 project(s) overshoot their size bounds, lowering Project Cohesion to 7.7/10. The most over is `library/stdarch/crates/core_arch` (226546 LoC, 533 module-visible types across 27 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 20 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: library/std/src/sys/net/connection/motor.rs, src/tools/jsondocck/src/directive.rs, src/tools/compiletest/src/runtest/coverage.rs, src/tools/rust-analyzer/crates/parser/src/parser.rs, src/tools/rustfmt/src/reorder.rs, library/std/src/thread/scoped.rs, src/tools/rustfmt/src/sort.rs, compiler/rustc_span/src/analyze_source_file.rs (and 12 more) (24 orphaned of 2634 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2634 of the 6258 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 87/161 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `compiler/rustc`, `compiler/rustc_codegen_cranelift/build_system`, `compiler/rustc_codegen_gcc/build_system`, `compiler/rustc_codegen_gcc/build_system/asm-tester` and 69 more.
R7 · Dead Code · Unused export 'fetchDependencyGraph' · ×1
  • Unused export 'fetchDependencyGraph' src/tools/rust-analyzer/editors/code/src/lsp_ext.ts:160 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'unwrapNullable' · ×1
  • Unused export 'unwrapNullable' REDACTED:231 — Nothing imports this binding — it is safe to review for removal.
X23 · Unguarded diagnostic materialisation · Diagnostic log message is built whether or not it is wanted · ×1
  • Diagnostic log message is built whether or not it is wanted src/tools/rust-analyzer/editors/code/src/debug.ts:71 — `debug` at line 71 is called with an argument built by `JSON.stringify(debugConfig, null, 2)` (line 71), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~1.7 `!` null assertions per 1k TypeScript source lines — 12 assertion(s) across the 7036 source line(s) of the 19 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: src/tools/rust-analyzer/editors/code/src/dependencies_provider.ts (3), src/tools/rust-analyzer/editors/code/src/client.ts (2), src/tools/rust-analyzer/editors/code/src/commands.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure src/etc/debugger_tester/gdb/from_gdb.py:84 — `get_fields` returns `[]` when `TypeError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch src/tools/rust-analyzer/lib/smol_str/src/gdb_smolstr_printer.py:54 — `to_string` swallows every exception into `return '<SmolStr: missing __0>'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Minor — 74 finding(s)
D12 · Dependency Hygiene · Outdated · ×72
  • Outdated: annotate-snippets — `annotate-snippets` is locked at 0.12.16 but 0.12.17 is the current stable release on crates.io, and it already satisfies the `"0.12.16"` requirement declared in compiler/rustc_errors/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p annotate-snippets` and commit the updated REDACTED.
  • Outdated: anstyle — `anstyle` is locked at 1.0.13 but 1.0.14 is the current stable release on crates.io, and it already satisfies the `"1.0.13"` requirement declared in compiler/rustc_driver_impl/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anstyle` and commit the updated REDACTED.
  • Outdated: anyhow — `anyhow` is locked at 1.0.102 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0.101"` requirement declared in library/compiler-builtins/libm-test/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arrayvec — `arrayvec` is locked at 0.7.6 but 0.7.8 is the current stable release on crates.io, and it already satisfies the `"0.7"` requirement declared in compiler/rustc_data_structures/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arrayvec` and commit the updated REDACTED.
  • Outdated: autocfg — `autocfg` is locked at 1.5.0 but 1.5.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src/tools/miri/test-cargo-miri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p autocfg` and commit the updated REDACTED.
  • Outdated: backtrace — `backtrace` is locked at 0.3.75 but 0.3.76 is the current stable release on crates.io, and it already satisfies the `"0.3.65"` requirement declared in src/tools/miri/bench-cargo-miri/backtraces/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p backtrace` and commit the updated REDACTED.
  • Outdated: bitflags — `bitflags` is locked at 2.10.0 but 2.13.2 is the current stable release on crates.io, and it already satisfies the `"2.4.1"` requirement declared in compiler/rustc_abi/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitflags` and commit the updated REDACTED.
  • Outdated: blake3 — `blake3` is locked at 1.8.2 but 1.8.7 is the current stable release on crates.io, and it already satisfies the `"1.5.2"` requirement declared in compiler/rustc_span/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p blake3` and commit the updated REDACTED.
  • Outdated: bstr — `bstr` is locked at 1.12.1 but 1.13.1 is the current stable release on crates.io, and it already satisfies the `"1.11.3"` requirement declared in compiler/rustc_codegen_ssa/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bstr` and commit the updated REDACTED.
  • Outdated: camino — `camino` is locked at 1.2.1 but 1.2.6 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src/tools/compiletest/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p camino` and commit the updated REDACTED.
  • Outdated: cfg-if — `cfg-if` is locked at 1.0.4 but 1.0.5 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in library/std/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cfg-if` and commit the updated REDACTED.
  • Outdated: chrono — `chrono` is locked at 0.4.42 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in src/bootstrap/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
  • Outdated: clap — `clap` is locked at 4.6.1 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.4"` requirement declared in src/bootstrap/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: crossbeam-channel — `crossbeam-channel` is locked at 0.5.15 but 0.5.17 is the current stable release on crates.io, and it already satisfies the `"0.5.6"` requirement declared in src/tools/clippy/lintcheck/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-channel` and commit the updated REDACTED.
  • Outdated: crossbeam-deque — `crossbeam-deque` is locked at 0.8.6 but 0.8.8 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in compiler/rustc_thread_pool/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-deque` and commit the updated REDACTED.
  • Outdated: crossbeam-utils — `crossbeam-utils` is locked at 0.8.21 but 0.8.23 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in compiler/rustc_thread_pool/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-utils` and commit the updated REDACTED.
  • Outdated: ctrlc — `ctrlc` is locked at 3.5.1 but 3.5.2 is the current stable release on crates.io, and it already satisfies the `"3.4.4"` requirement declared in compiler/rustc_driver_impl/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ctrlc` and commit the updated REDACTED.
  • Outdated: curl — `curl` is locked at 0.4.49 but 0.4.51 is the current stable release on crates.io, and it already satisfies the `"0.4.38"` requirement declared in src/tools/bump-stage0/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p curl` and commit the updated REDACTED.
  • Outdated: cxx — `cxx` is locked at 1.0.188 but 1.0.205 is the current stable release on crates.io, and it already satisfies the `"1.0.173"` requirement declared in src/tools/miri/genmc-sys/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cxx` and commit the updated REDACTED.
  • Outdated: cxx-build — `cxx-build` is locked at 1.0.188 but 1.0.205 is the current stable release on crates.io, and it already satisfies the `"1.0.173"` requirement declared in src/tools/miri/genmc-sys/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cxx-build` and commit the updated REDACTED.
  • Outdated: derive-where — `derive-where` is locked at 1.6.1 but 1.7.0 is the current stable release on crates.io, and it already satisfies the `"1.2.7"` requirement declared in compiler/rustc_next_trait_solver/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p derive-where` and commit the updated REDACTED.
  • Outdated: derive_setters — `derive_setters` is locked at 0.1.8 but 0.1.9 is the current stable release on crates.io, and it already satisfies the `"0.1.6"` requirement declared in compiler/rustc_errors/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p derive_setters` and commit the updated REDACTED.
  • Outdated: dissimilar — `dissimilar` is locked at 1.0.10 but 1.0.11 is the current stable release on crates.io, and it already satisfies the `"1.0.10"` requirement declared in src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p dissimilar` and commit the updated REDACTED.
  • Outdated: either — `either` is locked at 1.15.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.5.0"` requirement declared in compiler/rustc_borrowck/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
  • Outdated: env_logger — `env_logger` is locked at 0.11.8 but 0.11.11 is the current stable release on crates.io, and it already satisfies the `"0.11"` requirement declared in src/tools/opt-dist/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p env_logger` and commit the updated REDACTED.
  • + 47 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: api-list-common — api-list-common: abstractness 0.00, instability 0.00, distance 1.00 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: stdarch-gen-common — stdarch-gen-common: abstractness 0.00, instability 0.00, distance 1.00 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-7ea0d6b8891e40249dd4d0623a246f5f/history.json --exit-code 0 --source .55artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-7ea0d6b8891e40249dd4d0623a246f5f/tree.json --exit-code 0 --source .2artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude compiler/rustc_baked_icu_data/src/data --exclude library/coretests/tests/unicode --exclude src/tools/cargotest/lockfiles --exclude src/tools/rust-analyzer/crates/ide-assists/src/tests --exclude src/tools/rust-analyzer/crates/ide-db/src/generated --exclude src/tools/rust-analyzer/crates/parser/src/syntax_kind --exclude src/tools/rust-analyzer/crates/syntax/src/ast/generated --exclude src/tools/rustfmt/tests/source/configs/format_generated_files --exclude src/tools/rustfmt/tests/target/configs/format_generated_files .79artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update42artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .156artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 2 file(s) — `src/librustdoc/html/static/js/rustdoc.d.ts`, `src/librustdoc/html/static/js/stringdex.d.ts` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17584-a5de-7f8d-8bcd-b6ebd3d3aa45 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md