-------------------------------------------------------------------------------- Profile data file 'results/clgout-nightly-2026-08-14-tuple-stress-Clippy-IncrUnchanged-Threads1' (creator: callgrind-3.25.1) -------------------------------------------------------------------------------- I1 cache: D1 cache: LL cache: Timerange: Basic block 0 - 3398836941 Trigger: Program termination Profiled target: /home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver --crate-name tuple_stress --edition=2015 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs,test) --check-cfg cfg(feature, values()) -C metadata=b0ff877e7ca859a6 -C extra-filename=-4138d1a72d44e213 --out-dir /tmp/.tmpl95mX4/target/debug/deps -L dependency=/tmp/.tmpl95mX4/target/debug/deps -C incremental=/tmp/.tmpl95mX4/incremental-state -Wclippy::all -Zthreads=1 -Adeprecated -Aunknown-lints -Zincremental-verify-ich (PID 725607, part 1) Events recorded: Ir Events shown: Ir Event sort order: Ir Thresholds: 99 Include dirs: User annotated: Auto-annotation: on -------------------------------------------------------------------------------- Ir -------------------------------------------------------------------------------- 20,330,873,376 (100.0%) PROGRAM TOTALS -------------------------------------------------------------------------------- Ir file:function -------------------------------------------------------------------------------- 1,950,288,526 ( 9.59%) ???:core::num::imp::flt2dec::strategy::grisu::format_shortest_opt'2 [???] 1,405,441,371 ( 6.91%) ???:core::num::imp::flt2dec::strategy::grisu::format_shortest_opt [???] 910,772,418 ( 4.48%) ???:core::fmt::float::float_to_decimal_common_shortest:: [???] 839,407,094 ( 4.13%) ???:::write_formatted_parts [???] 649,218,275 ( 3.19%) ???:0x0000000000173dc0 [/usr/lib/libc.so.6] 618,147,971 ( 3.04%) ???:::pad_formatted_parts [???] 590,974,425 ( 2.91%) ???:core::num::imp::flt2dec::strategy::grisu::format_exact_opt [???] 527,588,094 ( 2.60%) ???:core::num::imp::flt2dec::strategy::dragon::format_exact [???] 392,803,862 ( 1.93%) ???:core::fmt::float::float_to_decimal_common_exact:: [???] 356,862,590 ( 1.76%) ???:core::num::imp::flt2dec::digits_to_dec_str [???] 341,331,214 ( 1.68%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/string.rs:::write_str [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 339,744,672 ( 1.67%) site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 317,591,590 ( 1.56%) ???:::write_str [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 283,349,816 ( 1.39%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:>::reserve::do_reserve_and_handle:: [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 258,835,899 ( 1.27%) ???:alloc::fmt::format::format_inner [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 254,367,190 ( 1.25%) ???:::advance_token [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 230,090,722 ( 1.13%) include/jemalloc/internal/rtree.h:free 214,711,396 ( 1.06%) ???:>::with::<::with::outer_expn_data::{closure#0}>::{closure#0}, rustc_span::hygiene::ExpnData> [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 206,704,766 ( 1.02%) ???:::encode_span [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 192,484,061 ( 0.95%) ???:::decode_span [???] 170,010,002 ( 0.84%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::finish_grow [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 164,165,175 ( 0.81%) ???:::collect_tokens_for_expr::<::parse_expr_dot_or_call::{closure#0}>'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 163,814,227 ( 0.81%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::write_str 162,158,845 ( 0.80%) ???:core::fmt::write [???] 150,866,244 ( 0.74%) ???:::stable_hash:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 150,458,848 ( 0.74%) ???:::mul_pow2 [???] 146,284,806 ( 0.72%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:::write_str 140,973,250 ( 0.69%) ???:0x0000000000173660 [/usr/lib/libc.so.6] 139,225,087 ( 0.68%) include/jemalloc/internal/sz.h:realloc 135,329,483 ( 0.67%) include/jemalloc/internal/jemalloc_internal_inlines_c.h:malloc [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 135,230,695 ( 0.67%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/jemalloc.c:free 132,901,194 ( 0.65%) ???:core::num::imp::flt2dec::strategy::grisu::format_exact_opt::possibly_round [???] 132,204,134 ( 0.65%) ???:::stable_hash::'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 127,403,746 ( 0.63%) ???:::parent_hir_node [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 123,595,065 ( 0.61%) ???:core::fmt::write'2 [???] 122,037,576 ( 0.60%) site/frontend/rust-clippy/clippy_lints/src/approx_const.rs:::check_known_consts [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 117,719,530 ( 0.58%) ???:::fmt [???] 115,604,780 ( 0.57%) ???: as rustc_ast::visit::Visitor>::visit_expr'2 [???] 103,581,926 ( 0.51%) ???:::from_token_lit [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 101,310,931 ( 0.50%) ???:>::decode [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 98,295,710 ( 0.48%) ???:::finish_grow [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 98,289,335 ( 0.48%) ???:>::reserve::do_reserve_and_handle:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 96,604,580 ( 0.48%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/jemalloc.c:realloc [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 94,675,030 ( 0.47%) include/jemalloc/internal/cache_bin.h:malloc 94,057,755 ( 0.46%) ???:::write_char [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 93,445,143 ( 0.46%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:::finish_grow 86,231,073 ( 0.42%) src/arena.c:realloc 84,903,756 ( 0.42%) ???:::lower_expr_mut'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 81,324,844 ( 0.40%) ???:>::encode [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 81,111,540 ( 0.40%) include/jemalloc/internal/cache_bin.h:free 81,000,024 ( 0.40%) ???:::lookup_byte_offset [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 79,579,260 ( 0.39%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/string.rs:::check_known_consts 79,337,999 ( 0.39%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:::finish_grow 78,120,297 ( 0.38%) ???:__rustc::__rust_alloc [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 72,488,065 ( 0.36%) ???:)>>::call_once [???] 72,353,448 ( 0.36%) site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::first_node_in_macro:: [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 71,587,575 ( 0.35%) ???:::next_token_from_cursor [???] 68,420,841 ( 0.34%) ???:>::decode [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 67,671,130 ( 0.33%) include/jemalloc/internal/sz.h:malloc 66,416,818 ( 0.33%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:::check_known_consts 65,349,805 ( 0.32%) include/jemalloc/internal/rtree.h:realloc 65,230,853 ( 0.32%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:::finish_grow 65,229,164 ( 0.32%) ???:::short_write_process_buffer::<8> [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 63,310,628 ( 0.31%) ???:::in_external_macro [???] 62,915,607 ( 0.31%) ???:>::push [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 56,669,965 ( 0.28%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:>::reserve::do_reserve_and_handle:: 55,050,520 ( 0.27%) ???:::next [???] 52,693,282 ( 0.26%) ???:rustc_middle::ty::codec::encode_with_shorthand::::type_shorthands> [???] 52,691,408 ( 0.26%) ???:__rustc::__rust_realloc [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 52,321,509 ( 0.26%) ???:::bump_minimal [???] 49,806,600 ( 0.24%) ???:core::num::imp::dec2flt::parse::parse_number [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 48,761,602 ( 0.24%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:::write_str 47,188,000 ( 0.23%) ???:::hir_attrs [???] 46,466,749 ( 0.23%) ???:::lex_token_trees'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 45,335,994 ( 0.22%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs:::finish_grow 45,145,819 ( 0.22%) ???: as rustc_data_structures::stable_hash::StableHash>::stable_hash:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 43,055,505 ( 0.21%) ???:>::decode'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 40,539,401 ( 0.20%) include/jemalloc/internal/thread_event.h:malloc 39,795,250 ( 0.20%) include/jemalloc/internal/thread_event.h:realloc 38,223,163 ( 0.19%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs:::check_known_consts 37,857,050 ( 0.19%) ???:::short_write_process_buffer::<4> [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 37,749,926 ( 0.19%) ???:::desugaring_kind [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 37,023,776 ( 0.18%) include/jemalloc/internal/arena_inlines_b.h:realloc 36,573,448 ( 0.18%) ???:::to [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 34,243,348 ( 0.17%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:::check_known_consts 34,154,920 ( 0.17%) include/jemalloc/internal/tcache_inlines.h:realloc 34,144,138 ( 0.17%) site/frontend/rust-clippy/clippy_lints/src/float_literal.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 34,001,979 ( 0.17%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:>::reserve::do_reserve_and_handle:: 31,719,600 ( 0.16%) ???: as rustc_hir::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}'2 [???] 31,457,600 ( 0.15%) ???: as rustc_hir::intravisit::Visitor>::visit_expr'2 [???] 31,457,588 ( 0.15%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:clippy_utils::macros::first_node_in_macro:: 30,932,848 ( 0.15%) ???:>>::walk_ref'2 [???] 30,278,017 ( 0.15%) site/frontend/rust-clippy/clippy_lints/src/combined_early_pass.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 29,485,574 ( 0.15%) site/frontend/rust-clippy/clippy_lints/src/literal_representation.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 28,884,215 ( 0.14%) include/jemalloc/internal/rtree.h:tcache_bin_flush_small 28,571,189 ( 0.14%) include/jemalloc/internal/cache_bin.h:realloc 28,181,469 ( 0.14%) ???:::check_expr [???] 27,526,870 ( 0.14%) ???: as rustc_ast::visit::Visitor>::visit_id [???] 27,069,076 ( 0.13%) include/jemalloc/internal/sz.h:free 26,344,476 ( 0.13%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:::check_known_consts 26,344,476 ( 0.13%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:::check_known_consts 26,344,476 ( 0.13%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/validations.rs:::check_known_consts 25,895,299 ( 0.13%) ???:0x00000000001747c0 [/usr/lib/libc.so.6] 25,688,096 ( 0.13%) ???:core::num::imp::flt2dec::strategy::dragon::mul_pow10 [???] 25,428,078 ( 0.13%) ???:>::walk_ref'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 25,425,772 ( 0.13%) ???:md5::compress::soft::compress [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 24,772,230 ( 0.12%) ???:::from_str [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 24,381,190 ( 0.12%) ???:::hir_node [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 24,380,801 ( 0.12%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:::write_str 24,380,801 ( 0.12%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:::write_str 24,380,262 ( 0.12%) site/frontend/rust-clippy/clippy_lints/src/doc/mod.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 24,248,009 ( 0.12%) ???:::parse_expr_assoc_with'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 23,446,149 ( 0.12%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/tcache.c:tcache_bin_flush_small [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 22,798,490 ( 0.11%) ???:::stable_hash:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 22,667,986 ( 0.11%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs:>::reserve::do_reserve_and_handle:: 22,020,202 ( 0.11%) ???:rustc_span::hygiene::decode_syntax_context::::decode_syntax_context::{closure#0}> [???] 21,578,787 ( 0.11%) ???:::span_to_snippet [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 21,542,011 ( 0.11%) site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::new [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 21,234,038 ( 0.10%) ???:stacker::remaining_stack [???] 21,089,460 ( 0.10%) ???:::short_write_process_buffer::<1> [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 20,618,881 ( 0.10%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::check_known_consts 20,054,449 ( 0.10%) site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 19,602,063 ( 0.10%) ???:::lower_expr_mut [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 18,874,704 ( 0.09%) site/frontend/rust-clippy/clippy_lints/src/casts/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 18,154,659 ( 0.09%) ???:rustc_query_impl::plumbing::encode_query_values_inner::, rustc_middle::dep_graph::graph::DepNodeIndex>, &rustc_middle::ty::typeck_results::TypeckResults>::{closure#0} [???] 18,088,136 ( 0.09%) site/frontend/rust-clippy/clippy_lints/src/misc.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 17,694,688 ( 0.09%) ???:>::walk_mut'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 17,367,496 ( 0.09%) ???:::resolve_expr'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 17,302,604 ( 0.09%) ???:core::ptr::drop_glue::> [???] 17,121,674 ( 0.08%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:::check_known_consts 17,057,916 ( 0.08%) include/jemalloc/internal/tsd.h:realloc 17,038,129 ( 0.08%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::check_known_consts 16,515,366 ( 0.08%) site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 16,515,156 ( 0.08%) ???:::visit_expr'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 16,122,263 ( 0.08%) ???:::expect_hir_owner_nodes [???] 16,122,127 ( 0.08%) site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_different_sizes.rs:clippy_lints::casts::cast_slice_different_sizes::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 16,056,124 ( 0.08%) ???:::filter_map_expr'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,963,269 ( 0.08%) ???:core::slice::memchr::memrchr [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,924,296 ( 0.08%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_known_consts 15,859,783 ( 0.08%) ???:::visit_expr'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,729,640 ( 0.08%) ???:::take [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,466,448 ( 0.08%) ???:core::ptr::drop_glue:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,275,123 ( 0.08%) src/arena.c:malloc_default 15,270,157 ( 0.08%) ???:rustc_hir::intravisit::walk_expr::'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 15,072,739 ( 0.07%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::check_known_consts 15,007,761 ( 0.07%) ???:>::walk_mut'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 14,549,165 ( 0.07%) site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_arg.rs:clippy_lints::unit_types::unit_arg::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 14,549,112 ( 0.07%) site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 14,221,303 ( 0.07%) ???:>::walk_mut'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 14,206,370 ( 0.07%) src/hook.c:realloc 14,156,450 ( 0.07%) ???:::hir_attrs'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 14,155,848 ( 0.07%) ???:::next'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 14,056,638 ( 0.07%) ???:memchr::arch::x86_64::memchr::memchr_raw::find_avx2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 13,762,733 ( 0.07%) site/frontend/rust-clippy/clippy_lints/src/byte_char_slices.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 13,717,704 ( 0.07%) site/frontend/rust-clippy/clippy_utils/src/source.rs:clippy_utils::source::get_source_range [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 13,534,762 ( 0.07%) include/jemalloc/internal/tsd_tls.h:free [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 13,534,761 ( 0.07%) include/jemalloc/internal/atomic.h:free 13,470,949 ( 0.07%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/jemalloc.c:malloc 12,976,333 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/loops/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 12,975,930 ( 0.06%) ???:::parse_expr_prefix'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 12,714,039 ( 0.06%) ???:>::walk_ref'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 12,714,039 ( 0.06%) ???:>::walk_ref'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 12,714,039 ( 0.06%) ???:>::walk_ref'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 12,714,039 ( 0.06%) ???:>::walk_ref'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 12,320,674 ( 0.06%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:>::next_back [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 12,189,913 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/matches/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 12,058,977 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/operators/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 12,058,299 ( 0.06%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/fmt.rs:::check_known_consts 11,961,680 ( 0.06%) ???:__rustc::__rdl_dealloc [???] 11,857,546 ( 0.06%) include/jemalloc/internal/emap.h:tcache_bin_flush_small 11,796,720 ( 0.06%) ???:::range_span [???] 11,796,667 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/dereference.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,796,650 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/redundant_async_block.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,796,526 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/macro_metavars_in_unsafe.rs:::visit_expr'2 [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,403,750 ( 0.06%) ???:::parse_expr_array_or_repeat [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 11,403,481 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/strings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,403,385 ( 0.06%) site/frontend/rust-clippy/clippy_lints/src/misc_early/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,403,378 ( 0.06%) ???:::visit_expr'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 11,373,887 ( 0.06%) include/jemalloc/internal/atomic.h:realloc 11,365,212 ( 0.06%) include/jemalloc/internal/jemalloc_internal_inlines_a.h:realloc 11,337,824 ( 0.06%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr::>'2 [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,333,993 ( 0.06%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:>::reserve::do_reserve_and_handle:: 11,170,294 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/literal_representation.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 11,127,754 ( 0.05%) include/jemalloc/internal/edata.h:tcache_bin_flush_small 11,059,440 ( 0.05%) ???:::get_str [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 11,039,516 ( 0.05%) ???:std::exception::~exception() [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 11,010,237 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/repeat_vec_with_capacity.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,616,987 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/manual_option_as_slice.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,485,863 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/raw_strings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,223,835 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/question_mark.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,223,801 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/ranges.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,223,801 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/regex.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 10,158,071 ( 0.05%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr::'2 [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,928,212 ( 0.05%) site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::from_lit_kind [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,850,575 ( 0.05%) ???:rustc_middle::dep_graph::read_deps::<::read_index::{closure#0}>::{closure#0} [???] 9,830,725 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,830,573 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/methods/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,830,569 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/useless_conversion.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,830,540 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/redundant_slicing.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,633,919 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/formatting.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,440,473 ( 0.05%) ???:::slice_write_process_buffer [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 9,437,426 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/incompatible_msrv.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,374 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/legacy_numeric_constants.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,352 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs:::check_expr_post [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,352 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/format.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,352 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/if_let_mutex.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,327 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/ifs/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,208 ( 0.05%) site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:clippy_lints::suspicious_operation_groupings::if_statement_binops [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,437,040 ( 0.05%) ???:thin_vec::drop_non_singleton::>'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 9,044,363 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/octal_escapes.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,044,244 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/attrs/mod.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,044,142 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/needless_nonzero_get.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,044,121 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/bit_width.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 9,044,014 ( 0.04%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:clippy_utils::in_automatically_derived 9,043,533 ( 0.04%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/rt.rs:::check_known_consts 8,651,093 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::meets [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,651,038 ( 0.04%) ???:rustc_resolve::rustdoc::unindent_doc_fragments [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 8,650,959 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/len_zero.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,910 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/manual_main_separator_str.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,909 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/manual_is_ascii_check.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,906 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/match_result_ok.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,896 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/redundant_closure_call.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,886 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/unnecessary_mut_passed.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,865 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/double_parens.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,848 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/precedence.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,811 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::fn_def_id_with_node_args [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,650,774 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:clippy_lints::suspicious_operation_groupings::append_opt_vecs:: [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,523,927 ( 0.04%) include/jemalloc/internal/tsd_tls.h:realloc 8,520,346 ( 0.04%) ???:>>::drop_slow'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 8,388,480 ( 0.04%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/validations.rs:::check_expr 8,257,704 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/manual_clamp.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,700 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_cmp.rs:clippy_lints::unit_types::unit_cmp::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,699 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/bool_comparison.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,694 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/partialeq_to_none.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,683 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/operators/eq_op.rs:clippy_lints::operators::eq_op::check_assert [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,683 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/useless_vec.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,683 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/utils/author.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,257,683 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/utils/dump_hir.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 8,126,572 ( 0.04%) ???:core::ptr::drop_glue::'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 8,058,782 ( 0.04%) ???:>::decode [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 7,975,564 ( 0.04%) ???:::get_lint_level_spec [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 7,865,080 ( 0.04%) ???:::expr_ty [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 7,864,560 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:::check_attributes 7,864,475 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/minmax.rs:clippy_lints::minmax::min_max [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,864,456 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/nonnull_unchecked_on_box_ptr.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,864,456 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/strlen_on_c_strings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,605,183 ( 0.04%) ???:pthread_mutex_unlock [/usr/lib/libc.so.6] 7,540,425 ( 0.04%) include/jemalloc/internal/arena_inlines_b.h:tcache_bin_flush_small 7,514,422 ( 0.04%) ???:::ensure_source_file_source_present [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 7,471,694 ( 0.04%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:clippy_utils::macros::root_macro_call 7,471,683 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::root_macro_call [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,332 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/combined_early_pass.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,332 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:::check_attributes_post 7,471,255 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/disallowed_fields.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,248 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/single_range_in_vec_init.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,243 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/zombie_processes.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,237 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_different_sizes.rs:clippy_lints::casts::cast_slice_different_sizes::expr_cast_chain_tys [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,237 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/needless_bool.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,235 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/unnecessary_map_on_constructor.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,232 ( 0.04%) site/frontend/rust-clippy/clippy_lints/src/default.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,471,142 ( 0.04%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::in_automatically_derived [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,122 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::parse_attrs::<::pop_attrs::{closure#0}, rustc_hir::hir::Attribute> [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,122 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::parse_attrs::<::push_attrs::{closure#0}, rustc_hir::hir::Attribute> [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,089 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_pop_if.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,066 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/infinite_iter.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,043 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/assertions_on_constants.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,042 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/write/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,039 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::matching_root_macro_call [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,034 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/format_args.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,034 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_ignore_case_cmp.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,017 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_take.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,016 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:, clippy_utils::macros::first_node_macro_backtrace::{closure#0}> as core::iter::traits::iterator::Iterator>::try_fold::<(), >::iter_try_fold::flatten, clippy_utils::macros::macro_backtrace::{closure#0}>, clippy_utils::macros::first_node_macro_backtrace::{closure#0}::{closure#0}>, (), core::ops::control_flow::ControlFlow, as core::iter::traits::iterator::Iterator>::try_fold::flatten, clippy_utils::macros::macro_backtrace::{closure#0}>, clippy_utils::macros::first_node_macro_backtrace::{closure#0}::{closure#0}>, (), core::ops::control_flow::ControlFlow, core::iter::traits::iterator::Iterator::find::check::{closure#0}>::{closure#0}>::{closure#0}, core::ops::control_flow::ControlFlow> [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,016 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/swap_ptr_to_ref.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/await_holding_invalid.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/block_scrutinee.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/blocks_in_conditions.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/entry.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/format_impl.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/implicit_saturating_sub.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_abs_diff.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/needless_borrows_for_generic_args.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/reserve_after_initialization.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 7,078,014 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/zero_repeat_side_effects.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,875,669 ( 0.03%) ???:>::reserve_rehash::<::intern_inner::{closure#0}::{closure#1}> [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 6,685,250 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,902 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::check_attributes 6,684,893 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter_nested.rs: as alloc::vec::spec_from_iter_nested::SpecFromIterNested<(rustc_span::span_encoding::Span, alloc::string::String), core::iter::adapters::filter_map::FilterMap, clippy_lints::doc::suspicious_doc_comments::collect_doc_replacements::{closure#0}>>>::from_iter [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,893 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/doc/suspicious_doc_comments.rs:clippy_lints::doc::suspicious_doc_comments::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,837 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/non_copy_const.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,819 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/size_of_in_element_count.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,812 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/bool_assert_comparison.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,810 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/transmute/mod.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,809 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/drop_forget_ref.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,807 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/useless_concat.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,803 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/neg_cmp_op_on_partial_ord.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,800 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/rc_clone_in_vec_init.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,798 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/arc_with_non_send_sync.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,798 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/box_default.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,798 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/from_raw_with_void_ptr.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,798 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/panicking_overflow_checks.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,797 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_rotate.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,796 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/implicit_saturating_add.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,796 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_checked_ops.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,795 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_from_raw_parts.rs:clippy_lints::casts::cast_slice_from_raw_parts::check_implicit_cast [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,795 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/explicit_write.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,795 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/strings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,795 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/to_digit_is_some.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,794 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_float_methods.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/collapsible_if.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/default_constructed_unit_structs.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/default_instead_of_iter_empty.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/from_str_radix_10.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_bits.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/mem_replace.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,793 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/unit_return_expecting_ord.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,792 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_rem_euclid.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,792 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_slice_size_calculation.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/async_yields_async.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/cloned_ref_to_slice_refs.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/functions/result.rs:clippy_lints::functions::result::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/indexing_slicing.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/minmax.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/operators/float_cmp.rs:clippy_lints::operators::float_cmp::check_assert [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/replace_box.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,791 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/unnecessary_owned_empty_strings.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,766 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/unused_rounding.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,684,757 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/utils/format_args_collector.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,591,624 ( 0.03%) ???:pthread_mutex_trylock [/usr/lib/libc.so.6] 6,423,494 ( 0.03%) ???:>::grow_one [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 6,291,653 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:clippy_utils::msrvs::check_attrs:: [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,291,570 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_strip.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,291,569 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/string_patterns.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,291,568 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/init_numbered_fields.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,291,564 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/reference.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 6,291,488 ( 0.03%) ???:::node [???] 6,291,383 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lexer/src/lib.rs:::with_source_text::::{closure#0}> 5,927,643 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/memchr.rs:::check_expr 5,898,420 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/doc/mod.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,362 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,350 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/casts/ptr_cast_constness.rs:clippy_lints::casts::ptr_cast_constness::check_null_ptr_cast_method [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,346 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/zero_div_zero.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,345 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/borrow_deref_ref.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,345 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/only_used_in_recursion.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,345 ( 0.03%) site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,320 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/int_plus_one.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,898,283 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 5,898,270 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/loops/while_let_on_iterator.rs:clippy_lints::loops::while_let_on_iterator::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,797,300 ( 0.03%) include/jemalloc/internal/bitmap.h:tcache_bin_flush_small 5,629,590 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/validations.rs:::new 5,546,282 ( 0.03%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:::check_known_consts 5,505,164 ( 0.03%) ???:rustc_hir::hir::is_range_literal [???] 5,505,140 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/non_octal_unix_permissions.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,166,498 ( 0.03%) ???:::new [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 5,111,964 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/combined_early_pass.rs:::check_attributes_post [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,903 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/casts/cast_ptr_alignment.rs:clippy_lints::casts::cast_ptr_alignment::check_cast_method [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,901 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/main_recursion.rs:::check_expr_post [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,899 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/manual_retain.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,899 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/needless_update.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,895 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/casts/borrow_as_ptr.rs:clippy_lints::casts::borrow_as_ptr::check_implicit_cast [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 5,111,891 ( 0.03%) site/frontend/rust-clippy/clippy_lints/src/unicode.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 4,849,797 ( 0.02%) ???:>::walk_mut [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 4,718,748 ( 0.02%) ???:rustc_resolve::rustdoc::span_of_fragments [???] 4,718,676 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/disallowed_methods.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 4,572,512 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs:::deref 4,492,672 ( 0.02%) ???:rustc_middle::lint::emit_lint_base::emit_lint_base_impl [???] 4,449,960 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::new 4,415,617 ( 0.02%) ???:::fmt [???] 4,369,013 ( 0.02%) include/jemalloc/internal/bit_util.h:malloc_default 4,347,975 ( 0.02%) include/jemalloc/internal/div.h:tcache_bin_flush_small 4,325,475 ( 0.02%) ???:::expect_hir_owner_nodes'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 4,325,460 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/size_of_ref.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 4,325,453 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/flatten.rs:clippy_lints::operators::eq_op::check_assert 4,325,441 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 4,325,398 ( 0.02%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::get_parent_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 4,194,259 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lexer/src/lib.rs:::eq [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 4,064,784 ( 0.02%) include/jemalloc/internal/ph.h:pa_alloc 3,933,176 ( 0.02%) ???:rust_psm_stack_pointer [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 3,932,290 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:clippy_lints::doc::suspicious_doc_comments::check 3,932,232 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/ineffective_open_options.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 3,932,182 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,932,180 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/redundant_async_block.rs:clippy_lints::redundant_async_block::desugar_async_block [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 3,932,130 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:>::next_back 3,919,296 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs:::new 3,837,427 ( 0.02%) ???:::make_owner_info [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 3,815,316 ( 0.02%) include/jemalloc/internal/rtree.h:pa_alloc 3,801,062 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::check_expr 3,799,962 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:::new 3,689,999 ( 0.02%) src/eset.c:pa_alloc 3,539,065 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_resolve/src/rustdoc.rs:::check_attributes 3,539,064 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:::check_attributes 3,539,061 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs:::check_attributes_post [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 3,539,009 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/permissions_set_readonly_false.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 3,538,989 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/multi_assignments.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 3,538,977 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr_post 3,519,630 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs:::new 3,486,612 ( 0.02%) ???:::pad_integral [???] 3,441,488 ( 0.02%) ???:0x000000000000fb40 [/usr/lib/ld-linux-x86-64.so.2] 3,389,666 ( 0.02%) include/jemalloc/internal/ph.h:tcache_bin_flush_small 3,284,948 ( 0.02%) include/jemalloc/internal/edata.h:pa_alloc 3,211,264 ( 0.02%) ???:::filter_map_expr [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 3,170,937 ( 0.02%) include/jemalloc/internal/sz.h:pa_alloc 3,145,790 ( 0.02%) site/frontend/rust-clippy/clippy_utils/src/res.rs:::check_expr 3,145,784 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:::check_expr 3,145,777 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,768 ( 0.02%) site/frontend/rust-clippy/clippy_lints/src/unnested_or_patterns.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:clippy_lints::unit_types::unit_arg::check 3,145,760 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:clippy_lints::unit_types::unit_cmp::check 3,145,748 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 3,145,692 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:::with_source_text::::{closure#0}> 3,145,689 ( 0.02%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:::with_source_text::::{closure#0}> 3,014,610 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::check_expr 2,949,578 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,939,508 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/source.rs:::into_range [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,939,472 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::trim_start_matches::<::is_whitespace> 2,898,650 ( 0.01%) include/jemalloc/internal/util.h:tcache_bin_flush_small 2,869,499 ( 0.01%) ???:rustc_span::normalize_src [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 2,752,566 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check_expr 2,752,561 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/regex.rs:::check_expr_post 2,752,543 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,752,543 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,752,537 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,752,526 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::fn_def_id [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,752,504 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::visit_expr'2 2,746,050 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs:::new 2,710,419 ( 0.01%) ???:core::slice::memchr::memchr_aligned [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 2,621,400 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_expr 2,612,864 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/char/methods.rs:::trim_start_matches::<::is_whitespace> 2,612,864 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/source.rs:::new [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,539,021 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/diagnostics.rs:clippy_utils::diagnostics::span_lint_and_then::::display::{closure#0}> [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,359,572 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:::trim_matches::<::is_whitespace> [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,359,436 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::check_attributes 2,359,436 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::check_attributes_post 2,359,376 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::check_attributes 2,359,376 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::check_attributes_post 2,359,374 ( 0.01%) /rust/deps/thin-vec-0.2.19/src/lib.rs:::check_attributes 2,359,366 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,359,366 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes_post [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,359,338 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/unit_types/mod.rs:::check_expr 2,359,338 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/unused_unit.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,359,332 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,359,332 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,359,326 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 2,359,308 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/filter.rs:clippy_utils::in_automatically_derived 2,359,278 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 2,359,269 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/approx_const.rs:::check_lit [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 2,293,915 ( 0.01%) ???:::lower_expr_mut::{closure#0}'2 [???] 2,293,725 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:::check_expr 2,286,303 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::into_range 2,228,190 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:::check_expr 2,222,942 ( 0.01%) include/jemalloc/internal/fb.h:pa_alloc 2,197,299 ( 0.01%) src/base.c:pa_alloc 2,162,679 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:::check_expr 2,162,655 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/f64.rs:::check_expr 2,089,644 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::from_lit_kind 2,044,693 ( 0.01%) include/jemalloc/internal/cache_bin.h:malloc_default 2,039,349 ( 0.01%) include/jemalloc/internal/rtree.h:ecache_evict 2,031,585 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/filter.rs:::check_expr 1,966,197 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:clippy_utils::macros::root_macro_call 1,966,145 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/attrs.rs:::check_attributes 1,966,145 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::peel_hir_expr_refs [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,966,125 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/hir.rs:clippy_lints::casts::cast_slice_different_sizes::expr_cast_chain_tys 1,966,125 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/hir.rs:clippy_lints::casts::cast_slice_from_raw_parts::check_implicit_cast 1,966,119 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/flatten.rs:clippy_lints::operators::float_cmp::check_assert 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/hir.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:::check_expr 1,966,115 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/functions/mod.rs:::check_expr 1,966,115 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/mixed_read_write_in_expression.rs:::check_expr [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,966,115 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/needless_parens_on_range_literals.rs:::check_expr 1,966,110 ( 0.01%) ???:::check_expr_post [???] 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:::check_expr 1,966,109 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs:clippy_lints::casts::borrow_as_ptr::check_implicit_cast 1,966,108 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/combined_early_pass.rs:::check_variant [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,966,090 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/higher.rs:::check_expr 1,966,079 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/casts/needless_type_cast.rs:rustc_hir::intravisit::walk_expr::>'2 1,927,153 ( 0.01%) include/jemalloc/internal/atomic.h:tcache_bin_flush_small 1,894,642 ( 0.01%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/tcache.c:tcache_bin_flush_stashed [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,834,994 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs:>::next_back 1,701,770 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::new 1,690,576 ( 0.01%) ???:0x000000000000ba80 [/usr/lib/ld-linux-x86-64.so.2] 1,638,407 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/visitors.rs:rustc_hir::intravisit::walk_expr::>'2 1,633,040 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::deref 1,633,040 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::new 1,573,185 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::trim_matches::<::is_whitespace> 1,572,926 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::meets 1,572,926 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:::meets 1,572,925 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:::check_attributes 1,572,920 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes 1,572,916 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs: as alloc::vec::spec_from_iter_nested::SpecFromIterNested<(rustc_span::span_encoding::Span, alloc::string::String), core::iter::adapters::filter_map::FilterMap, clippy_lints::doc::suspicious_doc_comments::collect_doc_replacements::{closure#0}>>>::from_iter 1,572,916 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/attrs.rs:::check_attributes_post 1,572,912 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:::check_attributes 1,572,912 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/attrs/mod.rs:::check_attributes_post 1,572,907 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:clippy_utils::macros::matching_root_macro_call 1,572,901 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/eta_reduction.rs:::check_expr 1,572,900 ( 0.01%) /rust/deps/smallvec-1.15.1/src/lib.rs:::meets [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,572,899 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/suspicious_trait_impl.rs:::check_expr 1,572,892 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:::hir 1,572,892 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/vec_init_then_push.rs:::check_expr 1,572,888 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/misc_early/literal_suffix.rs:clippy_lints::misc_early::literal_suffix::check [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,572,852 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs:::check_expr 1,572,852 ( 0.01%) site/frontend/rust-clippy/clippy_utils/src/source.rs:::check_expr 1,572,840 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/fmt.rs:::check_expr 1,570,088 ( 0.01%) ???:::render [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 1,566,432 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:::new 1,507,315 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:::check_expr 1,484,959 ( 0.01%) ???:::pad_integral::write_prefix [???] 1,484,310 ( 0.01%) include/jemalloc/internal/arena_inlines_b.h:malloc_default 1,482,487 ( 0.01%) include/jemalloc/internal/edata.h:ecache_evict 1,418,186 ( 0.01%) ???:::pad_integral'2 [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 1,373,031 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/char/methods.rs:::from_lit_kind 1,369,721 ( 0.01%) src/extent.c:pa_alloc 1,310,715 ( 0.01%) site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs:::check_lit [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,306,448 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:clippy_utils::source::get_source_range 1,306,432 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/validations.rs:::trim_start_matches::<::is_whitespace> 1,306,428 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_ast/src/ast.rs:::from_lit_kind 1,301,281 ( 0.01%) include/jemalloc/internal/ph.h:ecache_evict 1,245,292 ( 0.01%) ???:rustc_hir::intravisit::walk_expr:: [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 1,241,058 ( 0.01%) ???:>::from [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 1,205,309 ( 0.01%) /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/jemalloc.c:malloc_default [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,181,960 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs: as core::clone::Clone>::clone [/home/moon/git/rustc-perf/site/frontend/rust-clippy/target/clippy-build/clippy-driver] 1,180,281 ( 0.01%) ???:>>,)>>::call_once [/home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/librustc_driver-173404cd07acc0f2.so] 1,179,852 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::trim_matches::<::is_whitespace> 1,179,687 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lint/src/context.rs:::check_attributes 1,179,687 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:clippy_lints::doc::suspicious_doc_comments::check 1,179,687 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/string.rs:::check_attributes 1,179,687 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:clippy_lints::doc::suspicious_doc_comments::check 1,179,687 ( 0.01%) /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:::check_attributes -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/macro_metavars_in_unsafe.rs -------------------------------------------------------------------------------- Ir -- line 106 ---------------------------------------- . /// } . /// } . /// ``` . metavar_expns: BTreeMap, . } . . impl ExprMetavarsInUnsafe { . pub fn new(conf: &'static Conf) -> Self { 3 ( 0.00%) Self { . warn_unsafe_macro_metavars_in_private_macros: conf.warn_unsafe_macro_metavars_in_private_macros, . metavar_expns: BTreeMap::new(), . } . } . } . . struct BodyVisitor<'a, 'tcx> { . /// Stack of unsafe blocks -- the top item always represents the last seen unsafe block from -- line 122 ---------------------------------------- -- line 147 ---------------------------------------- . . fn is_public_macro(cx: &LateContext<'_>, def_id: LocalDefId) -> bool { . (cx.effective_visibilities.is_exported(def_id) || find_attr!(cx.tcx, def_id, MacroExport { .. })) . && !cx.tcx.is_doc_hidden(def_id) . } . . impl<'tcx> Visitor<'tcx> for BodyVisitor<'_, 'tcx> { . fn visit_stmt(&mut self, s: &'tcx Stmt<'tcx>) { 2 ( 0.00%) let from_expn = s.span.from_expansion(); . if from_expn { 1 ( 0.00%) self.expn_depth += 1; . } . walk_stmt(self, s); . if from_expn { 1 ( 0.00%) self.expn_depth -= 1; . } . } . 3,145,760 ( 0.02%) fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) { 393,220 ( 0.00%) let ctxt = e.span.ctxt(); . 786,440 ( 0.00%) if let ExprKind::Block(block, _) = e.kind 4 ( 0.00%) && let BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided) = block.rules . && !ctxt.is_root() . && let Some(macro_def_id) = ctxt.outer_expn_data().macro_def_id . && let Some(macro_def_id) = macro_def_id.as_local() . && (self.lint.warn_unsafe_macro_metavars_in_private_macros || is_public_macro(self.cx, macro_def_id)) . { . self.macro_unsafe_blocks.push(block.hir_id); . self.expn_depth += 1; . walk_block(self, block); . self.expn_depth -= 1; . self.macro_unsafe_blocks.pop(); 1,572,870 ( 0.01%) } else if ctxt.is_root() && self.expn_depth > 0 { . let unsafe_block = self.macro_unsafe_blocks.last().copied(); . 4 ( 0.00%) match (self.lint.metavar_expns.entry(e.span), unsafe_block) { 10 ( 0.00%) (Entry::Vacant(e), None) => { 2 ( 0.00%) e.insert(MetavarState::ReferencedInSafe); . }, . (Entry::Vacant(e), Some(unsafe_block)) => { . e.insert(MetavarState::ReferencedInUnsafe { . unsafe_blocks: vec![unsafe_block], . }); . }, . (Entry::Occupied(mut e), None) => { . if let MetavarState::ReferencedInUnsafe { .. } = *e.get() { -- line 193 ---------------------------------------- -- line 201 ---------------------------------------- . unsafe_blocks.push(unsafe_block); . } . }, . } . . // NB: No need to visit descendant nodes. They're guaranteed to represent the same . // metavariable . } else { 1,179,654 ( 0.01%) walk_expr(self, e); 27,001,722 ( 0.13%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr:: (3x) . } 3,145,760 ( 0.02%) } . } . . impl<'tcx> LateLintPass<'tcx> for ExprMetavarsInUnsafe { 27 ( 0.00%) fn check_body(&mut self, cx: &LateContext<'tcx>, body: &rustc_hir::Body<'tcx>) { 24 ( 0.00%) if is_lint_allowed(cx, MACRO_METAVARS_IN_UNSAFE, body.value.hir_id) { 6,623 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_lint_allowed (3x) . return; . } . . // This BodyVisitor is separate and not part of the lint pass because there is no . // `check_stmt_post` on `(Late)LintPass`, which we'd need to detect when we're leaving a macro span . 18 ( 0.00%) let mut vis = BodyVisitor { . macro_unsafe_blocks: Vec::new(), . #[expect(clippy::bool_to_int_with_if)] // obfuscates the meaning 6 ( 0.00%) expn_depth: if body.value.span.from_expansion() { 1 } else { 0 }, . cx, . lint: self . }; . vis.visit_body(body); 21 ( 0.00%) } . . fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { . // Aggregate all unsafe blocks from all spans: . // ``` . // macro_rules! x { . // ($w:expr, $x:expr, $y:expr) => { $w; unsafe { $w; $x; }; unsafe { $x; $y; }; } . // } . // $w: [] (unsafe#0 is never added because it was referenced in a safe context) . // $x: [unsafe#0, unsafe#1] . // $y: [unsafe#1] . // ``` . // We want to lint unsafe blocks #0 and #1 . let bad_unsafe_blocks = self . .metavar_expns . .values() 2 ( 0.00%) .filter_map(|state| match state { . MetavarState::ReferencedInUnsafe { unsafe_blocks } => Some(unsafe_blocks.as_slice()), . MetavarState::ReferencedInSafe => None, . }) . .flatten() . .copied() . .inspect(|&unsafe_block| { . let level_spec = cx.tcx.lint_level_spec_at_node(MACRO_METAVARS_IN_UNSAFE, unsafe_block); . if level_spec.is_expect() { -- line 255 ---------------------------------------- -- line 266 ---------------------------------------- . // The invocation doesn't matter. Also we want to dedupe by the unsafe block and not by anything . // related to the callsite. . let span = cx.tcx.hir_span(id); . . (id, Span::new(span.lo(), span.hi(), SyntaxContext::root(), None)) . }) . .dedup_by(|&(_, a), &(_, b)| a == b); . 20 ( 0.00%) for (id, span) in bad_unsafe_blocks { 132 ( 0.00%) => /home/moon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/itertools-0.15.0/src/adaptors/coalesce.rs:, ::check_crate_post::{closure#0}>>>, ::check_crate_post::{closure#1}>, ::check_crate_post::{closure#2}>, itertools::adaptors::coalesce::DedupPred2CoalescePred<::check_crate_post::{closure#3}>, itertools::adaptors::coalesce::NoCount> as core::iter::traits::iterator::Iterator>::next (1x) . span_lint_hir_and_then( . cx, . MACRO_METAVARS_IN_UNSAFE, . id, . span, . "this macro expands metavariables in an unsafe block", . |diag| { . diag.note("this allows the user of the macro to write unsafe code outside of an unsafe block"); -- line 282 ---------------------------------------- -- line 284 ---------------------------------------- . "consider expanding any metavariables outside of this block, e.g. by storing them in a variable", . ); . diag.help( . "... or also expand referenced metavariables in a safe context to require an unsafe block at callsite", . ); . }, . ); . } 8 ( 0.00%) } . } 1,572,896 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs -------------------------------------------------------------------------------- Ir -- line 81 ---------------------------------------- . Method(Ident, &'a FnSig<'a>), . . /// `|x, y| {}` . Closure, . } . . impl<'a> FnKind<'a> { . pub fn header(&self) -> Option<&FnHeader> { 6 ( 0.00%) match *self { 3 ( 0.00%) FnKind::ItemFn(_, _, ref header) => Some(header), . FnKind::Method(_, ref sig) => Some(&sig.header), . FnKind::Closure => None, . } . } . . pub fn constness(self) -> Constness { . self.header().map_or(Constness::NotConst, |header| header.constness) . } -- line 98 ---------------------------------------- -- line 274 ---------------------------------------- . Self::Result::output() . } . . /// Invoked to visit the body of a function, method or closure. Like . /// `visit_nested_item`, does nothing by default unless you override . /// `Self::NestedFilter`. . fn visit_nested_body(&mut self, id: BodyId) -> Self::Result { . if Self::NestedFilter::INTRA { 7 ( 0.00%) let body = self.maybe_tcx().hir_body(id); 62 ( 0.00%) => ???:::hir_body (1x) . try_visit!(self.visit_body(body)); . } . Self::Result::output() . } . . fn visit_param(&mut self, param: &'v Param<'v>) -> Self::Result { . walk_param(self, param) . } -- line 290 ---------------------------------------- -- line 314 ---------------------------------------- . walk_mod(self, m) . } . fn visit_foreign_item(&mut self, i: &'v ForeignItem<'v>) -> Self::Result { . walk_foreign_item(self, i) . } . fn visit_local(&mut self, l: &'v LetStmt<'v>) -> Self::Result { . walk_local(self, l) . } 9 ( 0.00%) fn visit_block(&mut self, b: &'v Block<'v>) -> Self::Result { 63 ( 0.00%) walk_block(self, b) 429 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_block::::check::{closure#0}>> (1x) . } . fn visit_stmt(&mut self, s: &'v Stmt<'v>) -> Self::Result { 5 ( 0.00%) walk_stmt(self, s) 489 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_stmt::> (1x) . } . fn visit_arm(&mut self, a: &'v Arm<'v>) -> Self::Result { . walk_arm(self, a) . } . fn visit_pat(&mut self, p: &'v Pat<'v>) -> Self::Result { . walk_pat(self, p) . } . fn visit_pat_field(&mut self, f: &'v PatField<'v>) -> Self::Result { -- line 334 ---------------------------------------- -- line 363 ---------------------------------------- . walk_const_item_rhs(self, c) . } . . /// All consts are treated as ambiguous consts for the purposes of hir visiting in . /// order to ensure that visitors can handle infer vars without it being too error-prone. . /// . /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. . fn visit_const_arg(&mut self, c: &'v ConstArg<'v, AmbigArg>) -> Self::Result { 2 ( 0.00%) walk_const_arg(self, c) . } . . #[allow(unused_variables)] . fn visit_infer(&mut self, inf_id: HirId, inf_span: Span, kind: InferKind<'v>) -> Self::Result { . self.visit_id(inf_id) . } . . fn visit_lifetime(&mut self, lifetime: &'v Lifetime) -> Self::Result { . walk_lifetime(self, lifetime) . } . . fn visit_expr(&mut self, ex: &'v Expr<'v>) -> Self::Result { 19 ( 0.00%) walk_expr(self, ex) 365 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr::'2 (1x) . } . fn visit_expr_field(&mut self, field: &'v ExprField<'v>) -> Self::Result { . walk_expr_field(self, field) . } . fn visit_const_arg_expr_field(&mut self, field: &'v ConstArgExprField<'v>) -> Self::Result { . walk_const_arg_expr_field(self, field) . } . fn visit_pattern_type_pattern(&mut self, p: &'v TyPat<'v>) -> Self::Result { -- line 392 ---------------------------------------- -- line 394 ---------------------------------------- . } . fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) -> Self::Result { . walk_generic_param(self, p) . } . fn visit_const_param_default(&mut self, _param: HirId, ct: &'v ConstArg<'v>) -> Self::Result { . walk_const_param_default(self, ct) . } . fn visit_generics(&mut self, g: &'v Generics<'v>) -> Self::Result { 2 ( 0.00%) walk_generics(self, g) 24 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_generics:: (1x) . } . fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>) -> Self::Result { . walk_where_predicate(self, predicate) . } . fn visit_fn_ret_ty(&mut self, ret_ty: &'v FnRetTy<'v>) -> Self::Result { . walk_fn_ret_ty(self, ret_ty) . } . fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) -> Self::Result { -- line 410 ---------------------------------------- -- line 464 ---------------------------------------- . } . fn visit_variant(&mut self, v: &'v Variant<'v>) -> Self::Result { . walk_variant(self, v) . } . fn visit_label(&mut self, label: &'v Label) -> Self::Result { . walk_label(self, label) . } . // The span is that of the surrounding type/pattern/expr/whatever. 7 ( 0.00%) fn visit_qpath(&mut self, qpath: &'v QPath<'v>, id: HirId, _span: Span) -> Self::Result { 58 ( 0.00%) walk_qpath(self, qpath, id) 164 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_qpath:: (4x) 6 ( 0.00%) } . fn visit_path(&mut self, path: &Path<'v>, _id: HirId) -> Self::Result { . walk_path(self, path) . } . fn visit_path_segment(&mut self, path_segment: &'v PathSegment<'v>) -> Self::Result { . walk_path_segment(self, path_segment) . } . fn visit_generic_args(&mut self, generic_args: &'v GenericArgs<'v>) -> Self::Result { . walk_generic_args(self, generic_args) -- line 482 ---------------------------------------- -- line 632 ---------------------------------------- . walk_list!(visitor, visit_param_bound, bounds); . } . } . V::Result::output() . } . . pub fn walk_body<'v, V: Visitor<'v>>(visitor: &mut V, body: &Body<'v>) -> V::Result { . let Body { params, value } = body; 4 ( 0.00%) walk_list!(visitor, visit_param, *params); 9 ( 0.00%) visitor.visit_expr(*value) 839 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/unwrap.rs:::visit_expr (1x) . } . . pub fn walk_ident<'v, V: Visitor<'v>>(visitor: &mut V, ident: Ident) -> V::Result { . visitor.visit_name(ident.name) . } . . pub fn walk_mod<'v, V: Visitor<'v>>(visitor: &mut V, module: &'v Mod<'v>) -> V::Result { . let Mod { spans: _, item_ids } = module; -- line 649 ---------------------------------------- -- line 682 ---------------------------------------- . visit_opt!(visitor, visit_expr, *init); . try_visit!(visitor.visit_id(*hir_id)); . try_visit!(visitor.visit_pat(*pat)); . visit_opt!(visitor, visit_block, *els); . visit_opt!(visitor, visit_ty_unambig, *ty); . V::Result::output() . } . 59 ( 0.00%) pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) -> V::Result { . let Block { stmts, expr, hir_id, rules: _, span: _, targeted_by_break: _ } = block; . try_visit!(visitor.visit_id(*hir_id)); 18 ( 0.00%) walk_list!(visitor, visit_stmt, *stmts); 51 ( 0.00%) visit_opt!(visitor, visit_expr, *expr); 1,107 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:::get::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr'2 (1x) . V::Result::output() 30 ( 0.00%) } . 8 ( 0.00%) pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) -> V::Result { . let Stmt { kind, hir_id, span: _ } = statement; . try_visit!(visitor.visit_id(*hir_id)); 21 ( 0.00%) match *kind { . StmtKind::Let(ref local) => visitor.visit_local(local), . StmtKind::Item(item) => visitor.visit_nested_item(item), . StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => { 9 ( 0.00%) visitor.visit_expr(expression) 1,175 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/macro_metavars_in_unsafe.rs:::visit_expr'2 (1x) . } . } . } . . pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) -> V::Result { . let Arm { hir_id, span: _, pat, guard, body } = arm; . try_visit!(visitor.visit_id(*hir_id)); . try_visit!(visitor.visit_pat(*pat)); -- line 713 ---------------------------------------- -- line 799 ---------------------------------------- . visitor: &mut V, . constant: &'v ConstBlock, . ) -> V::Result { . let ConstBlock { hir_id, def_id: _, body } = constant; . try_visit!(visitor.visit_id(*hir_id)); . visitor.visit_nested_body(*body) . } . 7,864,749 ( 0.04%) pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) -> V::Result { . let Expr { hir_id, kind, span } = expression; 786,456 ( 0.00%) try_visit!(visitor.visit_id(*hir_id)); 3,539,204 ( 0.02%) match *kind { 2 ( 0.00%) ExprKind::Array(subexpressions) => { 393,211 ( 0.00%) walk_list!(visitor, visit_expr, subexpressions); 26,607,210 ( 0.13%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/macro_metavars_in_unsafe.rs:::visit_expr'2 (65,535x) . } . ExprKind::ConstBlock(ref const_block) => { . try_visit!(visitor.visit_inline_const(const_block)) . } . ExprKind::Repeat(ref element, ref count) => { . try_visit!(visitor.visit_expr(element)); . try_visit!(visitor.visit_const_arg_unambig(count)); . } -- line 820 ---------------------------------------- -- line 823 ---------------------------------------- . walk_list!(visitor, visit_expr_field, fields); . match optional_base { . StructTailExpr::Base(base) => try_visit!(visitor.visit_expr(base)), . StructTailExpr::None . | StructTailExpr::NoneWithError(_) . | StructTailExpr::DefaultFields(_) => {} . } . } 262,140 ( 0.00%) ExprKind::Tup(subexpressions) => { 2,097,120 ( 0.01%) walk_list!(visitor, visit_expr, subexpressions); 33,160,710 ( 0.16%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/macro_metavars_in_unsafe.rs:::visit_expr'2 (327,675x) . } 12 ( 0.00%) ExprKind::Call(ref callee_expression, arguments) => { 21 ( 0.00%) try_visit!(visitor.visit_expr(callee_expression)); 458 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:::get::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr'2 (1x) 24 ( 0.00%) walk_list!(visitor, visit_expr, arguments); 172 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:::get::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr'2 (1x) . } 15 ( 0.00%) ExprKind::MethodCall(ref segment, receiver, arguments, _) => { 5 ( 0.00%) try_visit!(visitor.visit_path_segment(segment)); 12 ( 0.00%) try_visit!(visitor.visit_expr(receiver)); 51 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs: as rustc_hir::intravisit::Visitor>::visit_expr (1x) . walk_list!(visitor, visit_expr, arguments); . } . ExprKind::Use(expr, _) => { . try_visit!(visitor.visit_expr(expr)); . } . ExprKind::Binary(_, ref left_expression, ref right_expression) => { 5 ( 0.00%) try_visit!(visitor.visit_expr(left_expression)); 1 ( 0.00%) try_visit!(visitor.visit_expr(right_expression)); . } . ExprKind::AddrOf(_, _, ref subexpression) | ExprKind::Unary(_, ref subexpression) => { 2 ( 0.00%) try_visit!(visitor.visit_expr(subexpression)); . } . ExprKind::Cast(ref subexpression, ref typ) | ExprKind::Type(ref subexpression, ref typ) => { . try_visit!(visitor.visit_expr(subexpression)); . try_visit!(visitor.visit_ty_unambig(typ)); . } . ExprKind::DropTemps(ref subexpression) => { . try_visit!(visitor.visit_expr(subexpression)); . } . ExprKind::Let(LetExpr { span: _, pat, ty, init, recovered: _ }) => { . // match the visit order in walk_local . try_visit!(visitor.visit_expr(init)); . try_visit!(visitor.visit_pat(pat)); . visit_opt!(visitor, visit_ty_unambig, ty); . } . ExprKind::If(ref cond, ref then, ref else_opt) => { 21 ( 0.00%) try_visit!(visitor.visit_expr(cond)); 630 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:::get::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr'2 (1x) 24 ( 0.00%) try_visit!(visitor.visit_expr(then)); 1,589 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:::get::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr'2 (1x) 13 ( 0.00%) visit_opt!(visitor, visit_expr, else_opt); . } . ExprKind::Loop(ref block, ref opt_label, _, _) => { . visit_opt!(visitor, visit_label, opt_label); . try_visit!(visitor.visit_block(block)); . } . ExprKind::Match(ref subexpression, arms, _) => { . try_visit!(visitor.visit_expr(subexpression)); . walk_list!(visitor, visit_arm, arms); -- line 877 ---------------------------------------- -- line 889 ---------------------------------------- . constness: _, . explicit_captures: _, . }) => { . walk_list!(visitor, visit_generic_param, bound_generic_params); . try_visit!(visitor.visit_fn(FnKind::Closure, fn_decl, body, *span, def_id)); . } . ExprKind::Block(ref block, ref opt_label) => { . visit_opt!(visitor, visit_label, opt_label); 13 ( 0.00%) try_visit!(visitor.visit_block(block)); . } . ExprKind::Assign(ref lhs, ref rhs, _) => { . try_visit!(visitor.visit_expr(rhs)); . try_visit!(visitor.visit_expr(lhs)); . } . ExprKind::AssignOp(_, ref left_expression, ref right_expression) => { . try_visit!(visitor.visit_expr(right_expression)); . try_visit!(visitor.visit_expr(left_expression)); -- line 905 ---------------------------------------- -- line 907 ---------------------------------------- . ExprKind::Field(ref subexpression, ident) => { . try_visit!(visitor.visit_expr(subexpression)); . try_visit!(visitor.visit_ident(ident)); . } . ExprKind::Index(ref main_expression, ref index_expression, _) => { . try_visit!(visitor.visit_expr(main_expression)); . try_visit!(visitor.visit_expr(index_expression)); . } 5 ( 0.00%) ExprKind::Path(ref qpath) => { 30 ( 0.00%) try_visit!(visitor.visit_qpath(qpath, *hir_id, *span)); 45 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:::visit_qpath (1x) . } . ExprKind::Break(ref destination, ref opt_expr) => { . visit_opt!(visitor, visit_label, &destination.label); . visit_opt!(visitor, visit_expr, opt_expr); . } . ExprKind::Continue(ref destination) => { . visit_opt!(visitor, visit_label, &destination.label); . } -- line 924 ---------------------------------------- -- line 939 ---------------------------------------- . ExprKind::UnsafeBinderCast(_kind, expr, ty) => { . try_visit!(visitor.visit_expr(expr)); . visit_opt!(visitor, visit_ty_unambig, ty); . } . ExprKind::Lit(lit) => try_visit!(visitor.visit_lit(*hir_id, lit, false)), . ExprKind::Err(_) => {} . } . V::Result::output() 6,291,686 ( 0.03%) } . . pub fn walk_expr_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v ExprField<'v>) -> V::Result { . let ExprField { hir_id, ident, expr, span: _, is_shorthand: _ } = field; . try_visit!(visitor.visit_id(*hir_id)); . try_visit!(visitor.visit_ident(*ident)); . visitor.visit_expr(*expr) . } . -- line 955 ---------------------------------------- -- line 983 ---------------------------------------- . let InferArg { hir_id, span } = inf; . visitor.visit_infer(*hir_id, *span, InferKind::Ambig(inf)) . } . } . } . . pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Result { . match typ.try_as_ambig_ty() { 21 ( 0.00%) Some(ambig_ty) => visitor.visit_ty(ambig_ty), 522 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/types/type_complexity.rs:::visit_ty'2 (1x) . None => { . let Ty { hir_id, span, kind: _ } = typ; . visitor.visit_infer(*hir_id, *span, InferKind::Ty(typ)) . } . } . } . 56 ( 0.00%) pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -> V::Result { . let Ty { hir_id, span: _, kind } = typ; . try_visit!(visitor.visit_id(*hir_id)); . 35 ( 0.00%) match *kind { . TyKind::Slice(ref ty) => try_visit!(visitor.visit_ty_unambig(ty)), . TyKind::Ptr(ref mutable_type) => try_visit!(visitor.visit_ty_unambig(mutable_type.ty)), . TyKind::Ref(ref lifetime, ref mutable_type) => { . try_visit!(visitor.visit_lifetime(lifetime)); . try_visit!(visitor.visit_ty_unambig(mutable_type.ty)); . } . TyKind::Never => {} 2 ( 0.00%) TyKind::Tup(tuple_element_types) => { . walk_list!(visitor, visit_ty_unambig, tuple_element_types); . } . TyKind::FnPtr(ref function_declaration) => { . walk_list!(visitor, visit_generic_param, function_declaration.generic_params); . try_visit!(visitor.visit_fn_decl(function_declaration.decl)); . } . TyKind::UnsafeBinder(ref unsafe_binder) => { . walk_list!(visitor, visit_generic_param, unsafe_binder.generic_params); . try_visit!(visitor.visit_ty_unambig(unsafe_binder.inner_ty)); . } 4 ( 0.00%) TyKind::Path(ref qpath) => { . try_visit!(visitor.visit_qpath(qpath, typ.hir_id, typ.span)); . } . TyKind::OpaqueDef(opaque) => { . try_visit!(visitor.visit_opaque_ty(opaque)); . } . TyKind::TraitAscription(bounds) => { . walk_list!(visitor, visit_param_bound, bounds); . } . TyKind::Array(ref ty, ref length) => { 1 ( 0.00%) try_visit!(visitor.visit_ty_unambig(ty)); 1 ( 0.00%) try_visit!(visitor.visit_const_arg_unambig(length)); . } . TyKind::TraitObject(bounds, ref lifetime) => { . for bound in bounds { . try_visit!(visitor.visit_poly_trait_ref(bound)); . } . try_visit!(visitor.visit_lifetime(lifetime)); . } . TyKind::InferDelegation(..) | TyKind::Err(_) => {} -- line 1041 ---------------------------------------- -- line 1051 ---------------------------------------- . TyKind::View(ty, fields) => { . try_visit!(visitor.visit_ty_unambig(ty)); . for field in fields { . try_visit!(visitor.visit_ident(*field)); . } . } . } . V::Result::output() 16 ( 0.00%) } . . pub fn walk_const_item_rhs<'v, V: Visitor<'v>>( . visitor: &mut V, . ct_rhs: ConstItemRhs<'v>, . ) -> V::Result { . match ct_rhs { . ConstItemRhs::Body(body_id) => visitor.visit_nested_body(body_id), . ConstItemRhs::TypeConst(const_arg) => visitor.visit_const_arg_unambig(const_arg), -- line 1067 ---------------------------------------- -- line 1076 ---------------------------------------- . Some(ambig_ct) => visitor.visit_const_arg(ambig_ct), . None => { . let ConstArg { hir_id, kind: _, span } = const_arg; . visitor.visit_infer(*hir_id, *span, InferKind::Const(const_arg)) . } . } . } . 6 ( 0.00%) pub fn walk_const_arg<'v, V: Visitor<'v>>( . visitor: &mut V, . const_arg: &'v ConstArg<'v, AmbigArg>, . ) -> V::Result { . let ConstArg { hir_id, kind, span: _ } = const_arg; . try_visit!(visitor.visit_id(*hir_id)); 5 ( 0.00%) match kind { . ConstArgKind::Tup(exprs) => { . walk_list!(visitor, visit_const_arg_unambig, *exprs); . V::Result::output() . } . ConstArgKind::Struct(qpath, field_exprs) => { . try_visit!(visitor.visit_qpath(qpath, *hir_id, qpath.span())); . . for field_expr in *field_exprs { -- line 1098 ---------------------------------------- -- line 1114 ---------------------------------------- . } . V::Result::output() . } . ConstArgKind::Path(qpath) => visitor.visit_qpath(qpath, *hir_id, qpath.span()), . ConstArgKind::Anon(anon) => visitor.visit_anon_const(*anon), . ConstArgKind::Error(_) => V::Result::output(), // errors and spans are not important . ConstArgKind::Literal { .. } => V::Result::output(), // FIXME(mcga) . } 6 ( 0.00%) } . . pub fn walk_generic_param<'v, V: Visitor<'v>>( . visitor: &mut V, . param: &'v GenericParam<'v>, . ) -> V::Result { . let GenericParam { . hir_id, . def_id: _, -- line 1130 ---------------------------------------- -- line 1157 ---------------------------------------- . . pub fn walk_const_param_default<'v, V: Visitor<'v>>( . visitor: &mut V, . ct: &'v ConstArg<'v>, . ) -> V::Result { . visitor.visit_const_arg_unambig(ct) . } . 18 ( 0.00%) pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics<'v>) -> V::Result { . let &Generics { 2 ( 0.00%) params, 4 ( 0.00%) predicates, . has_where_clause_predicates: _, . where_clause_span: _, . span: _, . } = generics; . walk_list!(visitor, visit_generic_param, params); . walk_list!(visitor, visit_where_predicate, predicates); . V::Result::output() 16 ( 0.00%) } . . pub fn walk_where_predicate<'v, V: Visitor<'v>>( . visitor: &mut V, . predicate: &'v WherePredicate<'v>, . ) -> V::Result { . let &WherePredicate { hir_id, kind, span: _ } = predicate; . try_visit!(visitor.visit_id(hir_id)); . match *kind { -- line 1184 ---------------------------------------- -- line 1204 ---------------------------------------- . V::Result::output() . } . . pub fn walk_fn_decl<'v, V: Visitor<'v>>( . visitor: &mut V, . function_declaration: &'v FnDecl<'v>, . ) -> V::Result { . let FnDecl { inputs, output, fn_decl_kind: _ } = function_declaration; 2 ( 0.00%) walk_list!(visitor, visit_ty_unambig, *inputs); . visitor.visit_fn_ret_ty(output) . } . . pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) -> V::Result { 4 ( 0.00%) if let FnRetTy::Return(output_ty) = *ret_ty { . try_visit!(visitor.visit_ty_unambig(output_ty)); . } . V::Result::output() . } . 12 ( 0.00%) pub fn walk_fn<'v, V: Visitor<'v>>( . visitor: &mut V, . function_kind: FnKind<'v>, . function_declaration: &'v FnDecl<'v>, . body_id: BodyId, . _: LocalDefId, . ) -> V::Result { . try_visit!(visitor.visit_fn_decl(function_declaration)); 1 ( 0.00%) try_visit!(walk_fn_kind(visitor, function_kind)); . visitor.visit_nested_body(body_id) 8 ( 0.00%) } . . pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) -> V::Result { 2 ( 0.00%) match function_kind { . FnKind::ItemFn(_, generics, ..) => { . try_visit!(visitor.visit_generics(generics)); . } . FnKind::Closure | FnKind::Method(..) => {} . } . V::Result::output() . } . -- line 1244 ---------------------------------------- -- line 1450 ---------------------------------------- . } . . pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime) -> V::Result { . let Lifetime { hir_id, ident, kind: _, source: _, syntax: _ } = lifetime; . try_visit!(visitor.visit_id(*hir_id)); . visitor.visit_ident(*ident) . } . 72 ( 0.00%) pub fn walk_qpath<'v, V: Visitor<'v>>( . visitor: &mut V, . qpath: &'v QPath<'v>, . id: HirId, . ) -> V::Result { 18 ( 0.00%) match *qpath { . QPath::Resolved(ref maybe_qself, ref path) => { 18 ( 0.00%) visit_opt!(visitor, visit_ty_unambig, maybe_qself); 9 ( 0.00%) visitor.visit_path(path, id) . } . QPath::TypeRelative(ref qself, ref segment) => { . try_visit!(visitor.visit_ty_unambig(qself)); . visitor.visit_path_segment(segment) . } . } 64 ( 0.00%) } . . pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &Path<'v>) -> V::Result { . let Path { segments, span: _, res: _ } = path; 9 ( 0.00%) walk_list!(visitor, visit_path_segment, *segments); . V::Result::output() . } . . pub fn walk_path_segment<'v, V: Visitor<'v>>( . visitor: &mut V, . segment: &'v PathSegment<'v>, . ) -> V::Result { . let PathSegment { ident, hir_id, res: _, args, infer_args: _, delegation_child_segment: _ } = . segment; . try_visit!(visitor.visit_ident(*ident)); . try_visit!(visitor.visit_id(*hir_id)); 60 ( 0.00%) visit_opt!(visitor, visit_generic_args, *args); . V::Result::output() . } . . pub fn walk_generic_args<'v, V: Visitor<'v>>( . visitor: &mut V, . generic_args: &'v GenericArgs<'v>, . ) -> V::Result { . let GenericArgs { args, constraints, parenthesized: _, span_ext: _ } = generic_args; -- line 1497 ---------------------------------------- 786,565 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/arc_with_non_send_sync.rs -------------------------------------------------------------------------------- Ir -- line 38 ---------------------------------------- . pub ARC_WITH_NON_SEND_SYNC, . suspicious, . "using `Arc` with a type that does not implement `Send` and `Sync`" . } . . declare_lint_pass!(ArcWithNonSendSync => [ARC_WITH_NON_SEND_SYNC]); . . impl<'tcx> LateLintPass<'tcx> for ArcWithNonSendSync { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,449 ( 0.00%) if let ExprKind::Call(func, [arg]) = expr.kind 4 ( 0.00%) && let ExprKind::Path(QPath::TypeRelative(func_ty, func_name)) = func.kind . && func_name.ident.name == sym::new . && !expr.span.from_expansion() . && cx.typeck_results().node_type(func_ty.hir_id).is_diag_item(cx, sym::Arc) . && let arg_ty = cx.typeck_results().expr_ty(arg) . // make sure that the type is not and does not contain any type parameters . && arg_ty.walk().all(|arg| { . !matches!(arg.kind(), GenericArgKind::Type(ty) if matches!(ty.kind(), ty::Param(_))) . }) -- line 56 ---------------------------------------- -- line 78 ---------------------------------------- . diag.help("if the `Arc` will not be used across threads replace it with an `Rc`"); . diag.help(format!( . "otherwise make `{arg_ty}` `Send` and `Sync` or consider a wrapper type such as `Mutex`" . )); . }); . }, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/redundant_slicing.rs -------------------------------------------------------------------------------- Ir -- line 67 ---------------------------------------- . } . . declare_lint_pass!(RedundantSlicing => [DEREF_BY_SLICING, REDUNDANT_SLICING]); . . static REDUNDANT_SLICING_LINT: (&Lint, &str) = (REDUNDANT_SLICING, "redundant slicing of the whole range"); . static DEREF_BY_SLICING_LINT: (&Lint, &str) = (DEREF_BY_SLICING, "slicing when dereferencing would work"); . . impl<'tcx> LateLintPass<'tcx> for RedundantSlicing { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . 393,218 ( 0.00%) let ctxt = expr.span.ctxt(); 786,436 ( 0.00%) if let ExprKind::AddrOf(BorrowKind::Ref, mutability, addressee) = expr.kind . && addressee.span.ctxt() == ctxt . && let ExprKind::Index(indexed, range, _) = addressee.kind . && cx . .typeck_results() . .expr_ty_adjusted(range) . .is_lang_item(cx, LangItem::RangeFull) . { . let (expr_ty, expr_ref_count, _) = peel_and_count_ty_refs(cx.typeck_results().expr_ty(expr)); -- line 89 ---------------------------------------- -- line 159 ---------------------------------------- . format!("(&{}{}*{snip})", mutability.prefix_str(), "*".repeat(indexed_ref_count)) . } else { . format!("&{}{}*{snip}", mutability.prefix_str(), "*".repeat(indexed_ref_count)) . }; . diag.span_suggestion(expr.span, "dereference the original value instead", sugg, app); . }); . } . } 3,145,784 ( 0.02%) } . } 1,572,872 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/block_scrutinee.rs -------------------------------------------------------------------------------- Ir -- line 27 ---------------------------------------- . pub BLOCK_SCRUTINEE, . suspicious, . "warns when the scrutinee is wrapped in a block in older editions" . } . . declare_lint_pass!(BlockScrutinee => [BLOCK_SCRUTINEE]); . . impl<'tcx> LateLintPass<'tcx> for BlockScrutinee { 1,966,115 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,179,669 ( 0.01%) if cx.tcx.sess.edition() >= Edition::Edition2024 { . return; . } . 1,966,115 ( 0.01%) let (scrutinee, keyword_fallback) = match expr.kind { . ExprKind::Match(scrutinee, _, _) => (scrutinee, "`match`"), . ExprKind::Let(let_expr) => (let_expr.init, "`if let` / `while let`"), . _ => return, . }; . . if scrutinee.span.from_expansion() || expr.span.from_expansion() { . return; . } -- line 48 ---------------------------------------- -- line 102 ---------------------------------------- . vec![ . (outer_span.shrink_to_lo(), format!("let res = {inner_snippet};\n{pad}")), . (scrutinee.span, "res".to_string()), . ], . Applicability::MaybeIncorrect, . ); . }); . } 1,966,115 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/indexing_slicing.rs -------------------------------------------------------------------------------- Ir -- line 104 ---------------------------------------- . Self { . allow_indexing_slicing_in_tests: conf.allow_indexing_slicing_in_tests, . suppress_restriction_lint_in_const: conf.suppress_restriction_lint_in_const, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for IndexingSlicing { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Index(array, index, _) = &expr.kind . && (!self.suppress_restriction_lint_in_const || !cx.tcx.hir_is_inside_const_context(expr.hir_id)) . && let expr_ty = cx.typeck_results().expr_ty(array) . && let mut deref = deref_chain(cx, expr_ty) . && deref.any(|l| { . l.peel_refs().is_slice() . || l.peel_refs().is_array() . || ty_has_applicable_get_function(cx, l.peel_refs(), expr_ty, expr) . }) -- line 121 ---------------------------------------- -- line 223 ---------------------------------------- . diag.help("consider using `.get(n)` or `.get_mut(n)` instead"); . . if cx.tcx.hir_is_inside_const_context(expr.hir_id) { . diag.note(note); . } . }); . } . } 3,145,784 ( 0.02%) } . } . . /// Returns a tuple of options with the start and end (exclusive) values of . /// the range. If the start or end is not constant, None is returned. . fn to_const_range(cx: &LateContext<'_>, range: higher::Range<'_>, array_size: u128) -> (Option, Option) { . let ecx = ConstEvalCtxt::new(cx); . let s = range.start.map(|expr| ecx.eval(expr)); . let start = match s { -- line 239 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/needless_parens_on_range_literals.rs -------------------------------------------------------------------------------- Ir -- line 71 ---------------------------------------- . diag.span_suggestion(e.span, "try", suggestion, applicability); . }, . ); . } . } . . impl<'tcx> LateLintPass<'tcx> for NeedlessParensOnRangeLiterals { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,966,115 ( 0.01%) if let Some(higher::Range { start, end, .. }) = higher::Range::hir(cx, expr) { 17,695,049 ( 0.09%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . if let Some(start) = start { . check_for_parens(cx, start, true); . } . if let Some(end) = end { . check_for_parens(cx, end, false); . } . } . } -- line 87 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/doc/mod.rs -------------------------------------------------------------------------------- Ir -- line 731 ---------------------------------------- . valid_idents: &'static FxHashSet, . check_private_items: bool, . } . . impl Documentation { . pub fn new(conf: &'static Conf) -> Self { . Self { . valid_idents: &conf.doc_valid_idents, 3 ( 0.00%) check_private_items: conf.check_private_items, . } . } . } . . impl EarlyLintPass for Documentation { 2,752,596 ( 0.01%) fn check_attributes(&mut self, cx: &EarlyContext<'_>, attrs: &[rustc_ast::Attribute]) { . include_in_doc_without_cfg::check(cx, attrs); 3,145,824 ( 0.02%) } . } . . impl<'tcx> LateLintPass<'tcx> for Documentation { 3,932,290 ( 0.02%) fn check_attributes(&mut self, cx: &LateContext<'tcx>, attrs: &'tcx [Attribute]) { 3,932,290 ( 0.02%) let Some(headers) = check_attrs(cx, self.valid_idents, attrs) else { . return; . }; . 6,291,676 ( 0.03%) match cx.tcx.hir_node(cx.last_node_with_lint_attrs) { 24,380,198 ( 0.12%) => ???:::hir_node (393,229x) . Node::Field(FieldDef { span, safety, .. }) => match (headers.safety, safety) { . (false, Safety::Unsafe) => span_lint( . cx, . MISSING_SAFETY_DOC, . *span, . "docs for unsafe field missing `# Safety` section", . ), . (true, Safety::Safe) if cx.tcx.features().unsafe_fields() => span_lint_and_help( -- line 764 ---------------------------------------- -- line 766 ---------------------------------------- . UNNECESSARY_SAFETY_DOC, . *span, . "field with `# Safety` documentation is not marked unsafe", . None, . "if the field has safety invariants, mark it `unsafe`", . ), . _ => (), . }, 4 ( 0.00%) Node::Item(item) => { . too_long_first_doc_paragraph::check( . cx, . item, . attrs, 8 ( 0.00%) headers.first_paragraph_text_len, 4 ( 0.00%) headers.first_paragraph_md_len, 4 ( 0.00%) self.check_private_items, . ); 18 ( 0.00%) match item.kind { . ItemKind::Fn { sig, body, .. } 6 ( 0.00%) if !(is_entrypoint_fn(cx, item.owner_id.to_def_id()) 2,175 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_entrypoint_fn (1x) . || item.span.in_external_macro(cx.tcx.sess.source_map())) => . { . missing_headers::check(cx, item.owner_id, sig, headers, Some(body), self.check_private_items); . }, . ItemKind::Trait { safety, .. } => match (headers.safety, safety) { . (false, Safety::Unsafe) => span_lint( . cx, . MISSING_SAFETY_DOC, -- line 793 ---------------------------------------- -- line 824 ---------------------------------------- . headers, . Some(body_id), . self.check_private_items, . ); . } . }, . _ => {}, . } 3,145,832 ( 0.02%) } . } . . #[derive(Copy, Clone)] . struct Fragments<'a> { . doc: &'a str, . fragments: &'a [DocFragment], . } . -- line 840 ---------------------------------------- -- line 867 ---------------------------------------- . // We don't want the parser to choke on intra doc links. Since we don't . // actually care about rendering them, just pretend that all broken links . // point to a fake address. . #[expect(clippy::unnecessary_wraps)] // we're following a type signature . fn fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowStr<'a>)> { . Some(("fake".into(), "fake".into())) . } . 2,359,374 ( 0.01%) if suspicious_doc_comments::check(cx, attrs) || is_doc_hidden(attrs) { 23,200,538 ( 0.11%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/doc/suspicious_doc_comments.rs:clippy_lints::doc::suspicious_doc_comments::check (393,229x) . return None; . } . 786,458 ( 0.00%) let (fragments, _) = attrs_to_doc_fragments( . attrs.iter().filter_map(|attr| { . if attr.doc_str_and_fragment_kind().is_none() || attr.span().in_external_macro(cx.sess().source_map()) { . None . } else { . Some((attr, None)) . } . }), . true, -- line 887 ---------------------------------------- -- line 889 ---------------------------------------- . . let mut doc = String::with_capacity(fragments.iter().map(|frag| frag.doc.as_str().len() + 1).sum()); . . for fragment in &fragments { . add_doc_fragment(&mut doc, fragment); . } . doc.pop(); . 393,229 ( 0.00%) if doc.trim().is_empty() { 1,179,687 ( 0.01%) if let Some(span) = span_of_fragments(&fragments) { 4,718,748 ( 0.02%) => ???:rustc_resolve::rustdoc::span_of_fragments (393,229x) . span_lint_and_help( . cx, . EMPTY_DOCS, . span, . "empty doc comment", . None, . "consider removing or filling it", . ); . } 1,179,687 ( 0.01%) return Some(DocHeaders::default()); . } . . // Only emits the allow-by-default `DOC_LINK_CODE`; skip its extra markdown reparse when it's off. . if !clippy_utils::is_lint_allowed(cx, DOC_LINK_CODE, cx.last_node_with_lint_attrs) { . check_for_code_clusters( . cx, . pulldown_cmark::Parser::new_with_broken_link_callback( . &doc, -- line 916 ---------------------------------------- 1,179,695 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_strip.rs -------------------------------------------------------------------------------- Ir -- line 63 ---------------------------------------- . . #[derive(Clone, Copy, Debug, Eq, PartialEq)] . enum StripKind { . Prefix, . Suffix, . } . . impl<'tcx> LateLintPass<'tcx> for ManualStrip { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr) 2 ( 0.00%) && let ExprKind::MethodCall(_, target_arg, [pattern], _) = cond.kind . && let ExprKind::Path(target_path) = &target_arg.kind . && let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(cond.hir_id) . { . let strip_kind = match cx.tcx.get_diagnostic_name(method_def_id) { . Some(sym::str_starts_with) => StripKind::Prefix, . Some(sym::str_ends_with) => StripKind::Suffix, . _ => return, . }; -- line 81 ---------------------------------------- -- line 144 ---------------------------------------- . ) . .collect(), . app, . ); . }, . ); . } . } 3,145,784 ( 0.02%) } . } . . // Returns `Some(arg)` if `expr` matches `arg.len()` and `None` otherwise. . fn len_arg<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { . if let ExprKind::MethodCall(_, arg, [], _) = expr.kind . && let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) . && cx.tcx.is_diagnostic_item(sym::str_len, method_def_id) . { -- line 160 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/utils/format_args_collector.rs -------------------------------------------------------------------------------- Ir -- line 13 ---------------------------------------- . pub struct FormatArgsCollector { . format_args: FxHashMap, . parent_spans: Vec, . storage: FormatArgsStorage, . } . . impl FormatArgsCollector { . pub fn new(storage: FormatArgsStorage) -> Self { 8 ( 0.00%) Self { . format_args: FxHashMap::default(), . parent_spans: Vec::new(), . storage, . } . } . } . . impl_lint_pass!(FormatArgsCollector => []); . . impl EarlyLintPass for FormatArgsCollector { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if let ExprKind::FormatArgs(args) = &expr.kind { . if self.has_span_from_external_macro(cx.sess().source_map(), expr.span, args) { . return; . } . . self.format_args.insert(expr.span.with_parent(None), (**args).clone()); . } 3,145,768 ( 0.02%) } . . fn check_crate_post(&mut self, _: &EarlyContext<'_>, _: &Crate) { 2 ( 0.00%) self.storage.set(mem::take(&mut self.format_args)); 110 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:::set (1x) . } . } . . impl FormatArgsCollector { . /// Detects if the format string or an argument has its span set by a proc macro to something . /// inside a macro callsite, e.g. . /// . /// ```ignore -- line 51 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/filter.rs -------------------------------------------------------------------------------- Ir -- line 20 ---------------------------------------- . #[derive(Clone)] . pub struct Filter { . // Used for `SplitWhitespace` and `SplitAsciiWhitespace` `as_str` methods . pub(crate) iter: I, . predicate: P, . } . impl Filter { . pub(in crate::iter) const fn new(iter: I, predicate: P) -> Filter { 1,179,681 ( 0.01%) Filter { iter, predicate } . } . } . . impl Filter . where . I: Iterator, . P: FnMut(&I::Item) -> bool, . { -- line 36 ---------------------------------------- -- line 78 ---------------------------------------- . ) -> impl FnMut(Acc, T) -> Acc { . move |acc, item| if predicate(&item) { fold(acc, item) } else { acc } . } . . fn filter_try_fold<'a, T, Acc, R: Try>( . predicate: &'a mut impl FnMut(&T) -> bool, . mut fold: impl FnMut(Acc, T) -> R + 'a, . ) -> impl FnMut(Acc, T) -> R + 'a { 2,424,806 ( 0.01%) move |acc, item| if predicate(&item) { fold(acc, item) } else { try { acc } } . } . . #[stable(feature = "rust1", since = "1.0.0")] . impl Iterator for Filter . where . P: FnMut(&I::Item) -> bool, . { . type Item = I::Item; . . #[inline] 8 ( 0.00%) fn next(&mut self) -> Option { . self.iter.find(&mut self.predicate) 8 ( 0.00%) } . . #[inline] . fn next_chunk( . &mut self, . ) -> Result<[Self::Item; N], array::IntoIter> { . // avoid codegen for the dead branch . let fun = const { . if crate::mem::needs_drop::() { -- line 107 ---------------------------------------- -- line 157 ---------------------------------------- . self.iter.try_fold(init, filter_try_fold(&mut self.predicate, fold)) . } . . #[inline] . fn fold(self, init: Acc, fold: Fold) -> Acc . where . Fold: FnMut(Acc, Self::Item) -> Acc, . { 5 ( 0.00%) self.iter.fold(init, filter_fold(self.predicate, fold)) . } . } . . #[stable(feature = "rust1", since = "1.0.0")] . impl DoubleEndedIterator for Filter . where . P: FnMut(&I::Item) -> bool, . { -- line 173 ---------------------------------------- 786,437 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs -------------------------------------------------------------------------------- Ir -- line 454 ---------------------------------------- . /// let mut vec: Vec = Vec::new(); . /// ``` . #[inline] . #[rustc_const_stable(feature = "const_vec_new", since = "1.39.0")] . #[rustc_diagnostic_item = "vec_new"] . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use] . pub const fn new() -> Self { 1,573,093 ( 0.01%) Vec { buf: RawVec::new(), len: 0 } . } . . /// Constructs a new, empty `Vec` with at least the specified capacity. . /// . /// The vector will be able to hold at least `capacity` elements without . /// reallocating. This method is allowed to allocate for more elements than . /// `capacity`. If `capacity` is zero, the vector will not allocate. . /// -- line 470 ---------------------------------------- -- line 961 ---------------------------------------- . /// // A vector of a zero-sized type will always over-allocate, since no . /// // allocation is necessary . /// let vec_units = Vec::<(), System>::with_capacity_in(10, System); . /// assert_eq!(vec_units.capacity(), usize::MAX); . /// ``` . #[inline] . #[unstable(feature = "allocator_api", issue = "32838")] . pub fn with_capacity_in(capacity: usize, alloc: A) -> Self { 1,297,966 ( 0.01%) Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 } . } . . /// Appends an element to the back of a collection. . /// . /// # Panics . /// . /// Panics if the new capacity exceeds `isize::MAX` _bytes_. . /// -- line 977 ---------------------------------------- -- line 1021 ---------------------------------------- . /// capacity after the push, *O*(*capacity*) time is taken to copy the . /// vector's elements to a larger allocation. This expensive operation is . /// offset by the *capacity* *O*(1) insertions it allows. . #[inline] . #[stable(feature = "push_mut", since = "1.95.0")] . #[must_use = "if you don't need a reference to the value, use `Vec::push` instead"] . pub fn push_mut(&mut self, value: T) -> &mut T { . // Inform codegen that the length does not change across grow_one(). 1,483 ( 0.00%) let len = self.len; . // This will panic or abort if we would allocate > isize::MAX bytes . // or if the length increment would overflow for zero-sized types. 3,297 ( 0.00%) if len == self.buf.capacity() { 308 ( 0.00%) self.buf.grow_one(); 14,957 ( 0.00%) => ???:>::grow_one (60x) . } . unsafe { . let end = self.as_mut_ptr().add(len); . ptr::write(end, value); 3,479 ( 0.00%) self.len = len + 1; . // SAFETY: We just wrote a value to the pointer that will live the lifetime of the reference. . &mut *end . } . } . } . . impl Vec { . /// Constructs a new, empty `Vec`. -- line 1046 ---------------------------------------- -- line 1188 ---------------------------------------- . capacity: usize, . alloc: A, . ) -> Self { . ub_checks::assert_unsafe_precondition!( . check_library_ub, . "Vec::from_raw_parts_in requires that length <= capacity", . (length: usize = length, capacity: usize = capacity) => length <= capacity . ); 1,110 ( 0.00%) unsafe { Vec { buf: RawVec::from_raw_parts_in(ptr, capacity, alloc), len: length } } . } . . #[doc(alias = "from_non_null_parts_in")] . /// Creates a `Vec` directly from a `NonNull` pointer, a length, a capacity, . /// and an allocator. . /// . /// # Safety . /// -- line 1204 ---------------------------------------- -- line 1453 ---------------------------------------- . /// let mut vec = vec![1]; . /// vec.reserve(10); . /// assert!(vec.capacity() >= 11); . /// ``` . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "vec_reserve"] . pub fn reserve(&mut self, additional: usize) { 24,380,817 ( 0.12%) self.buf.reserve(self.len, additional); . } . . /// Reserves the minimum capacity for at least `additional` more elements to . /// be inserted in the given `Vec`. Unlike [`reserve`], this will not . /// deliberately over-allocate to speculatively avoid frequent allocations. . /// After calling `reserve_exact`, capacity will be greater than or equal to . /// `self.len() + additional`. Does nothing if the capacity is already . /// sufficient. -- line 1469 ---------------------------------------- -- line 1590 ---------------------------------------- . /// ``` . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . pub fn shrink_to_fit(&mut self) { . // The capacity is never less than the length, and there's nothing to do when . // they are equal, so we can avoid the panic case in `RawVec::shrink_to_fit` . // by only calling it with a greater capacity. 3 ( 0.00%) if self.capacity() > self.len { . self.buf.shrink_to_fit(self.len); . } . } . . /// Shrinks the capacity of the vector with a lower bound. . /// . /// The capacity will remain at least as large as both the length . /// and the supplied value. -- line 1606 ---------------------------------------- -- line 1815 ---------------------------------------- . // case avoids creating an invalid slice, and . // * the `len` of the vector is shrunk before calling `drop_in_place`, . // such that no value will be dropped twice in case `drop_in_place` . // were to panic once (if it panics twice, the program aborts). . unsafe { . // Note: It's intentional that this is `>` and not `>=`. . // Changing it to `>=` has negative performance . // implications in some cases. See #78884 for more. 8 ( 0.00%) if len > self.len { . return; . } . let remaining_len = self.len - len; . let s = self.as_mut_ptr().add(len).cast_slice(remaining_len); 3 ( 0.00%) self.len = len; . ptr::drop_in_place(s); . } . } . . /// Extracts a slice containing the entire vector. . /// . /// Equivalent to `&s[..]`. . /// -- line 1836 ---------------------------------------- -- line 1857 ---------------------------------------- . // * obeys size and address-wrapping constraints . // . // * We only construct `&mut` references to `self.buf` through `&mut self` methods; borrow- . // check ensures that it is not possible to mutably alias `self.buf` within the . // returned lifetime. . unsafe { . // normally this would use `slice::from_raw_parts`, but it's . // instantiated often enough that avoiding the UB check is worth it 2,871,035 ( 0.01%) &*core::intrinsics::aggregate_raw_ptr::<*const [T], _, _>(self.as_ptr(), self.len) . } . } . . /// Extracts a mutable slice of the entire vector. . /// . /// Equivalent to `&mut s[..]`. . /// . /// # Examples -- line 1873 ---------------------------------------- -- line 1896 ---------------------------------------- . // * obeys size and address-wrapping constraints . // . // * We only construct references to `self.buf` through `&self` and `&mut self` methods; . // borrow-check ensures that it is not possible to construct a reference to `self.buf` . // within the returned lifetime. . unsafe { . // normally this would use `slice::from_raw_parts_mut`, but it's . // instantiated often enough that avoiding the UB check is worth it 393,236 ( 0.00%) &mut *core::intrinsics::aggregate_raw_ptr::<*mut [T], _, _>(self.as_mut_ptr(), self.len) . } . } . . /// Returns a raw pointer to the vector's buffer, or a dangling raw pointer . /// valid for zero sized reads if the vector didn't allocate. . /// . /// The caller must ensure that the vector outlives the pointer this . /// function returns, or else it will end up dangling. -- line 1912 ---------------------------------------- -- line 2216 ---------------------------------------- . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . pub const unsafe fn set_len(&mut self, new_len: usize) { . ub_checks::assert_unsafe_precondition!( . check_library_ub, . "Vec::set_len requires that new_len <= capacity()", . (new_len: usize = new_len, capacity: usize = self.capacity()) => new_len <= capacity . ); . 59,173 ( 0.00%) self.len = new_len; . } . . /// Removes an element from the vector and returns it. . /// . /// The removed element is replaced by the last element of the vector. . /// . /// This does not preserve ordering of the remaining elements, but is *O*(1). . /// If you need to preserve the element order, use [`remove`] instead. -- line 2232 ---------------------------------------- -- line 2865 ---------------------------------------- . /// . /// # Time complexity . /// . /// Takes *O*(1) time. . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "vec_pop"] . pub fn pop(&mut self) -> Option { 30 ( 0.00%) if self.len == 0 { . None . } else { . unsafe { 20 ( 0.00%) self.len -= 1; . core::hint::assert_unchecked(self.len < self.capacity()); . Some(ptr::read(self.as_ptr().add(self.len()))) . } . } . } . . /// Removes and returns the last element from a vector if the predicate . /// returns `true`, or [`None`] if the predicate returns false or the vector -- line 2885 ---------------------------------------- -- line 2973 ---------------------------------------- . Ok(()) . } . . /// Appends elements to `self` from other buffer without reserving additional capacity. . #[inline] . unsafe fn append_elements_unreserved(&mut self, other: *const [T]) { . let count = other.len(); . let len = self.len(); 37,427,627 ( 0.18%) if count > 0 { . unsafe { . ptr::copy_nonoverlapping(other as *const T, self.as_mut_ptr().add(len), count) . }; . } 48,762,171 ( 0.24%) self.len += count; . } . . /// Removes the subslice indicated by the given range from the vector, . /// returning a double-ended iterator over the removed subslice. . /// . /// If the iterator is dropped before being fully consumed, . /// it drops the remaining removed elements. . /// -- line 2994 ---------------------------------------- -- line 3074 ---------------------------------------- . . // SAFETY: . // - `elems` comes directly from `as_mut_slice` and is therefore valid. . // - Setting `self.len` before calling `drop_in_place` means that, . // if an element's `Drop` impl panics, the vector's `Drop` impl will . // do nothing (leaking the rest of the elements) instead of dropping . // some twice. . unsafe { 4 ( 0.00%) self.len = 0; . ptr::drop_in_place(elems); . } . } . . /// Returns the number of elements in the vector, also referred to . /// as its 'length'. . /// . /// # Examples -- line 3090 ---------------------------------------- -- line 3093 ---------------------------------------- . /// let a = vec![1, 2, 3]; . /// assert_eq!(a.len(), 3); . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_vec_string_slice", since = "1.87.0")] . #[rustc_confusables("length", "size")] . pub const fn len(&self) -> usize { 11,334,064 ( 0.06%) let len = self.len; . . // SAFETY: The maximum capacity of `Vec` is `isize::MAX` bytes, so the maximum value can . // be returned is `usize::checked_div(size_of::()).unwrap_or(usize::MAX)`, which . // matches the definition of `T::MAX_SLICE_LEN`. . unsafe { intrinsics::assume(len <= T::MAX_SLICE_LEN) }; . . len . } -- line 3109 ---------------------------------------- -- line 3118 ---------------------------------------- . /// . /// v.push(1); . /// assert!(!v.is_empty()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "vec_is_empty"] . #[rustc_const_stable(feature = "const_vec_string_slice", since = "1.87.0")] . pub const fn is_empty(&self) -> bool { 20 ( 0.00%) self.len() == 0 . } . . /// Splits the collection into two at the given index. . /// . /// Returns a newly allocated vector containing the elements in the range . /// `[at, len)`. After the call, the original vector will be left containing . /// the elements `[0, at)` with its previous capacity unchanged. . /// -- line 3134 ---------------------------------------- -- line 3868 ---------------------------------------- . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . impl Clone for Vec { . /// Creates a new `Vec` by deep-copying the contents of an existing `Vec`. . /// . /// This method will allocate a new `Vec` and `clone` all of `self`'s contents . /// into it. The capacity of the duplicate `Vec` is not forced to match the . /// capacity of the original. 413,707 ( 0.00%) fn clone(&self) -> Self { . let alloc = self.allocator().clone(); 2 ( 0.00%) <[T]>::to_vec_in(&**self, alloc) 531,907 ( 0.00%) } . . /// Overwrites the contents of `self` with a clone of the contents of `source`. . /// . /// This method is preferred over simply assigning `source.clone()` to `self`, . /// as it avoids reallocation if possible. Additionally, if the element type . /// `T` overrides `clone_from()`, this will reuse the resources of `self`'s . /// elements as well. . /// -- line 3887 ---------------------------------------- -- line 3988 ---------------------------------------- . /// LONG_LIVED.lock().unwrap().push(result); . /// } . /// ``` . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . impl FromIterator for Vec { . #[inline] . fn from_iter>(iter: I) -> Vec { 4 ( 0.00%) >::from_iter(iter.into_iter()) 205 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter.rs: as alloc::vec::spec_from_iter::SpecFromIter, ::check_item_kind::{closure#0}>, ::check_item_kind::{closure#1}>, core::option::Option>>>::from_iter (4x) . } . } . . #[stable(feature = "rust1", since = "1.0.0")] . impl IntoIterator for Vec { . type Item = T; . type IntoIter = IntoIter; . -- line 4004 ---------------------------------------- -- line 4026 ---------------------------------------- . let buf = me.buf.non_null(); . let begin = buf.as_ptr(); . let end = if T::IS_ZST { . begin.wrapping_byte_add(me.len()) . } else { . begin.add(me.len()) as *const T . }; . let cap = me.buf.capacity(); 7 ( 0.00%) IntoIter { buf, phantom: PhantomData, cap, alloc, ptr: buf, end } . } . } . } . . #[stable(feature = "rust1", since = "1.0.0")] . impl<'a, T, A: Allocator> IntoIterator for &'a Vec { . type Item = &'a T; . type IntoIter = slice::Iter<'a, T>; -- line 4042 ---------------------------------------- -- line 4056 ---------------------------------------- . } . } . . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . impl Extend for Vec { . #[inline] . fn extend>(&mut self, iter: I) { 1 ( 0.00%) >::spec_extend(self, iter.into_iter()) 519 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_extend.rs: as alloc::vec::spec_extend::SpecExtend>>::spec_extend (1x) . } . . #[inline] . fn extend_one(&mut self, item: T) { . self.push(item); . } . . #[inline] -- line 4072 ---------------------------------------- -- line 4092 ---------------------------------------- . fn extend_desugared>(&mut self, mut iterator: I) { . // This is the case for a general iterator. . // . // This function should be the moral equivalent of: . // . // for item in iterator { . // self.push(item); . // } 258 ( 0.00%) while let Some(element) = iterator.next() { 1,936 ( 0.00%) => /home/moon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/toml_parser-1.1.2+spec-1.1.0/src/lexer/mod.rs:::next (27x) . let len = self.len(); 72 ( 0.00%) if len == self.capacity() { . let (lower, _) = iterator.size_hint(); . self.reserve(lower.saturating_add(1)); . } . unsafe { . ptr::write(self.as_mut_ptr().add(len), element); . // Since next() executes user code which can panic we have to bump the length . // after each step. . // NB can't overflow since we would have had to alloc the address space 36 ( 0.00%) self.set_len(len + 1); . } . } . } . . // specific extend for `TrustedLen` iterators, called both by the specializations . // and internal places where resolving specialization makes compilation slower . #[cfg(not(no_global_oom_handling))] . fn extend_trusted(&mut self, iterator: impl iter::TrustedLen) { -- line 4119 ---------------------------------------- -- line 4345 ---------------------------------------- . } . } . . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . const unsafe impl<#[may_dangle] T: [const] Destruct, A: [const] Allocator + [const] Destruct> Drop . for Vec . { 27 ( 0.00%) fn drop(&mut self) { . unsafe { . // use drop for [T] . // use a raw slice to refer to the elements of the vector as weakest necessary type; . // could avoid questions of validity in certain cases 59,131 ( 0.00%) self.as_mut_ptr().cast_slice(self.len).drop_in_place() . } . // RawVec handles deallocation 32 ( 0.00%) } . } . . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_default", issue = "143894")] . const impl Default for Vec { . /// Creates an empty `Vec`. . /// . /// The vector will not allocate until elements are pushed onto it. -- line 4369 ---------------------------------------- 24,775,322 ( 0.12%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/string.rs -------------------------------------------------------------------------------- Ir -- line 439 ---------------------------------------- . /// let s = String::new(); . /// ``` . #[inline] . #[rustc_const_stable(feature = "const_string_new", since = "1.39.0")] . #[rustc_diagnostic_item = "string_new"] . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use] . pub const fn new() -> String { 25,682,538 ( 0.13%) String { vec: Vec::new() } . } . . /// Creates a new empty `String` with at least the specified capacity. . /// . /// `String`s have an internal buffer to hold their data. The capacity is . /// the length of that buffer, and can be queried with the [`capacity`] . /// method. This method creates an empty `String`, but one with an initial . /// buffer that can hold at least `capacity` bytes. This is useful when you -- line 455 ---------------------------------------- -- line 486 ---------------------------------------- . /// // ...but this may make the string reallocate . /// s.push('a'); . /// ``` . #[cfg(not(no_global_oom_handling))] . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use] . pub fn with_capacity(capacity: usize) -> String { 1,179,687 ( 0.01%) String { vec: Vec::with_capacity(capacity) } . } . . /// Creates a new empty `String` with at least the specified capacity. . /// . /// # Errors . /// . /// Returns [`Err`] if the capacity exceeds `isize::MAX` bytes, . /// or if the memory allocator reports failure. -- line 502 ---------------------------------------- -- line 1009 ---------------------------------------- . /// }; . /// . /// assert_eq!("💖", sparkle_heart); . /// ``` . #[inline] . #[must_use] . #[stable(feature = "rust1", since = "1.0.0")] . pub unsafe fn from_utf8_unchecked(bytes: Vec) -> String { 264 ( 0.00%) String { vec: bytes } . } . . /// Converts a `String` into a byte vector. . /// . /// This consumes the `String`, so we do not need to copy its contents. . /// . /// # Examples . /// -- line 1025 ---------------------------------------- -- line 1432 ---------------------------------------- . pub fn push(&mut self, ch: char) { . let len = self.len(); . let ch_len = ch.len_utf8(); . self.reserve(ch_len); . . // SAFETY: Just reserved capacity for at least the length needed to encode `ch`. . unsafe { . core::char::encode_utf8_raw_unchecked(ch as u32, self.vec.as_mut_ptr().add(len)); 33 ( 0.00%) self.vec.set_len(len + ch_len); . } . } . . /// Returns a byte slice of this `String`'s contents. . /// . /// The inverse of this method is [`from_utf8`]. . /// . /// [`from_utf8`]: String::from_utf8 -- line 1448 ---------------------------------------- -- line 2501 ---------------------------------------- . . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . impl Extend for String { . fn extend>(&mut self, iter: I) { . let iterator = iter.into_iter(); . let (lower_bound, _) = iterator.size_hint(); . self.reserve(lower_bound); 20 ( 0.00%) iterator.for_each(move |c| self.push(c)); . } . . #[inline] . fn extend_one(&mut self, c: char) { . self.push(c); . } . . #[inline] -- line 2517 ---------------------------------------- -- line 2944 ---------------------------------------- . // See , the last attempt . // to try to remove it. . #[inline] . default fn spec_to_string(&self) -> String { . let mut buf = String::new(); . let mut formatter = . core::fmt::Formatter::new(&mut buf, core::fmt::FormattingOptions::new()); . // Bypass format_args!() to avoid write_str with zero-length strs 25,682,511 ( 0.13%) fmt::Display::fmt(self, &mut formatter) 8,328,509,780 (40.96%) => ???:::fmt (8,560,837x) . .expect("a Display implementation returned an error unexpectedly"); 28,214,238 ( 0.14%) buf . } . } . . #[cfg(not(no_global_oom_handling))] . impl SpecToString for core::ascii::Char { . #[inline] . fn spec_to_string(&self) -> String { . self.as_str().to_owned() -- line 2962 ---------------------------------------- -- line 3274 ---------------------------------------- . /// let s = "eggplant".to_string(); . /// let s2 = "eggplant".to_string(); . /// assert_eq!(Cow::from(s), Cow::<'static, str>::Owned(s2)); . /// ``` . /// . /// [`Owned`]: crate::borrow::Cow::Owned "borrow::Cow::Owned" . #[inline] . fn from(s: String) -> Cow<'a, str> { 3 ( 0.00%) Cow::Owned(s) . } . } . . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "cow_from_string_ref", since = "1.28.0")] . impl<'a> From<&'a String> for Cow<'a, str> { . /// Converts a [`String`] reference into a [`Borrowed`] variant. . /// No heap allocation is performed, and the string -- line 3290 ---------------------------------------- -- line 3373 ---------------------------------------- . Self::from_utf8(bytes) . } . } . . #[cfg(not(no_global_oom_handling))] . #[stable(feature = "rust1", since = "1.0.0")] . impl fmt::Write for String { . #[inline] 170,665,607 ( 0.84%) fn write_str(&mut self, s: &str) -> fmt::Result { . self.push_str(s); . Ok(()) 170,665,607 ( 0.84%) } . . #[inline] . fn write_char(&mut self, c: char) -> fmt::Result { . self.push(c); . Ok(()) . } . } . -- line 3392 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/operators/mod.rs -------------------------------------------------------------------------------- Ir -- line 1033 ---------------------------------------- . modulo_arithmetic_allow_comparison_to_zero: bool, . msrv: Msrv, . } . . impl Operators { . pub fn new(conf: &'static Conf) -> Self { . Self { . arithmetic_context: numeric_arithmetic::Context::default(), 2 ( 0.00%) verbose_bit_mask_threshold: conf.verbose_bit_mask_threshold, 1 ( 0.00%) modulo_arithmetic_allow_comparison_to_zero: conf.allow_comparison_to_zero, . msrv: conf.msrv.into(), . } . } . } . . impl<'tcx> LateLintPass<'tcx> for Operators { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) eq_op::check_assert(cx, e); 37,356,564 ( 0.18%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/eq_op.rs:clippy_lints::operators::eq_op::check_assert (393,223x) 1,179,669 ( 0.01%) float_cmp::check_assert(cx, e); 23,987,008 ( 0.12%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/float_cmp.rs:clippy_lints::operators::float_cmp::check_assert (393,223x) 2,359,336 ( 0.01%) match e.kind { 3 ( 0.00%) ExprKind::Binary(op, lhs, rhs) => { 2 ( 0.00%) if !e.span.from_expansion() { 6 ( 0.00%) absurd_extreme_comparisons::check(cx, e, op.node, lhs, rhs); 679 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/absurd_extreme_comparisons.rs:clippy_lints::operators::absurd_extreme_comparisons::check (1x) . if !(macro_with_not_op(lhs) || macro_with_not_op(rhs)) { 6 ( 0.00%) eq_op::check(cx, e, op.node, lhs, rhs); 660 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/eq_op.rs:clippy_lints::operators::eq_op::check (1x) 6 ( 0.00%) op_ref::check(cx, e, op.node, lhs, rhs); 82 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/op_ref.rs:clippy_lints::operators::op_ref::check (1x) . } . erasing_op::check(cx, e, op.node, lhs, rhs); 6 ( 0.00%) identity_op::check(cx, e, op.node, lhs, rhs); 301 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/identity_op.rs:clippy_lints::operators::identity_op::check (1x) . invalid_upcast_comparisons::check(cx, op.node, lhs, rhs, e.span); 7 ( 0.00%) needless_bitwise_bool::check(cx, e, op.node, lhs, rhs); 21 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/needless_bitwise_bool.rs:clippy_lints::operators::needless_bitwise_bool::check (1x) 8 ( 0.00%) manual_midpoint::check(cx, e, op.node, lhs, rhs, self.msrv); 26 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/manual_midpoint.rs:clippy_lints::operators::manual_midpoint::check (1x) 7 ( 0.00%) manual_is_multiple_of::check(cx, e, op.node, lhs, rhs, self.msrv); 46 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/manual_is_multiple_of.rs:clippy_lints::operators::manual_is_multiple_of::check (1x) 7 ( 0.00%) manual_isolate_lowest_one::check(cx, e, op.node, lhs, rhs, self.msrv); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/manual_isolate_lowest_one.rs:clippy_lints::operators::manual_isolate_lowest_one::check (1x) 5 ( 0.00%) decimal_bitwise_operands::check(cx, op.node, lhs, rhs); 18 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/decimal_bitwise_operands.rs:clippy_lints::operators::decimal_bitwise_operands::check (1x) . } 7 ( 0.00%) self.arithmetic_context.check_binary(cx, e, op.node, lhs, rhs); 162 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/numeric_arithmetic.rs:::check_binary (1x) 6 ( 0.00%) bit_mask::check(cx, e, op.node, lhs, rhs); 166 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/bit_mask.rs:clippy_lints::operators::bit_mask::check (1x) . verbose_bit_mask::check(cx, e, op.node, lhs, rhs, self.verbose_bit_mask_threshold); 7 ( 0.00%) double_comparison::check(cx, op.node, lhs, rhs, e.span); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/double_comparison.rs:clippy_lints::operators::double_comparison::check (1x) 6 ( 0.00%) const_comparisons::check(cx, op, lhs, rhs, e.span); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/const_comparisons.rs:clippy_lints::operators::const_comparisons::check (1x) 6 ( 0.00%) duration_subsec::check(cx, e, op.node, lhs, rhs); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/duration_subsec.rs:clippy_lints::operators::duration_subsec::check (1x) 6 ( 0.00%) float_equality_without_abs::check(cx, e, op.node, lhs, rhs); 22 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/float_equality_without_abs.rs:clippy_lints::operators::float_equality_without_abs::check (1x) 6 ( 0.00%) integer_division::check(cx, e, op.node, lhs, rhs); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/integer_division.rs:clippy_lints::operators::integer_division::check (1x) 6 ( 0.00%) integer_division_remainder_used::check(cx, op.node, lhs, rhs, e.span); 19 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/integer_division_remainder_used.rs:clippy_lints::operators::integer_division_remainder_used::check (1x) . cmp_owned::check(cx, e, op.node, lhs, rhs); 6 ( 0.00%) float_cmp::check(cx, e, op.node, lhs, rhs); 78 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/float_cmp.rs:clippy_lints::operators::float_cmp::check (1x) . modulo_one::check(cx, e, op.node, rhs); 6 ( 0.00%) modulo_arithmetic::check( 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/modulo_arithmetic.rs:clippy_lints::operators::modulo_arithmetic::check (1x) . cx, . e, . op.node, . lhs, . rhs, 1 ( 0.00%) self.modulo_arithmetic_allow_comparison_to_zero, . ); 14 ( 0.00%) manual_div_ceil::check(cx, e, op.node, lhs, rhs, self.msrv); 19 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/operators/manual_div_ceil.rs:clippy_lints::operators::manual_div_ceil::check (1x) . }, . ExprKind::AssignOp(op, lhs, rhs) => { . let bin_op = op.node.into(); . if !e.span.from_expansion() { . decimal_bitwise_operands::check(cx, bin_op, lhs, rhs); . } . self.arithmetic_context.check_binary(cx, e, bin_op, lhs, rhs); . misrefactored_assign_op::check(cx, e, bin_op, lhs, rhs); -- line 1097 ---------------------------------------- -- line 1099 ---------------------------------------- . }, . ExprKind::Assign(lhs, rhs, _) => { . assign_op_pattern::check(cx, e, lhs, rhs, self.msrv); . self_assignment::check(cx, e, lhs, rhs); . }, . ExprKind::Unary(op, arg) => . { . #[expect(clippy::collapsible_match)] 1 ( 0.00%) if op == UnOp::Neg { . self.arithmetic_context.check_negate(cx, e, arg); . } . }, . _ => (), . } 3,145,776 ( 0.02%) } . . fn check_expr_post(&mut self, _: &LateContext<'_>, e: &Expr<'_>) { . self.arithmetic_context.expr_post(e.hir_id); . } . . fn check_body(&mut self, cx: &LateContext<'tcx>, b: &Body<'_>) { . self.arithmetic_context.enter_body(cx, b); . } . . fn check_body_post(&mut self, cx: &LateContext<'tcx>, b: &Body<'_>) { . self.arithmetic_context.body_post(cx, b); . } . } . . fn macro_with_not_op(e: &Expr<'_>) -> bool { 4 ( 0.00%) if let ExprKind::Unary(_, e) = e.kind { . e.span.from_expansion() . } else { . false . } . } 262,153 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs -------------------------------------------------------------------------------- Ir -- line 447 ---------------------------------------- . /// Therefore, implementations must not require the user to uphold . /// any safety invariants. . /// . /// This intrinsic does not have a stable counterpart. . #[unstable(feature = "core_intrinsics", issue = "none")] . #[rustc_nounwind] . #[inline(always)] . pub const fn likely(b: bool) -> bool { 796 ( 0.00%) if b { . true . } else { . cold_path(); . false . } . } . . /// Hints to the compiler that branch condition is likely to be false. -- line 463 ---------------------------------------- -- line 470 ---------------------------------------- . /// Therefore, implementations must not require the user to uphold . /// any safety invariants. . /// . /// This intrinsic does not have a stable counterpart. . #[unstable(feature = "core_intrinsics", issue = "none")] . #[rustc_nounwind] . #[inline(always)] . pub const fn unlikely(b: bool) -> bool { 45,632,319 ( 0.22%) if b { . cold_path(); . true . } else { . false . } . } . . /// Returns either `true_val` or `false_val` depending on condition `b` with a -- line 486 ---------------------------------------- -- line 2207 ---------------------------------------- . #[rustc_nounwind] . #[rustc_intrinsic] . #[rustc_allow_const_fn_unstable(const_trait_impl, funnel_shifts)] . #[miri::intrinsic_fallback_is_spec] . pub const fn rotate_left(x: T, shift: u32) -> T { . // Make sure to call the intrinsic for `funnel_shl`, not the fallback impl. . // SAFETY: we modulo `shift` so that the result is definitely less than the size of . // `T` in bits. 1,336 ( 0.00%) unsafe { unchecked_funnel_shl(x, x, shift % (mem::size_of::() as u32 * 8)) } . } . . /// Performs rotate right. . /// . /// Note that, unlike most intrinsics, this is safe to call; . /// it does not require an `unsafe` block. . /// Therefore, implementations must not require the user to uphold . /// any safety invariants. -- line 2223 ---------------------------------------- -- line 2615 ---------------------------------------- . @capture$([$($binders:tt)*])? { $($arg:ident : $ty:ty = $val:expr),* $(,)? } $( -> $ret:ty )? : . if const . $(#[$compiletime_attr:meta])* $compiletime:block . else . $(#[$runtime_attr:meta])* $runtime:block . ) => {{ . #[inline] . $(#[$runtime_attr])* 2 ( 0.00%) fn runtime$(<$($binders)*>)?($($arg: $ty),*) $( -> $ret )? { . $runtime . } . . #[inline] . $(#[$compiletime_attr])* . const fn compiletime$(<$($binders)*>)?($($arg: $ty),*) $( -> $ret )? { . // Don't warn if one of the arguments is unused. . $(let _ = $arg;)* -- line 2631 ---------------------------------------- 22,669,014 ( 0.11%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_abs_diff.rs -------------------------------------------------------------------------------- Ir -- line 49 ---------------------------------------- . . impl ManualAbsDiff { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualAbsDiff { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if !expr.span.from_expansion() . && let Some(if_expr) = If::hir(expr) . && let Some(r#else) = if_expr.r#else . && let ExprKind::Binary(op, rhs, lhs) = if_expr.cond.kind . && let (BinOpKind::Gt | BinOpKind::Ge, mut a, mut b) | (BinOpKind::Lt | BinOpKind::Le, mut b, mut a) = . (op.node, rhs, lhs) . && let Some((ty, b_n_refs)) = self.are_ty_eligible(cx, a, b) . && is_sub_expr(cx, if_expr.then, a, b, ty) . && is_sub_expr(cx, r#else, b, a, ty) -- line 66 ---------------------------------------- -- line 86 ---------------------------------------- . Sugg::hir(cx, a, "..").maybe_paren(), . "*".repeat(b_n_refs), . Sugg::hir(cx, b, "..") . ); . diag.span_suggestion(expr.span, "replace with `abs_diff`", sugg, applicability); . }, . ); . } 3,145,784 ( 0.02%) } . } . . impl ManualAbsDiff { . /// Returns a type if `a` and `b` are both of it, and this lint can be applied to that . /// type (currently, any primitive int, or a `Duration`) . fn are_ty_eligible<'tcx>(&self, cx: &LateContext<'tcx>, a: &Expr<'_>, b: &Expr<'_>) -> Option<(Ty<'tcx>, usize)> { . let is_int = |ty: Ty<'_>| matches!(ty.kind(), ty::Uint(_) | ty::Int(_)) && self.msrv.meets(cx, msrvs::ABS_DIFF); . let is_duration = -- line 102 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/only_used_in_recursion.rs -------------------------------------------------------------------------------- Ir -- line 213 ---------------------------------------- . impl Usage { . fn new(span: Span, idx: usize) -> Self { . Self { span, idx } . } . } . . /// The parameters being checked by the lint, indexed by both the parameter's `HirId` and the . /// `DefId` of the function paired with the parameter's index. 2 ( 0.00%) #[derive(Default)] . #[expect(clippy::struct_field_names)] . struct Params { . params: Vec, . by_id: HirIdMap, . by_fn: FxHashMap<(DefId, usize), usize>, . } . impl Params { . fn insert(&mut self, param: Param, id: HirId) { -- line 229 ---------------------------------------- -- line 293 ---------------------------------------- . } . } . eval_stack.pop(); . false . } . } . } . 11 ( 0.00%) #[derive(Default)] . pub struct OnlyUsedInRecursion { . /// Track the top-level body entered. Needed to delay reporting when entering nested bodies. . entered_body: Option, . params: Params, . } . . impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion { 24 ( 0.00%) fn check_body(&mut self, cx: &LateContext<'tcx>, body: &Body<'tcx>) { 9 ( 0.00%) if body.value.span.from_expansion() { . return; . } . // `skip_params` is either `0` or `1` to skip the `self` parameter in trait functions. . // It can't be renamed, and it can't be removed without removing it from multiple functions. 34 ( 0.00%) let (fn_id, fn_kind, skip_params) = match cx.tcx.parent_hir_node(body.value.hir_id) { 324 ( 0.00%) => ???:::parent_hir_node (3x) 4 ( 0.00%) Node::Item(i) => (i.owner_id.to_def_id(), FnKind::Fn, 0), . Node::TraitItem(&TraitItem { . kind: TraitItemKind::Fn(ref sig, _), . owner_id, . .. . }) => ( . owner_id.to_def_id(), . FnKind::TraitFn, . usize::from(sig.decl.implicit_self().has_implicit_self()), -- line 324 ---------------------------------------- -- line 342 ---------------------------------------- . usize::from(sig.decl.implicit_self().has_implicit_self()), . ) . } else { . (owner_id.to_def_id(), FnKind::Fn, 0) . } . }, . _ => return, . }; 4 ( 0.00%) body.params . .iter() . .enumerate() . .skip(skip_params) . .filter_map(|(idx, p)| match p.pat.kind { . PatKind::Binding(_, id, ident, None) if !ident.as_str().starts_with('_') => { . Some((id, Param::new(fn_id, fn_kind, idx, ident))) . }, . _ => None, . }) . .for_each(|(id, param)| self.params.insert(param, id)); 2 ( 0.00%) if self.entered_body.is_none() { 4 ( 0.00%) self.entered_body = Some(body.value.hir_id); . } 24 ( 0.00%) } . 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) { . if let Some(id) = e.res_local_id() . && let Some(param) = self.params.get_by_id_mut(id) . { . let typeck = cx.typeck_results(); . let span = e.span; . let mut e = e; . loop { . match get_expr_use_or_unification_node(cx.tcx, e) { -- line 374 ---------------------------------------- -- line 428 ---------------------------------------- . _ => (), . }, . _ => (), . } . self.params.remove_by_id(id); . return; . } . } 3,145,784 ( 0.02%) } . 21 ( 0.00%) fn check_body_post(&mut self, cx: &LateContext<'tcx>, body: &Body<'tcx>) { 2 ( 0.00%) if self.entered_body == Some(body.value.hir_id) { 2 ( 0.00%) self.entered_body = None; . self.params.flag_for_linting(); . for param in &self.params.params { . if param.apply_lint.get() { . if param.ident.name == kw::SelfLower { . span_lint_and_then( . cx, . SELF_ONLY_USED_IN_RECURSION, . param.ident.span, -- line 448 ---------------------------------------- -- line 473 ---------------------------------------- . ); . }, . ); . } . } . } . self.params.clear(); . } 24 ( 0.00%) } . } . . fn has_matching_args(kind: FnKind, args: GenericArgsRef<'_>) -> bool { . match kind { . FnKind::Fn => true, . FnKind::TraitFn => args.iter().enumerate().all(|(idx, subst)| match subst.kind() { . GenericArgKind::Lifetime(_) => true, . GenericArgKind::Type(ty) => matches!(*ty.kind(), ty::Param(ty) if ty.index as usize == idx), -- line 489 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/f64.rs -------------------------------------------------------------------------------- Ir -- line 717 ---------------------------------------- . #[must_use] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_float_classify", since = "1.83.0")] . #[inline] . pub const fn is_infinite(self) -> bool { . // Getting clever with transmutation can result in incorrect answers on some FPUs . // FIXME: alter the Rust <-> Rust calling convention to prevent this problem. . // See https://github.com/rust-lang/rust/issues/72327 983,025 ( 0.00%) (self == f64::INFINITY) | (self == f64::NEG_INFINITY) . } . . /// Returns `true` if this number is neither infinite nor NaN. . /// . /// ``` . /// let f = 7.0f64; . /// let inf: f64 = f64::INFINITY; . /// let neg_inf: f64 = f64::NEG_INFINITY; -- line 733 ---------------------------------------- -- line 1918 ---------------------------------------- . /// It will be stabilized as an inherent method._ . /// . /// [`f64::trunc`]: ../../../std/primitive.f64.html#method.trunc . #[inline] . #[doc(alias = "truncate")] . #[unstable(feature = "core_float_math", issue = "137578")] . #[must_use = "method returns a new number and does not mutate the original value"] . pub const fn trunc(x: f64) -> f64 { 393,210 ( 0.00%) intrinsics::truncf64(x) 2,949,075 ( 0.01%) => /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/library/core/src/num/f64.rs:trunc (196,605x) . } . . /// Experimental version of `fract` in `core`. See [`f64::fract`] for details. . /// . /// # Examples . /// . /// ``` . /// #![feature(core_float_math)] -- line 1934 ---------------------------------------- -- line 1947 ---------------------------------------- . /// _This standalone function is for testing only. . /// It will be stabilized as an inherent method._ . /// . /// [`f64::fract`]: ../../../std/primitive.f64.html#method.fract . #[inline] . #[unstable(feature = "core_float_math", issue = "137578")] . #[must_use = "method returns a new number and does not mutate the original value"] . pub const fn fract(x: f64) -> f64 { 589,815 ( 0.00%) x - trunc(x) . } . . /// Experimental version of `mul_add` in `core`. See [`f64::mul_add`] for details. . /// . /// # Examples . /// . /// ``` . /// # #![allow(unused_features)] -- line 1963 ---------------------------------------- 196,605 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs -------------------------------------------------------------------------------- Ir -- line 569 ---------------------------------------- . /// . /// If `write` is a reference to a formatter, it is recommended to use . /// [`Formatter::with_options`] instead as this can borrow the underlying . /// `write`, thereby bypassing one layer of indirection. . /// . /// You may alternatively use [`FormattingOptions::create_formatter()`]. . #[unstable(feature = "formatting_options", issue = "118117")] . pub const fn new(write: &'a mut (dyn Write + 'a), options: FormattingOptions) -> Self { 34,243,348 ( 0.17%) Formatter { options, buf: write } . } . . /// Creates a new formatter based on this one with given [`FormattingOptions`]. . #[unstable(feature = "formatting_options", issue = "118117")] . pub const fn with_options<'b>(&'b mut self, options: FormattingOptions) -> Formatter<'b> { . Formatter { options, buf: self.buf } . } . } -- line 585 ---------------------------------------- -- line 2879 ---------------------------------------- . . // Implementations of the core formatting traits . . macro_rules! fmt_refs { . ($($tr:ident),*) => { . $( . #[stable(feature = "rust1", since = "1.0.0")] . impl $tr for &T { 1,020 ( 0.00%) fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) } 14,394 ( 0.00%) => ???:::fmt (204x) . } . #[stable(feature = "rust1", since = "1.0.0")] . impl $tr for &mut T { . fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) } . } . )* . } . } -- line 2895 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs -------------------------------------------------------------------------------- Ir -- line 121 ---------------------------------------- . /// Check that a range is in bounds for slicing a string. . /// If this returns true, it is safe to call `slice.get_unchecked(range)` or . /// `slice.get_unchecked_mut(range)`. . #[inline(always)] . const fn check_range(slice: &str, range: crate::range::Range) -> bool { . let crate::range::Range { start, end } = range; . let bytes = slice.as_bytes(); . 2,939,602 ( 0.01%) if start > end || end > slice.len() { . return false; . } . 1,306,482 ( 0.01%) if start == slice.len() { . // If `start == slice.len()`, then `end == slice.len()` must also be true. . return true; . } . . // SAFETY: . // `start > end || end > slice.len()` is false, so `start <= end <= slice.len()` is true. . // `start == slice.len()` is false, so `start < slice.len()` is also true. . // . // No need to check for `end == 0`, because if `end == 0` is true then `start == slice.len()` . // would also be true, which is already handled above. . unsafe { 1,959,718 ( 0.01%) (start == 0 || bytes.as_ptr().add(start).read().is_utf8_char_boundary()) 1,306,478 ( 0.01%) && (end == slice.len() || bytes.as_ptr().add(end).read().is_utf8_char_boundary()) . } . } . . /// Implements substring slicing with syntax `&self[begin .. end]` or `&mut . /// self[begin .. end]`. . /// . /// Returns a slice of the given string from the byte range . /// [`begin`, `end`). -- line 154 ---------------------------------------- -- line 213 ---------------------------------------- . end: usize = self.end, . len: usize = slice.len() . ) => end >= start && end <= len, . ); . . // SAFETY: the caller guarantees that `self` is in bounds of `slice` . // which satisfies all the conditions for `add`. . unsafe { 2,157,605 ( 0.01%) let new_len = unchecked_sub(self.end, self.start); . slice.as_ptr().add(self.start).cast_slice(new_len) as *const str . } . } . #[inline] . #[track_caller] . unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output { . let slice = slice as *mut [u8]; . -- line 229 ---------------------------------------- -- line 254 ---------------------------------------- . } . . #[stable(feature = "new_range_api", since = "1.96.0")] . #[rustc_const_unstable(feature = "const_index", issue = "143775")] . const unsafe impl SliceIndex for range::Range { . type Output = str; . #[inline] . fn get(self, slice: &str) -> Option<&Self::Output> { 1,108,786 ( 0.01%) if check_range(slice, self) { . // SAFETY: just checked that `self` is in bounds, . // and we are passing in a safe reference, so the return value will also be one. . // We also checked char boundaries, so this is valid UTF-8. . Some(unsafe { &*self.get_unchecked(slice) }) . } else { . None . } . } -- line 270 ---------------------------------------- -- line 297 ---------------------------------------- . end: usize = self.end, . len: usize = slice.len() . ) => end >= start && end <= len, . ); . . // SAFETY: the caller guarantees that `self` is in bounds of `slice` . // which satisfies all the conditions for `add`. . unsafe { 1 ( 0.00%) let new_len = unchecked_sub(self.end, self.start); . slice.as_ptr().add(self.start).cast_slice(new_len) as *const str . } . } . #[inline] . #[track_caller] . unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output { . let slice = slice as *mut [u8]; . -- line 313 ---------------------------------------- -- line 416 ---------------------------------------- . /// Panics if `end` does not point to the starting byte offset of a . /// character (as defined by `is_char_boundary`), or if `end > len`. . #[stable(feature = "str_checked_slicing", since = "1.20.0")] . #[rustc_const_unstable(feature = "const_index", issue = "143775")] . const unsafe impl SliceIndex for ops::RangeTo { . type Output = str; . #[inline] . fn get(self, slice: &str) -> Option<&Self::Output> { 196,605 ( 0.00%) if slice.is_char_boundary(self.end) { . // SAFETY: just checked that `end` is on a char boundary, . // and we are passing in a safe reference, so the return value will also be one. . Some(unsafe { &*self.get_unchecked(slice) }) . } else { . None . } . } . #[inline] -- line 432 ---------------------------------------- -- line 485 ---------------------------------------- . /// Panics if `begin` does not point to the starting byte offset of . /// a character (as defined by `is_char_boundary`), or if `begin > len`. . #[stable(feature = "str_checked_slicing", since = "1.20.0")] . #[rustc_const_unstable(feature = "const_index", issue = "143775")] . const unsafe impl SliceIndex for ops::RangeFrom { . type Output = str; . #[inline] . fn get(self, slice: &str) -> Option<&Self::Output> { 393,210 ( 0.00%) if slice.is_char_boundary(self.start) { . // SAFETY: just checked that `start` is on a char boundary, . // and we are passing in a safe reference, so the return value will also be one. . Some(unsafe { &*self.get_unchecked(slice) }) . } else { . None . } . } . #[inline] -- line 501 ---------------------------------------- 980,945 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_bits.rs -------------------------------------------------------------------------------- Ir -- line 42 ---------------------------------------- . . impl ManualBits { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualBits { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Binary(bin_op, left_expr, right_expr) = expr.kind 2 ( 0.00%) && let BinOpKind::Mul = &bin_op.node . && !expr.span.from_expansion() . && let ctxt = expr.span.ctxt() . && left_expr.span.ctxt() == ctxt . && right_expr.span.ctxt() == ctxt . && let Some((real_ty_span, resolved_ty, other_expr)) = get_one_size_of_ty(cx, left_expr, right_expr) . && matches!(resolved_ty.kind(), ty::Int(_) | ty::Uint(_)) . && let ExprKind::Lit(lit) = &other_expr.kind . && let LitKind::Int(Pu128(8), _) = lit.node -- line 60 ---------------------------------------- -- line 69 ---------------------------------------- . MANUAL_BITS, . expr.span, . "usage of `size_of::()` to obtain the size of `T` in bits", . "consider using", . sugg, . app, . ); . } 3,145,784 ( 0.02%) } . } . . fn get_one_size_of_ty<'tcx>( . cx: &LateContext<'tcx>, . expr1: &'tcx Expr<'_>, . expr2: &'tcx Expr<'_>, . ) -> Option<(Span, Ty<'tcx>, &'tcx Expr<'tcx>)> { . match (get_size_of_ty(cx, expr1), get_size_of_ty(cx, expr2)) { -- line 85 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_arg.rs -------------------------------------------------------------------------------- Ir -- line 7 ---------------------------------------- . use clippy_utils::{is_empty_block, is_expr_default, is_from_proc_macro}; . use rustc_errors::Applicability; . use rustc_hir::{Block, Expr, ExprKind, MatchSource, Node, StmtKind}; . use rustc_lint::LateContext; . use rustc_span::SyntaxContext; . . use super::{UNIT_ARG, utils}; . 3,539,007 ( 0.02%) pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . . // apparently stuff in the desugaring of `?` can trigger this . // so check for that here . // only the calls to `Try::from_error` is marked as desugared, . // so we need to check both the current Expr and its parent. 786,436 ( 0.00%) if is_questionmark_desugar_marked_call(expr) { . return; . } 3,538,959 ( 0.02%) if let Node::Expr(parent_expr) = cx.tcx.parent_hir_node(expr.hir_id) 42,467,544 ( 0.21%) => ???:::parent_hir_node (393,218x) 3 ( 0.00%) && is_questionmark_desugar_marked_call(parent_expr) . { . return; . } . 1,572,872 ( 0.01%) let (receiver, args) = match expr.kind { . ExprKind::Call(_, args) => (None, args), 4 ( 0.00%) ExprKind::MethodCall(_, receiver, args, _) => (Some(receiver), args), . _ => return, . }; . . let args_to_recover = receiver . .into_iter() . .chain(args) . .filter(|arg| { 2 ( 0.00%) if cx.typeck_results().expr_ty(arg).is_unit() && !utils::is_unit_literal(arg) { 40 ( 0.00%) => ???:::expr_ty (1x) . !matches!( . &arg.kind, . ExprKind::Match(.., MatchSource::TryDesugar(_)) | ExprKind::Path(..) . ) . } else { . false . } . }) . .collect::>(); 1 ( 0.00%) if !args_to_recover.is_empty() && !is_from_proc_macro(cx, expr) { . lint_unit_args(cx, expr, args_to_recover.as_slice()); . } 3,145,784 ( 0.02%) } . . fn is_questionmark_desugar_marked_call(expr: &Expr<'_>) -> bool { . use rustc_span::hygiene::DesugaringKind; 1,179,648 ( 0.01%) if let ExprKind::Call(callee, _) = expr.kind { 3 ( 0.00%) callee.span.is_desugaring(DesugaringKind::QuestionMark) 99 ( 0.00%) => ???:::is_desugaring (1x) . } else { . false . } . } . . fn lint_unit_args<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, args_to_recover: &[&'tcx Expr<'tcx>]) { . let mut applicability = Applicability::MachineApplicable; . let (singular, plural) = if args_to_recover.len() > 1 { -- line 69 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/len_zero.rs -------------------------------------------------------------------------------- Ir -- line 96 ---------------------------------------- . . impl LenZero { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for LenZero { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if let ExprKind::Let(lt) = expr.kind . && match lt.pat.kind { . PatKind::Slice([], None, []) => true, . PatKind::Expr(lit) . if let PatExprKind::Lit { lit, .. } = lit.kind . && let LitKind::Str(lit, _) = lit.node => . { . lit.as_str().is_empty() . }, -- line 113 ---------------------------------------- -- line 127 ---------------------------------------- . lt.span, . "comparison to empty slice using `if let`", . "using `is_empty` is clearer and more explicit", . format!("{lit_str}.is_empty()"), . applicability, . ); . } . 786,448 ( 0.00%) if let ExprKind::MethodCall(method, lhs_expr, [rhs_expr], _) = expr.kind . && cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::PartialEq) . && !expr.span.from_expansion() . { . self.check_empty_expr( . cx, . expr.span, . lhs_expr, . peel_ref_operators(cx, rhs_expr), -- line 143 ---------------------------------------- -- line 144 ---------------------------------------- . if method.ident.name == sym::ne { . "!" . } else { . Default::default() . }, . ); . } . 786,449 ( 0.00%) if let ExprKind::Binary(Spanned { node: cmp, .. }, left, right) = expr.kind 2 ( 0.00%) && !expr.span.from_expansion() . { . // expr.span might contains parenthesis, see issue #10529 1 ( 0.00%) let actual_span = span_without_enclosing_paren(cx, expr.span); 6 ( 0.00%) match cmp { . BinOpKind::Eq => { 11 ( 0.00%) self.check_cmp(cx, actual_span, left, right, "", 0); // len == 0 243 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/len_zero.rs:::check_cmp (1x) 8 ( 0.00%) self.check_cmp(cx, actual_span, right, left, "", 0); // 0 == len . }, . BinOpKind::Ne => { . self.check_cmp(cx, actual_span, left, right, "!", 0); // len != 0 . self.check_cmp(cx, actual_span, right, left, "!", 0); // 0 != len . }, . BinOpKind::Gt => { . self.check_cmp(cx, actual_span, left, right, "!", 0); // len > 0 . self.check_cmp(cx, actual_span, right, left, "", 1); // 1 > len -- line 168 ---------------------------------------- -- line 171 ---------------------------------------- . self.check_cmp(cx, actual_span, left, right, "", 1); // len < 1 . self.check_cmp(cx, actual_span, right, left, "!", 0); // 0 < len . }, . BinOpKind::Ge => self.check_cmp(cx, actual_span, left, right, "!", 1), // len >= 1 . BinOpKind::Le => self.check_cmp(cx, actual_span, right, left, "!", 1), // 1 <= len . _ => (), . } . } 3,145,784 ( 0.02%) } . } . . impl LenZero { 18 ( 0.00%) fn check_cmp( . &self, . cx: &LateContext<'_>, . span: Span, . method: &Expr<'_>, . lit: &Expr<'_>, . op: &str, . compare_to: u32, . ) { 4 ( 0.00%) if method.span.from_expansion() { . return; . } . 10 ( 0.00%) if let (&ExprKind::MethodCall(method_path, receiver, [], _), ExprKind::Lit(lit)) = (&method.kind, &lit.kind) { . // check if we are in an is_empty() method 5 ( 0.00%) if parent_item_name(cx, method) == Some(sym::is_empty) { 182 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::parent_item_name (1x) . return; . } . 4 ( 0.00%) self.check_len(cx, span, method_path.ident.name, receiver, &lit.node, op, compare_to); . } else { 8 ( 0.00%) self.check_empty_expr(cx, span, method, lit, op); 27 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/len_zero.rs:::check_empty_expr (1x) . } 8 ( 0.00%) } . . #[expect(clippy::too_many_arguments)] . fn check_len( . &self, . cx: &LateContext<'_>, . span: Span, . method_name: Symbol, . receiver: &Expr<'_>, . lit: &LitKind, . op: &str, . compare_to: u32, . ) { 6 ( 0.00%) if let LitKind::Int(lit, _) = *lit { . // check if length is compared to the specified number . if lit != u128::from(compare_to) { . return; . } . . if method_name == sym::len && has_is_empty(cx, receiver, self.msrv) { . let mut applicability = Applicability::MachineApplicable; . span_lint_and_sugg( -- line 227 ---------------------------------------- -- line 235 ---------------------------------------- . snippet_with_context(cx, receiver.span, span.ctxt(), "_", &mut applicability).0, . ), . applicability, . ); . } . } . } . 14 ( 0.00%) fn check_empty_expr(&self, cx: &LateContext<'_>, span: Span, lit1: &Expr<'_>, lit2: &Expr<'_>, op: &str) { . if (is_empty_array(lit2) || is_empty_string(lit2)) && has_is_empty(cx, lit1, self.msrv) { . let mut applicability = Applicability::MachineApplicable; . . let lit1 = peel_ref_operators(cx, lit1); . let lit_str = Sugg::hir_with_context(cx, lit1, span.ctxt(), "_", &mut applicability).maybe_paren(); . . span_lint_and_sugg( . cx, -- line 251 ---------------------------------------- -- line 252 ---------------------------------------- . COMPARISON_TO_EMPTY, . span, . "comparison to empty slice", . format!("using `{op}is_empty` is clearer and more explicit"), . format!("{op}{lit_str}.is_empty()"), . applicability, . ); . } 8 ( 0.00%) } . } . . fn span_without_enclosing_paren(cx: &LateContext<'_>, span: Span) -> Span { 7 ( 0.00%) let Some(snippet) = span.get_text(cx) else { . return span; . }; 3 ( 0.00%) if has_enclosing_paren(snippet) { 48 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/sugg.rs:clippy_utils::sugg::has_enclosing_paren:: (1x) . let source_map = cx.tcx.sess.source_map(); . let left_paren = source_map.start_point(span); . let right_parent = source_map.end_point(span); . left_paren.between(right_parent) . } else { . span . } . } . . fn is_empty_string(expr: &Expr<'_>) -> bool { 2 ( 0.00%) if let ExprKind::Lit(lit) = expr.kind . && let LitKind::Str(lit, _) = lit.node . { . let lit = lit.as_str(); . return lit.is_empty(); . } . false . } . . fn is_empty_array(expr: &Expr<'_>) -> bool { 3 ( 0.00%) if let ExprKind::Array(arr) = expr.kind { . return arr.is_empty(); . } . false . } . . /// Checks if this type has an `is_empty` method. . fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: Msrv) -> bool { . /// Gets an `AssocItem` and return true if it matches `is_empty(self)`. -- line 296 ---------------------------------------- 19 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs -------------------------------------------------------------------------------- Ir -- line 446 ---------------------------------------- . #[stable(feature = "nonnull", since = "1.25.0")] . #[rustc_const_stable(feature = "const_nonnull_as_ref", since = "1.73.0")] . #[must_use] . #[inline(always)] . pub const unsafe fn as_ref<'a>(&self) -> &'a T { . // SAFETY: the caller must guarantee that `self` meets all the . // requirements for a reference. . // `cast_const` avoids a mutable raw pointer deref. 4,451,266 ( 0.02%) unsafe { &*self.as_ptr().cast_const() } . } . . /// Returns a unique reference to the value. If the value may be uninitialized, [`as_uninit_mut`] . /// must be used instead. . /// . /// For the shared counterpart see [`as_ref`]. . /// . /// [`as_uninit_mut`]: NonNull::as_uninit_mut -- line 462 ---------------------------------------- -- line 619 ---------------------------------------- . pub const unsafe fn add(self, count: usize) -> Self . where . T: Sized, . { . // SAFETY: the caller must uphold the safety contract for `offset`. . // Additionally safety contract of `offset` guarantees that the resulting pointer is . // pointing to an allocation, there can't be an allocation at null, thus it's safe to . // construct `NonNull`. 393,403 ( 0.00%) unsafe { transmute(intrinsics::offset(self.as_ptr(), count)) } . } . . /// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`). . /// . /// `count` is in units of bytes. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [`add`][NonNull::add] on it. See that method for documentation -- line 635 ---------------------------------------- -- line 1655 ---------------------------------------- . #[stable(feature = "nonnull", since = "1.25.0")] . impl Eq for NonNull {} . . #[stable(feature = "nonnull", since = "1.25.0")] . impl PartialEq for NonNull { . #[inline] . #[allow(ambiguous_wide_pointer_comparisons)] . fn eq(&self, other: &Self) -> bool { 32,344,305 ( 0.16%) self.as_ptr() == other.as_ptr() . } . } . . #[stable(feature = "nonnull", since = "1.25.0")] . impl Ord for NonNull { . #[inline] . #[allow(ambiguous_wide_pointer_comparisons)] . fn cmp(&self, other: &Self) -> Ordering { -- line 1671 ---------------------------------------- 176 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_resolve/src/rustdoc.rs -------------------------------------------------------------------------------- Ir -- line 199 ---------------------------------------- . . pub fn attrs_to_doc_fragments<'a, A: AttributeExt + Clone + 'a>( . attrs: impl Iterator)>, . doc_only: bool, . ) -> (Vec, ThinVec) { . let (min_size, max_size) = attrs.size_hint(); . let size_hint = max_size.unwrap_or(min_size); . let mut doc_fragments = Vec::with_capacity(size_hint); 786,460 ( 0.00%) let mut other_attrs = ThinVec::::with_capacity(if doc_only { 0 } else { size_hint }); . for (attr, item_id) in attrs { . if let Some((doc_str, fragment_kind)) = attr.doc_str_and_fragment_kind() { . let doc = beautify_doc_string(doc_str, fragment_kind.comment_kind()); . let attr_span = attr.span(); . let (span, from_expansion) = match fragment_kind { . DocFragmentKind::Sugared(_) => (attr_span, attr_span.from_expansion()), . DocFragmentKind::Raw(value_span) => { . (value_span.with_ctxt(attr_span.ctxt()), value_span.from_expansion()) -- line 215 ---------------------------------------- -- line 221 ---------------------------------------- . } else if !doc_only { . other_attrs.push(attr.clone()); . } . } . . doc_fragments.shrink_to_fit(); . other_attrs.shrink_to_fit(); . 393,229 ( 0.00%) unindent_doc_fragments(&mut doc_fragments); 8,651,038 ( 0.04%) => ???:rustc_resolve::rustdoc::unindent_doc_fragments (393,229x) . 2,359,374 ( 0.01%) (doc_fragments, other_attrs) . } . . /// Return the doc-comments on this item, grouped by the module they came from. . /// The module can be different if this is a re-export with added documentation. . /// . /// The last newline is not trimmed so the produced strings are reusable between . /// early and late doc link resolution regardless of their position. . pub fn prepare_to_doc_link_resolution( -- line 239 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/misc_early/mod.rs -------------------------------------------------------------------------------- Ir -- line 310 ---------------------------------------- . SEPARATED_LITERAL_SUFFIX, . UNNEEDED_FIELD_PATTERN, . UNNEEDED_WILDCARD_PATTERN, . UNSEPARATED_LITERAL_SUFFIX, . ZERO_PREFIXED_LITERAL, . ]); . . impl EarlyLintPass for MiscEarlyLints { 7 ( 0.00%) fn check_generics(&mut self, cx: &EarlyContext<'_>, generics: &Generics) { . for param in &generics.params { . builtin_type_shadow::check(cx, param); . } 8 ( 0.00%) } . . fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat) { . unneeded_field_pattern::check(cx, pat); . redundant_pattern::check(cx, pat); . redundant_at_rest_pattern::check(cx, pat); . unneeded_wildcard_pattern::check(cx, pat); . } . 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { . // `check_lit` only lints integer literals and suffixed float literals. 1,310,728 ( 0.01%) if let ExprKind::Lit(lit) = expr.kind 851,960 ( 0.00%) && match lit.kind { . token::LitKind::Integer => true, . token::LitKind::Float => lit.suffix.is_some(), . _ => false, . } 196,611 ( 0.00%) && !expr.span.in_external_macro(cx.sess().source_map()) . { . MiscEarlyLints::check_lit(cx, lit, expr.span); . } 3,145,768 ( 0.02%) } . } . . impl MiscEarlyLints { . fn check_lit(cx: &EarlyContext<'_>, lit: token::Lit, span: Span) { . // We test if first character in snippet is a number, because the snippet could be an expansion . // from a built-in macro like `line!()` or a proc-macro like `#[wasm_bindgen]`. . // Note that this check also covers special case that `line!()` is eagerly expanded by compiler. . // See for a regression. . // FIXME: Find a better way to detect those cases. 131,074 ( 0.00%) let lit_snip = match snippet_opt(cx, span) { 65,537 ( 0.00%) Some(snip) if snip.starts_with(|c: char| c.is_ascii_digit()) => snip, . _ => return, . }; . 65,537 ( 0.00%) let lit_kind = LitKind::from_token_lit(lit); 17,113,754 ( 0.08%) => ???:::from_token_lit (65,537x) 393,222 ( 0.00%) if let Ok(LitKind::Int(value, lit_int_type)) = lit_kind { 262,148 ( 0.00%) let suffix = match lit_int_type { . LitIntType::Signed(ty) => ty.name_str(), . LitIntType::Unsigned(ty) => ty.name_str(), . LitIntType::Unsuffixed => "", . }; 655,370 ( 0.00%) literal_suffix::check(cx, span, &lit_snip, suffix, "integer"); 1,769,499 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/misc_early/literal_suffix.rs:clippy_lints::misc_early::literal_suffix::check (65,537x) 65,536 ( 0.00%) if lit_snip.starts_with("0x") { 16 ( 0.00%) mixed_case_hex_literals::check(cx, span, suffix, &lit_snip); 208 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/misc_early/mixed_case_hex_literals.rs:clippy_lints::misc_early::mixed_case_hex_literals::check (2x) 327,674 ( 0.00%) } else if lit_snip.starts_with("0b") || lit_snip.starts_with("0o") { . // nothing to do 65,535 ( 0.00%) } else if value != 0 && lit_snip.starts_with('0') { . zero_prefixed_literal::check(cx, span, &lit_snip); . } . } else if let Ok(LitKind::Float(_, LitFloatType::Suffixed(float_ty))) = lit_kind { . let suffix = float_ty.name_str(); . literal_suffix::check(cx, span, &lit_snip, suffix, "float"); . } . } . } -- line 378 ---------------------------------------- 1,114,122 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/partialeq_to_none.rs -------------------------------------------------------------------------------- Ir -- line 36 ---------------------------------------- . pub PARTIALEQ_TO_NONE, . style, . "Binary comparison to `Option::None` relies on `T: PartialEq`, which is unneeded" . } . . declare_lint_pass!(PartialeqToNone => [PARTIALEQ_TO_NONE]); . . impl<'tcx> LateLintPass<'tcx> for PartialeqToNone { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { . // Skip expanded code, as we have no control over it anyway... 786,446 ( 0.00%) if e.span.from_expansion() { . return; . } . . // If the expression is of type `Option` . let is_ty_option = |expr: &Expr<'_>| { . cx.typeck_results() . .expr_ty(expr) . .peel_refs() . .is_diag_item(cx, sym::Option) . }; . . // If the expression is a literal `Option::None` . let is_none_ctor = 14 ( 0.00%) |expr: &Expr<'_>| !expr.span.from_expansion() && is_none_expr(cx, peel_hir_expr_refs(expr).0); 44 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/res.rs:clippy_utils::is_none_expr (2x) 10 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::peel_hir_expr_refs (2x) . 393,218 ( 0.00%) let mut applicability = Applicability::MachineApplicable; . 786,440 ( 0.00%) if let ExprKind::Binary(op, left_side, right_side) = e.kind { . // All other comparisons (e.g. `>= None`) have special meaning wrt T 1 ( 0.00%) let is_eq = match op.node { . BinOpKind::Eq => true, . BinOpKind::Ne => false, . _ => return, . }; . . // We are only interested in comparisons between `Option` and a literal `Option::None` 2 ( 0.00%) let scrutinee = match ( 2 ( 0.00%) is_none_ctor(left_side) && is_ty_option(right_side), 2 ( 0.00%) is_none_ctor(right_side) && is_ty_option(left_side), . ) { . (true, false) => right_side, . (false, true) => left_side, . _ => return, . }; . . // Peel away refs/derefs (as long as we don't cross manual deref impls), as . // autoref/autoderef will take care of those -- line 83 ---------------------------------------- -- line 97 ---------------------------------------- . "use `Option::is_none()` instead" . } else { . "use `Option::is_some()` instead" . }, . sugg, . applicability, . ); . } 3,145,784 ( 0.02%) } . } 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/drop_forget_ref.rs -------------------------------------------------------------------------------- Ir -- line 73 ---------------------------------------- . declare_lint_pass!(DropForgetRef => [DROP_NON_DROP, FORGET_NON_DROP, MEM_FORGET]); . . const DROP_NON_DROP_SUMMARY: &str = "call to `std::mem::drop` with a value that does not implement `Drop`. \ . Dropping such a type only extends its contained lifetimes"; . const FORGET_NON_DROP_SUMMARY: &str = "call to `std::mem::forget` with a value that does not implement `Drop`. \ . Forgetting such a type is the same as dropping it"; . . impl<'tcx> LateLintPass<'tcx> for DropForgetRef { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::Call(path, [arg]) = expr.kind 3 ( 0.00%) && let ExprKind::Path(ref qpath) = path.kind 4 ( 0.00%) && let Some(def_id) = cx.qpath_res(qpath, path.hir_id).opt_def_id() 23 ( 0.00%) => ???:::qpath_res (1x) 5 ( 0.00%) && let Some(fn_name) = cx.tcx.get_diagnostic_name(def_id) 80 ( 0.00%) => ???:::get_diagnostic_name (1x) . { . let arg_ty = cx.typeck_results().expr_ty(arg); . let is_copy = is_copy(cx, arg_ty); . let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); . let (lint, msg, note_span) = match fn_name { . // early return for uplifted lints: dropping_references, dropping_copy_types, forgetting_references, . // forgetting_copy_types . sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, -- line 93 ---------------------------------------- -- line 127 ---------------------------------------- . let note = format!("argument has type `{arg_ty}`"); . if let Some(span) = note_span { . diag.span_note(span, note); . } else { . diag.note(note); . } . }); . } 3,145,784 ( 0.02%) } . } . . // dropping returned value of a function like in the following snippet is considered idiomatic, see . // #9482 for examples match { . // => drop(fn_with_side_effect_and_returning_some_value()), . // .. . // } . fn is_single_call_in_arm<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'_>, drop_expr: &'tcx Expr<'_>) -> bool { -- line 143 ---------------------------------------- 3 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/await_holding_invalid.rs -------------------------------------------------------------------------------- Ir -- line 178 ---------------------------------------- . AWAIT_HOLDING_REFCELL_REF, . ]); . . pub struct AwaitHolding { . def_ids: DefIdMap<(&'static str, &'static DisallowedPathWithoutReplacement)>, . } . . impl AwaitHolding { 8 ( 0.00%) pub(crate) fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { . let (def_ids, _) = create_disallowed_map( . tcx, . &conf.await_holding_invalid_types, . PathNS::Type, . crate::disallowed_types::def_kind_predicate, . "type", . false, . ); . Self { def_ids } 8 ( 0.00%) } . } . . impl<'tcx> LateLintPass<'tcx> for AwaitHolding { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { 786,446 ( 0.00%) if let hir::ExprKind::Closure(hir::Closure { . kind: hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _)), . def_id, . .. . }) = expr.kind . && let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(*def_id) . { . self.check_interior_types(cx, coroutine_layout); . } 3,145,784 ( 0.02%) } . } . . impl AwaitHolding { . fn check_interior_types(&self, cx: &LateContext<'_>, coroutine: &CoroutineLayout<'_>) { . for (ty_index, ty_cause) in coroutine.field_tys.iter_enumerated() { . if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() { . let await_points = || { . coroutine -- line 218 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/dereference.rs -------------------------------------------------------------------------------- Ir -- line 146 ---------------------------------------- . . impl_lint_pass!(Dereferencing<'_> => [ . EXPLICIT_AUTO_DEREF, . EXPLICIT_DEREF_METHODS, . NEEDLESS_BORROW, . REF_BINDING_TO_REFERENCE, . ]); . 11 ( 0.00%) #[derive(Default)] . pub struct Dereferencing<'tcx> { . state: Option<(State, StateData<'tcx>)>, . . // While parsing a `deref` method call in ufcs form, the path to the function is itself an . // expression. This is to store the id of that expression so it can be skipped when . // `check_expr` is called for it. . skip_expr: Option, . -- line 162 ---------------------------------------- -- line 235 ---------------------------------------- . /// All the replacements which need to be made. . replacements: Vec<(Span, String)>, . /// The [`HirId`] that the lint should be emitted at. . hir_id: HirId, . } . . impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> { . #[expect(clippy::too_many_lines)] 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // Skip path expressions from deref calls. e.g. `Deref::deref(e)` 786,446 ( 0.00%) if Some(expr.hir_id) == self.skip_expr.take() { . return; . } . . if let Some(local) = expr.res_local_id() { . self.check_local_usage(cx, expr, local); . } . . // Stop processing sub expressions when a macro call is seen 786,446 ( 0.00%) if expr.span.from_expansion() { 10 ( 0.00%) if let Some((state, data)) = self.state.take() { . self.report(cx, expr, state, data, cx.typeck_results()); . } . return; . } . . let typeck = cx.typeck_results(); . let Some((kind, sub_expr, skip_expr)) = try_parse_ref_op(cx.tcx, typeck, expr) else { . // The whole chain of reference operations has been seen 786,436 ( 0.00%) if let Some((state, data)) = self.state.take() { . self.report(cx, expr, state, data, typeck); . } . return; . }; . self.skip_expr = skip_expr; . . if is_from_proc_macro(cx, expr) { . if let Some((state, data)) = self.state.take() { -- line 272 ---------------------------------------- -- line 642 ---------------------------------------- . derefs_manually_drop: derefs_manually_drop || is_manually_drop(sub_expr_ty), . }, . data, . )); . }, . . (Some((state, data)), _) => self.report(cx, expr, state, data, typeck), . } 3,145,784 ( 0.02%) } . . fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) { . if let PatKind::Binding(BindingMode::REF, id, name, _) = pat.kind { . if let Some(opt_prev_pat) = self.ref_locals.get_mut(&id) { . // This binding id has been seen before. Add this pattern to the list of changes. . if let Some(prev_pat) = opt_prev_pat { . if pat.span.from_expansion() { . // Doesn't match the context of the previous pattern. Can't lint here. -- line 658 ---------------------------------------- -- line 687 ---------------------------------------- . replacements: vec![(pat.span, snip.into())], . hir_id: pat.hir_id, . }), . ); . } . } . } . 21 ( 0.00%) fn check_body_post(&mut self, cx: &LateContext<'tcx>, body: &Body<'_>) { . if Some(body.id()) == self.current_body { . for pat in self.ref_locals.drain(..).filter_map(|(_, x)| x) { . let replacements = pat.replacements; . let app = pat.app; . let lint = if pat.always_deref { . NEEDLESS_BORROW . } else { . REF_BINDING_TO_REFERENCE -- line 703 ---------------------------------------- -- line 710 ---------------------------------------- . "this pattern creates a reference to a reference", . |diag| { . diag.multipart_suggestion("try", replacements, app); . }, . ); . } . self.current_body = None; . } 24 ( 0.00%) } . . fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { . // Only check for `impl Deref(Mut)`s if we're not already in one 8 ( 0.00%) if !self.in_deref_impl() && is_deref_or_derefmut_impl(cx, item) { . self.outermost_deref_impl = Some(item.owner_id); . } . } . . fn check_item_post(&mut self, _cx: &LateContext<'_>, item: &Item<'_>) { . // Only clear `self.outermost_deref_impl` if we're escaping the _outermost_ `impl Deref(Mut)` . if self.outermost_deref_impl == Some(item.owner_id) { . self.outermost_deref_impl = None; . } . } . } . . fn is_deref_or_derefmut_impl(cx: &LateContext<'_>, item: &Item<'_>) -> bool { 16 ( 0.00%) if let hir::ItemKind::Impl(impl_) = item.kind . && let Some(of_trait) = impl_.of_trait . && let Some(trait_id) = of_trait.trait_ref.trait_def_id() . { . cx.tcx.lang_items().deref_trait() == Some(trait_id) || cx.tcx.lang_items().deref_mut_trait() == Some(trait_id) . } else { . false . } . } . . fn try_parse_ref_op<'tcx>( . tcx: TyCtxt<'tcx>, . typeck: &'tcx TypeckResults<'_>, . expr: &'tcx Expr<'_>, . ) -> Option<(RefOp, &'tcx Expr<'tcx>, Option)> { 2,359,305 ( 0.01%) let (call_path_id, def_id, arg) = match expr.kind { 12 ( 0.00%) ExprKind::MethodCall(_, arg, [], _) => (None, typeck.type_dependent_def_id(expr.hir_id)?, arg), 51 ( 0.00%) => ???:::type_dependent_def_id (1x) . ExprKind::Call( . &Expr { . kind: ExprKind::Path(QPath::Resolved(None, path)), . hir_id, . .. . }, . [arg], . ) => (Some(hir_id), path.res.opt_def_id()?, arg), -- line 760 ---------------------------------------- -- line 761 ---------------------------------------- . ExprKind::Unary(UnOp::Deref, sub_expr) if !typeck.expr_ty(sub_expr).is_raw_ptr() => { . return Some((RefOp::Deref, sub_expr, None)); . }, . ExprKind::AddrOf(BorrowKind::Ref, mutability, sub_expr) => { . return Some((RefOp::AddrOf(mutability), sub_expr, None)); . }, . _ => return None, . }; 9 ( 0.00%) let mutbl = match tcx.get_diagnostic_name(def_id) { 80 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::deref_method) => Mutability::Not, . Some(sym::deref_mut_method) => Mutability::Mut, . _ => return None, . }; . Some(( . RefOp::Method { . mutbl, . is_ufcs: call_path_id.is_some(), -- line 777 ---------------------------------------- 786,443 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/formatting.rs -------------------------------------------------------------------------------- Ir -- line 141 ---------------------------------------- . POSSIBLE_MISSING_COMMA, . POSSIBLE_MISSING_ELSE, . SUSPICIOUS_ASSIGNMENT_FORMATTING, . SUSPICIOUS_ELSE_FORMATTING, . SUSPICIOUS_UNARY_OP_FORMATTING, . ]); . . impl EarlyLintPass for Formatting { 16 ( 0.00%) fn check_block(&mut self, cx: &EarlyContext<'_>, block: &Block) { . for w in block.stmts.windows(2) { . if let (StmtKind::Expr(first), StmtKind::Expr(second) | StmtKind::Semi(second)) = (&w[0].kind, &w[1].kind) { . check_missing_else(cx, first, second); . } . } 16 ( 0.00%) } . 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { . check_assign(cx, expr); . check_unop(cx, expr); . check_else(cx, expr); . check_array(cx, expr); 3,145,768 ( 0.02%) } . } . . /// Implementation of the `SUSPICIOUS_ASSIGNMENT_FORMATTING` lint. . fn check_assign(cx: &EarlyContext<'_>, expr: &Expr) { 1,179,663 ( 0.01%) if let ExprKind::Assign(ref lhs, ref rhs, _) = expr.kind . && !lhs.span.from_expansion() . && !rhs.span.from_expansion() . { . let eq_span = lhs.span.between(rhs.span); . if let ExprKind::Unary(op, ref sub_rhs) = rhs.kind . && let Some(eq_snippet) = snippet_opt(cx, eq_span) . { . let op = op.as_str(); -- line 175 ---------------------------------------- -- line 188 ---------------------------------------- . ); . } . } . } . } . . /// Implementation of the `SUSPICIOUS_UNARY_OP_FORMATTING` lint. . fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if let ExprKind::Binary(ref binop, ref lhs, ref rhs) = expr.kind 6 ( 0.00%) && !lhs.span.from_expansion() && !rhs.span.from_expansion() . // span between BinOp LHS and RHS 4 ( 0.00%) && let binop_span = lhs.span.between(rhs.span) 107 ( 0.00%) => ???:::between (1x) . // if RHS is an UnOp 2 ( 0.00%) && let ExprKind::Unary(op, ref un_rhs) = rhs.kind . // from UnOp operator to UnOp operand . && let unop_operand_span = rhs.span.until(un_rhs.span) . && let Some(binop_snippet) = snippet_opt(cx, binop_span) . && let Some(unop_operand_snippet) = snippet_opt(cx, unop_operand_span) . && let binop_str = binop.node.as_str() . // no space after BinOp operator and space after UnOp operator . && binop_snippet.ends_with(binop_str) && unop_operand_snippet.ends_with(' ') . { -- line 209 ---------------------------------------- -- line 220 ---------------------------------------- . None, . format!("put a space between `{binop_str}` and `{unop_str}` and remove the space after `{unop_str}`"), . ); . } . } . . /// Implementation of the `SUSPICIOUS_ELSE_FORMATTING` lint for weird `else`. . fn check_else(cx: &EarlyContext<'_>, expr: &Expr) { 786,443 ( 0.00%) if let ExprKind::If(_, then, Some(else_)) = &expr.kind . && (is_block(else_) || is_if(else_)) . && !then.span.from_expansion() && !else_.span.from_expansion() . && !expr.span.in_external_macro(cx.sess().source_map()) . . // workaround for rust-lang/rust#43081 . && expr.span.lo().0 != 0 && expr.span.hi().0 != 0 . . // this will be a span from the closing ‘}’ of the “then” block (excluding) to -- line 236 ---------------------------------------- -- line 282 ---------------------------------------- . } . . fn indentation(cx: &EarlyContext<'_>, span: Span) -> usize { . cx.sess().source_map().lookup_char_pos(span.lo()).col.0 . } . . /// Implementation of the `POSSIBLE_MISSING_COMMA` lint for array . fn check_array(cx: &EarlyContext<'_>, expr: &Expr) { 786,438 ( 0.00%) if let ExprKind::Array(ref array) = expr.kind { . for element in array { 196,605 ( 0.00%) if let ExprKind::Binary(ref op, ref lhs, _) = element.kind . && has_unary_equivalent(op.node) . && lhs.span.eq_ctxt(op.span) . && let space_span = lhs.span.between(op.span) . && let Some(space_snippet) = snippet_opt(cx, space_span) . && let lint_span = lhs.span.with_lo(lhs.span.hi()) . && space_snippet.contains('\n') . && indentation(cx, op.span) <= indentation(cx, lhs.span) . { -- line 300 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/transmute/mod.rs -------------------------------------------------------------------------------- Ir -- line 518 ---------------------------------------- . Sugg::NonParen(format!("{}.{}", outer_sugg.maybe_paren(), first.name).into()), . ) . } else { . (outer_type, outer_sugg) . } . } . } . impl<'tcx> LateLintPass<'tcx> for Transmute { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::Call(path_expr, [arg]) = e.kind 7 ( 0.00%) && let ExprKind::Path(QPath::Resolved(None, path)) = path_expr.kind . && let Some(def_id) = path.res.opt_def_id() 7 ( 0.00%) && cx.tcx.is_diagnostic_item(sym::transmute, def_id) 100 ( 0.00%) => ???:::is_diagnostic_item (1x) . { . // Avoid suggesting non-const operations in const contexts: . // - from/to bits (https://github.com/rust-lang/rust/issues/73736) . // - dereferencing raw pointers (https://github.com/rust-lang/rust/issues/51911) . // - char conversions (https://github.com/rust-lang/rust/issues/89259) . let const_context = is_in_const_context(cx); . . let (from_ty, from_ty_adjusted) = match cx.typeck_results().expr_adjustments(arg) { -- line 538 ---------------------------------------- -- line 563 ---------------------------------------- . | (unsound_collection_transmute::check(cx, e, from_ty, to_ty) . || transmute_undefined_repr::check(cx, e, from_ty, to_ty)) . | (eager_transmute::check(cx, e, arg, from_ty, to_ty)); . . if !linted { . transmutes_expressible_as_ptr_casts::check(cx, e, from_ty, from_ty_adjusted, to_ty, arg, const_context); . } . } 3,145,784 ( 0.02%) } . } 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs -------------------------------------------------------------------------------- Ir -- line 67 ---------------------------------------- . . #[derive(Default)] . pub struct SuspiciousOperationGroupings { . // Spans already linted. . linted_spans: FxHashSet, . } . . impl EarlyLintPass for SuspiciousOperationGroupings { 3,538,989 ( 0.02%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if expr.span.from_expansion() { . return; . } . 1,179,651 ( 0.01%) if let Some(binops) = extract_related_binops(&expr.kind) { . check_binops(cx, &binops.iter().collect::>(), &mut self.linted_spans); . . let mut op_types = Vec::with_capacity(binops.len()); . // We could use a hashmap, etc. to avoid being O(n*m) here, but . // we want the lints to be emitted in a consistent order. Besides, . // m, (the number of distinct `BinOpKind`s in `binops`) . // will often be small, and does have an upper limit. . binops.iter().map(|b| b.op).for_each(|op| { -- line 88 ---------------------------------------- -- line 92 ---------------------------------------- . }); . . for op_type in op_types { . let ops: Vec<_> = binops.iter().filter(|b| b.op == op_type).collect(); . . check_binops(cx, &ops, &mut self.linted_spans); . } . } 3,145,768 ( 0.02%) } . } . . fn check_binops(cx: &EarlyContext<'_>, binops: &[&BinaryOp<'_>], linted_spans: &mut FxHashSet) { . let binop_count = binops.len(); . if binop_count < 2 { . // Single binary operation expressions would likely be false . // positives. . return; -- line 108 ---------------------------------------- -- line 356 ---------------------------------------- . _ => { . return output; . }, . }; . } . } . . fn extract_related_binops(kind: &ExprKind) -> Option>> { 1,179,651 ( 0.01%) append_opt_vecs(chained_binops(kind), if_statement_binops(kind)) 9,437,208 ( 0.05%) => site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:clippy_lints::suspicious_operation_groupings::if_statement_binops (393,217x) 8,650,774 ( 0.04%) => site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:clippy_lints::suspicious_operation_groupings::append_opt_vecs:: (393,217x) . } . 2,752,519 ( 0.01%) fn if_statement_binops(kind: &ExprKind) -> Option>> { 2,752,519 ( 0.01%) match kind { . ExprKind::If(condition, _, _) => chained_binops(&condition.kind), . ExprKind::Paren(e) => if_statement_binops(&e.kind), . ExprKind::Block(block, _) => { . let mut output = None; . for stmt in &block.stmts { . match &stmt.kind { . StmtKind::Expr(e) | StmtKind::Semi(e) => { . output = append_opt_vecs(output, if_statement_binops(&e.kind)); -- line 376 ---------------------------------------- -- line 377 ---------------------------------------- . }, . _ => {}, . } . } . output . }, . _ => None, . } 3,145,736 ( 0.02%) } . 2,752,519 ( 0.01%) fn append_opt_vecs(target_opt: Option>, source_opt: Option>) -> Option> { 1,966,085 ( 0.01%) match (target_opt, source_opt) { . (Some(mut target), Some(source)) => { . target.reserve(source.len()); . for op in source { . target.push(op); . } . Some(target) . }, . (Some(v), None) | (None, Some(v)) => Some(v), 786,434 ( 0.00%) (None, None) => None, . } 3,145,736 ( 0.02%) } . . fn chained_binops(kind: &ExprKind) -> Option>> { 2,752,519 ( 0.01%) match kind { 6 ( 0.00%) ExprKind::Binary(_, left_outer, right_outer) => chained_binops_helper(left_outer, right_outer), 31 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/suspicious_operation_groupings.rs:clippy_lints::suspicious_operation_groupings::chained_binops_helper (1x) . ExprKind::Paren(e) | ExprKind::Unary(_, e) => chained_binops(&e.kind), 393,216 ( 0.00%) _ => None, . } . } . 10 ( 0.00%) fn chained_binops_helper<'expr>(left_outer: &'expr Expr, right_outer: &'expr Expr) -> Option>> { 7 ( 0.00%) match (&left_outer.kind, &right_outer.kind) { . ( . ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e), . ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e), . ) => chained_binops_helper(left_e, right_e), . (ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e), _) => chained_binops_helper(left_e, right_outer), . (_, ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e)) => chained_binops_helper(left_outer, right_e), . ( . ExprKind::Binary(Spanned { node: left_op, .. }, left_left, left_right), -- line 418 ---------------------------------------- -- line 436 ---------------------------------------- . right_ops.insert(0, BinaryOp::new(*left_op, left_outer.span, (left_left, left_right))); . Some(right_ops) . }, . (None, None) => Some(vec![ . BinaryOp::new(*left_op, left_outer.span, (left_left, left_right)), . BinaryOp::new(*right_op, right_outer.span, (right_left, right_right)), . ]), . }, 1 ( 0.00%) _ => None, . } 8 ( 0.00%) } . . #[derive(Clone, Copy, PartialEq, Eq, Default, Debug)] . struct IdentLocation { . index: usize, . } . . impl Add for IdentLocation { . type Output = IdentLocation; -- line 454 ---------------------------------------- 2,359,309 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_different_sizes.rs -------------------------------------------------------------------------------- Ir -- line 4 ---------------------------------------- . use rustc_ast::Mutability; . use rustc_hir::{Expr, ExprKind, Node}; . use rustc_lint::LateContext; . use rustc_middle::ty::layout::LayoutOf as _; . use rustc_middle::ty::{self, Ty, TypeAndMut}; . . use super::CAST_SLICE_DIFFERENT_SIZES; . 4,325,453 ( 0.02%) pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: Msrv) { . // if this cast is the child of another cast expression then don't emit something for it, the full . // chain will be analyzed 1,572,888 ( 0.01%) if is_child_of_cast(cx, expr) { . return; . } . 393,223 ( 0.00%) if let Some(CastChainInfo { . left_cast, . start_ty, . end_ty, 1,966,115 ( 0.01%) }) = expr_cast_chain_tys(cx, expr) 9,437,362 ( 0.05%) => site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_different_sizes.rs:clippy_lints::casts::cast_slice_different_sizes::expr_cast_chain_tys (393,223x) . && let (Ok(from_layout), Ok(to_layout)) = (cx.layout_of(start_ty.ty), cx.layout_of(end_ty.ty)) . { . let from_size = from_layout.size.bytes(); . let to_size = to_layout.size.bytes(); . if from_size != to_size . && from_size != 0 . && to_size != 0 . && msrv.meets(cx, msrvs::PTR_SLICE_RAW_PARTS) -- line 31 ---------------------------------------- -- line 58 ---------------------------------------- . format!("replace with `ptr::slice_from_raw_parts{mutbl_fn_str}`"), . sugg, . rustc_errors::Applicability::HasPlaceholders, . ); . }, . ); . } . } 3,145,784 ( 0.02%) } . . fn is_child_of_cast(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { 786,446 ( 0.00%) let parent = cx.tcx.parent_hir_node(expr.hir_id); 42,468,084 ( 0.21%) => ???:::parent_hir_node (393,223x) 1,966,113 ( 0.01%) let expr = match parent { 1 ( 0.00%) Node::Block(block) => { 3 ( 0.00%) if let Some(parent_expr) = block.expr { . parent_expr . } else { . return false; . } . }, 786,436 ( 0.00%) Node::Expr(expr) => expr, . _ => return false, . }; . 393,219 ( 0.00%) matches!(expr.kind, ExprKind::Cast(..)) . } . . /// Returns the type T of the pointed to *const [T] or *mut [T] and the mutability of the slice if . /// the type is one of those slices . fn get_raw_slice_ty_mut(ty: Ty<'_>) -> Option> { . match ty.kind() { . ty::RawPtr(slice_ty, mutbl) => match slice_ty.kind() { . ty::Slice(ty) => Some(TypeAndMut { ty: *ty, mutbl: *mutbl }), -- line 90 ---------------------------------------- -- line 102 ---------------------------------------- . start_ty: TypeAndMut<'tcx>, . /// The final type of the cast chain . end_ty: TypeAndMut<'tcx>, . } . . /// Returns a `CastChainInfo` with the left-most cast in the chain and the original ptr T and final . /// ptr U if the expression is composed of casts. . /// Returns None if the expr is not a Cast 3,145,784 ( 0.02%) fn expr_cast_chain_tys<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> Option> { 393,223 ( 0.00%) if let ExprKind::Cast(cast_expr, _cast_to_hir_ty) = expr.peel_blocks().kind { . let cast_to = cx.typeck_results().expr_ty(expr); . let to_slice_ty = get_raw_slice_ty_mut(cast_to)?; . . // If the expression that makes up the source of this cast is itself a cast, recursively . // call `expr_cast_chain_tys` and update the end type with the final target type. . // Otherwise, this cast is not immediately nested, just construct the info for this cast . if let Some(prev_info) = expr_cast_chain_tys(cx, cast_expr) { . Some(CastChainInfo { -- line 119 ---------------------------------------- -- line 125 ---------------------------------------- . let from_slice_ty = get_raw_slice_ty_mut(cast_from)?; . Some(CastChainInfo { . left_cast: cast_expr, . start_ty: from_slice_ty, . end_ty: to_slice_ty, . }) . } . } else { 393,223 ( 0.00%) None . } 3,145,784 ( 0.02%) } 1,179,669 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_cmp.rs -------------------------------------------------------------------------------- Ir . use clippy_utils::diagnostics::span_lint; . use clippy_utils::macros::{find_assert_eq_args, root_macro_call_first_node}; . use clippy_utils::{is_unit_expr, sym}; . use rustc_hir::{BinOpKind, Expr, ExprKind}; . use rustc_lint::LateContext; . . use super::UNIT_CMP; . 3,539,007 ( 0.02%) pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { 7 ( 0.00%) if let Some(macro_call) = root_macro_call_first_node(cx, expr) 7 ( 0.00%) && let Some(diag_name) = cx.tcx.get_diagnostic_name(macro_call.def_id) 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . { . let result = match diag_name { 7 ( 0.00%) sym::assert_eq_macro | sym::debug_assert_eq_macro => "succeed", . sym::assert_ne_macro | sym::debug_assert_ne_macro => "fail", . _ => return, . }; . let Some((lhs, rhs, _)) = find_assert_eq_args(cx, expr, macro_call.expn) else { . return; . }; . if is_unit_expr(lhs) || is_unit_expr(rhs) { . return; -- line 23 ---------------------------------------- -- line 33 ---------------------------------------- . "`{}` of unit values detected. This will always {result}", . cx.tcx.item_name(macro_call.def_id) . ), . ); . } . return; . } . 786,436 ( 0.00%) if let ExprKind::Binary(ref cmp, left, _) = expr.kind { 1 ( 0.00%) let op = cmp.node; 1 ( 0.00%) if op.is_comparison() && cx.typeck_results().expr_ty(left).is_unit() { 40 ( 0.00%) => ???:::expr_ty (1x) . let result = match op { . BinOpKind::Eq | BinOpKind::Le | BinOpKind::Ge => "true", . _ => "false", . }; . span_lint( . cx, . UNIT_CMP, . expr.span, . format!( . "{}-comparison of unit values detected. This will always be {result}", . op.as_str() . ), . ); . } . } 3,145,784 ( 0.02%) } 4 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/string_patterns.rs -------------------------------------------------------------------------------- Ir -- line 222 ---------------------------------------- . ); . } . }, . ); . } . } . . impl<'tcx> LateLintPass<'tcx> for StringPatterns { 2,359,338 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,452 ( 0.00%) if !expr.span.from_expansion() 4 ( 0.00%) && let ExprKind::MethodCall(method, receiver, args, _) = expr.kind 1 ( 0.00%) && let method_name = method.ident.name . && let Some(&(_, pos)) = PATTERN_METHODS . .iter() . .find(|(array_method_name, _)| *array_method_name == method_name) . && let Some(arg) = args.get(pos) . && let ty::Ref(_, ty, _) = cx.typeck_results().expr_ty_adjusted(receiver).kind() . && ty.is_str() . { . check_single_char_pattern_lint(cx, arg); . . check_manual_pattern_char_comparison(cx, arg, self.msrv); . } 2,359,338 ( 0.01%) } . } 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/res.rs -------------------------------------------------------------------------------- Ir -- line 99 ---------------------------------------- . /// use for type dependant lookup. . fn opt_qpath(self) -> Option>; . . /// If this is a path gets its resolution. Returns `Res::Err` otherwise. . #[inline] . #[cfg_attr(debug_assertions, track_caller)] . fn res<'tcx>(self, typeck: &impl MaybeTypeckRes<'tcx>) -> Res { . #[cfg_attr(debug_assertions, track_caller)] 2 ( 0.00%) fn f(qpath: &QPath<'_>, id: HirId, typeck: &TypeckResults<'_>) -> Res { 4 ( 0.00%) match *qpath { 10 ( 0.00%) QPath::Resolved(_, p) => p.res, . QPath::TypeRelative(..) if let Some((kind, id)) = typeck.ty_based_def(id) => Res::Def(kind, id), . QPath::TypeRelative(..) => Res::Err, . } 2 ( 0.00%) } . match self.opt_qpath() { 5 ( 0.00%) Some((qpath, id)) if let Some(typeck) = typeck.typeck_res() => f(qpath, id, typeck), 9 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/res.rs:clippy_utils::res::MaybeQPath::res::f (1x) . _ => Res::Err, . } . } . . /// If this is a path with the specified name as its final segment gets its . /// resolution. Returns `Res::Err` otherwise. . #[inline] . #[cfg_attr(debug_assertions, track_caller)] -- line 123 ---------------------------------------- -- line 285 ---------------------------------------- . #[inline] . fn opt_qpath(self) -> Option> { . Some((self.0, self.1)) . } . } . impl<'tcx> MaybeQPath<'tcx> for &'tcx Expr<'_> { . #[inline] . fn opt_qpath(self) -> Option> { 12 ( 0.00%) match &self.kind { 6 ( 0.00%) ExprKind::Path(qpath) => Some((qpath, self.hir_id)), . _ => None, . } . } . } . impl<'tcx> MaybeQPath<'tcx> for &'tcx PatExpr<'_> { . #[inline] . fn opt_qpath(self) -> Option> { . match &self.kind { -- line 302 ---------------------------------------- -- line 366 ---------------------------------------- . fn basic_res(self) -> &'a Res { . self.opt_res_path().1.map_or(&Res::Err, |p| &p.res) . } . . /// If this node is a path to a local gets the local's `HirId`. . #[inline] . fn res_local_id(self) -> Option { . if let (_, Some(p)) = self.opt_res_path() 14 ( 0.00%) && let Res::Local(id) = p.res . { . Some(id) . } else { . None . } . } . . /// If this node is a path to a local gets the local's `HirId` and identifier. -- line 382 ---------------------------------------- -- line 405 ---------------------------------------- . #[inline] . fn basic_res(self) -> &'a Res { . &self.res . } . } . impl<'a> MaybeResPath<'a> for &QPath<'a> { . #[inline] . fn opt_res_path(self) -> OptResPath<'a> { 4 ( 0.00%) match *self { 8 ( 0.00%) QPath::Resolved(ty, path) => (ty, Some(path)), . QPath::TypeRelative(..) => (None, None), . } . } . . #[inline] . fn opt_ty_rel_path(self) -> OptTyRelPath<'a> { . match *self { . QPath::TypeRelative(ty, seg) => Some((ty, seg)), . QPath::Resolved(..) => None, . } . } . } . impl<'a> MaybeResPath<'a> for &Expr<'a> { . #[inline] . fn opt_res_path(self) -> OptResPath<'a> { 4,718,702 ( 0.02%) match &self.kind { . ExprKind::Path(qpath) => qpath.opt_res_path(), . _ => (None, None), . } . } . . #[inline] . fn opt_ty_rel_path(self) -> OptTyRelPath<'a> { . match &self.kind { -- line 438 ---------------------------------------- -- line 518 ---------------------------------------- . . /// Gets this definition's id and kind. This will lookup the kind in the def . /// tree if needed. . fn opt_def<'tcx>(self, tcx: &impl HasTyCtxt<'tcx>) -> Option<(DefKind, DefId)>; . . /// Gets the diagnostic name of this definition if it has one. . #[inline] . fn opt_diag_name<'tcx>(self, tcx: &impl HasTyCtxt<'tcx>) -> Option { 2 ( 0.00%) self.opt_def_id().and_then(|id| tcx.tcx().get_diagnostic_name(id)) 80 ( 0.00%) => ???:::get_diagnostic_name (1x) . } . . /// Checks if this definition has the specified diagnostic name. . #[inline] . fn is_diag_item<'tcx>(self, tcx: &impl HasTyCtxt<'tcx>, name: Symbol) -> bool { . self.opt_def_id() 4 ( 0.00%) .is_some_and(|id| tcx.tcx().is_diagnostic_item(name, id)) 100 ( 0.00%) => ???:::is_diagnostic_item (1x) . } . . /// Checks if this definition is the specified `LangItem`. . #[inline] . fn is_lang_item<'tcx>(self, tcx: &impl HasTyCtxt<'tcx>, item: LangItem) -> bool { . self.opt_def_id() . .is_some_and(|id| tcx.tcx().lang_items().get(item) == Some(id)) . } -- line 541 ---------------------------------------- -- line 642 ---------------------------------------- . impl MaybeDef for Res { . #[inline] . fn opt_def_id(self) -> Option { . Res::opt_def_id(&self) . } . . #[inline] . fn opt_def<'tcx>(self, _: &impl HasTyCtxt<'tcx>) -> Option<(DefKind, DefId)> { 4 ( 0.00%) match self { . Res::Def(kind, id) => Some((kind, id)), . _ => None, . } . } . } . impl MaybeDef for Option { . #[inline] . fn opt_def_id(self) -> Option { -- line 658 ---------------------------------------- 21 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/lib.rs -------------------------------------------------------------------------------- Ir -- line 128 ---------------------------------------- . /// Methods on `Vec` that also exists on slices. . pub const VEC_METHODS_SHADOWING_SLICE_METHODS: [Symbol; 3] = [sym::as_ptr, sym::is_empty, sym::len]; . . #[macro_export] . macro_rules! extract_msrv_attr { . () => { . fn check_attributes(&mut self, cx: &rustc_lint::EarlyContext<'_>, attrs: &[rustc_ast::ast::Attribute]) { . let sess = rustc_lint::LintContext::sess(cx); 9,044,208 ( 0.04%) self.msrv.check_attributes(attrs); 1,179,648 ( 0.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes (393,216x) . } . . fn check_attributes_post(&mut self, cx: &rustc_lint::EarlyContext<'_>, attrs: &[rustc_ast::ast::Attribute]) { . let sess = rustc_lint::LintContext::sess(cx); 8,650,980 ( 0.04%) self.msrv.check_attributes_post(attrs); 1,179,648 ( 0.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes_post (393,216x) . } . }; . } . . /// If the given expression is a local binding, find the initializer expression. . /// If that initializer expression is another local binding, find its initializer again. . /// . /// This process repeats as long as possible (but usually no more than once). Initializer -- line 149 ---------------------------------------- -- line 216 ---------------------------------------- . /// `tcx.hir_is_inside_const_context(_)`. . /// . /// Do not call this unless the `LateContext` has an enclosing body. For release build this case . /// will safely return `false`, but debug builds will ICE. Note that `check_expr`, `check_block`, . /// `check_pat` and a few other entry points will always have an enclosing body. Some entry points . /// like `check_path` or `check_ty` may or may not have one. . pub fn is_in_const_context(cx: &LateContext<'_>) -> bool { . debug_assert!(cx.enclosing_body.is_some(), "`LateContext` has no enclosing body"); 12 ( 0.00%) cx.enclosing_body.is_some_and(|id| { 6 ( 0.00%) cx.tcx 30 ( 0.00%) .hir_body_const_context(cx.tcx.hir_body_owner_def_id(id)) 1,152 ( 0.00%) => ???:::hir_body_const_context (6x) 744 ( 0.00%) => ???:::hir_body_owner_def_id (6x) . .is_some() . }) 6 ( 0.00%) } . . /// Returns `true` if the given `HirId` is inside an always constant context. . /// . /// This context includes: . /// * const/static items . /// * const blocks (or inline consts) . /// * associated constants . pub fn is_inside_always_const_context(tcx: TyCtxt<'_>, hir_id: HirId) -> bool { -- line 237 ---------------------------------------- -- line 294 ---------------------------------------- . }; . . cx.tcx.lang_items().get(item) == Some(did) . } . . /// Checks is `expr` is `None` . pub fn is_none_expr(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { . expr.basic_res().ctor_parent(cx).is_lang_item(cx, OptionNone) 10 ( 0.00%) } . . /// If `expr` is `Some(inner)`, returns `inner` . pub fn as_some_expr<'tcx>(cx: &LateContext<'_>, expr: &'tcx Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> { . if let ExprKind::Call(e, [arg]) = expr.kind . && e.basic_res().ctor_parent(cx).is_lang_item(cx, OptionSome) . { . Some(arg) . } else { -- line 310 ---------------------------------------- -- line 1030 ---------------------------------------- . } . . /// Matches an `Expr` against a chain of methods, and return the matched `Expr`s. . /// . /// For example, if `expr` represents the `.baz()` in `foo.bar().baz()`, . /// `method_chain_args(expr, &[sym::bar, sym::baz])` will return a `Vec` . /// containing the `Expr`s for . /// `.bar()` and `.baz()` 84 ( 0.00%) pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[Symbol]) -> Option, &'a [Expr<'a>])>> { . let mut current = expr; . let mut matched = Vec::with_capacity(methods.len()); . for method_name in methods.iter().rev() { . // method chains are stored last -> first 30 ( 0.00%) if let ExprKind::MethodCall(path, receiver, args, _) = current.kind { 6 ( 0.00%) if path.ident.name == *method_name { . if receiver.span.from_expansion() || args.iter().any(|e| e.span.from_expansion()) { . return None; . } . matched.push((receiver, args)); // build up `matched` backwards . current = receiver; // go to parent expression . } else { . return None; . } . } else { . return None; . } . } . // Reverse `matched` so that it is in the same order as `methods`. . matched.reverse(); . Some(matched) 108 ( 0.00%) } . . /// Returns `true` if the provided `def_id` is an entrypoint to a program. 9 ( 0.00%) pub fn is_entrypoint_fn(cx: &LateContext<'_>, def_id: DefId) -> bool { 1 ( 0.00%) cx.tcx . .entry_fn(()) . .is_some_and(|(entry_fn_def_id, _)| def_id == entry_fn_def_id) 8 ( 0.00%) } . . /// Returns `true` if the expression is in the program's `#[panic_handler]`. . pub fn is_in_panic_handler(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { . let parent = cx.tcx.hir_get_parent_item(e.hir_id); . Some(parent.to_def_id()) == cx.tcx.lang_items().panic_impl() . } . . /// Gets the name of the item the expression is in, if available. 7 ( 0.00%) pub fn parent_item_name(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option { 6 ( 0.00%) let parent_id = cx.tcx.hir_get_parent_item(expr.hir_id).def_id; 19 ( 0.00%) => ???:::hir_get_parent_item (1x) 7 ( 0.00%) match cx.tcx.hir_node_by_def_id(parent_id) { 1 ( 0.00%) Node::Item(item) => item.kind.ident().map(|ident| ident.name), . Node::TraitItem(TraitItem { ident, .. }) | Node::ImplItem(ImplItem { ident, .. }) => Some(ident.name), . _ => None, . } 8 ( 0.00%) } . . pub struct ContainsName<'a, 'tcx> { . pub cx: &'a LateContext<'tcx>, . pub name: Symbol, . } . . impl<'tcx> Visitor<'tcx> for ContainsName<'_, 'tcx> { . type Result = ControlFlow<()>; -- line 1091 ---------------------------------------- -- line 1118 ---------------------------------------- . } else { . ControlFlow::Continue(()) . } . }) . .is_some() . } . . /// Gets the parent expression, if any –- this is useful to constrain a lint. 393,218 ( 0.00%) pub fn get_parent_expr<'tcx>(cx: &LateContext<'tcx>, e: &Expr<'_>) -> Option<&'tcx Expr<'tcx>> { 786,436 ( 0.00%) get_parent_expr_for_hir(cx, e.hir_id) 786,436 ( 0.00%) } . . /// This retrieves the parent for the given `HirId` if it's an expression. This is useful for . /// constraint lints . pub fn get_parent_expr_for_hir<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Option<&'tcx Expr<'tcx>> { 1,572,872 ( 0.01%) match cx.tcx.parent_hir_node(hir_id) { 42,467,544 ( 0.21%) => ???:::parent_hir_node (393,218x) . Node::Expr(parent) => Some(parent), . _ => None, . } . } . . /// Gets the enclosing block, if any. . pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Option<&'tcx Block<'tcx>> { . let enclosing_node = cx -- line 1141 ---------------------------------------- -- line 1281 ---------------------------------------- . ) = expr.kind . { . expr = inner; . } . expr . } . . /// Checks if the given expression is the else clause of either an `if` or `if let` expression. 6 ( 0.00%) pub fn is_else_clause(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool { 4 ( 0.00%) let mut iter = tcx.hir_parent_iter(expr.hir_id); 4 ( 0.00%) match iter.next() { . Some(( . _, . Node::Expr(Expr { . kind: ExprKind::If(_, _, Some(else_expr)), . .. . }), . )) => else_expr.hir_id == expr.hir_id, . _ => false, . } 8 ( 0.00%) } . . /// Checks if the given expression is a part of `let else` . /// returns `true` for both the `init` and the `else` part . pub fn is_inside_let_else(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool { . hir_parent_with_src_iter(tcx, expr.hir_id).any(|(node, child_id)| { . matches!( . node, . Node::LetStmt(LetStmt { -- line 1309 ---------------------------------------- -- line 1388 ---------------------------------------- . pub fn is_adjusted(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { . cx.typeck_results().adjustments().get(e.hir_id).is_some() . } . . /// Returns the pre-expansion span if this comes from an expansion of the . /// macro `name`. . /// See also [`is_direct_expn_of`]. . #[must_use] 85 ( 0.00%) pub fn is_expn_of(mut span: Span, name: Symbol) -> Option { . loop { . if span.from_expansion() { . let data = span.ctxt().outer_expn_data(); 9 ( 0.00%) let new_span = data.call_site; . 18 ( 0.00%) if let ExpnKind::Macro(MacroKind::Bang, mac_name) = data.kind . && mac_name == name . { . return Some(new_span); . } . . span = new_span; . } else { 10 ( 0.00%) return None; . } . } 45 ( 0.00%) } . . /// Returns the pre-expansion span if the span directly comes from an expansion . /// of the macro `name`. . /// The difference with [`is_expn_of`] is that in . /// ```no_run . /// # macro_rules! foo { ($name:tt!$args:tt) => { $name!$args } } . /// # macro_rules! bar { ($e:expr) => { $e } } . /// foo!(bar!(42)); -- line 1421 ---------------------------------------- -- line 1545 ---------------------------------------- . && let Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } = path.res . { . return true; . } . false . } . . pub fn iter_input_pats<'tcx>(decl: &FnDecl<'_>, body: &'tcx Body<'_>) -> impl Iterator> { 1 ( 0.00%) (0..decl.inputs.len()).map(move |i| &body.params[i]) . } . . /// Checks if a given expression is a match expression expanded from the `?` . /// operator or the `try` macro. . pub fn is_try<'tcx>(cx: &LateContext<'_>, expr: &'tcx Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> { . fn is_ok(cx: &LateContext<'_>, arm: &Arm<'_>) -> bool { . if let PatKind::TupleStruct(ref path, pat, ddpos) = arm.pat.kind . && ddpos.as_opt_usize().is_none() -- line 1561 ---------------------------------------- -- line 1628 ---------------------------------------- . . /// Returns `true` if the lint is allowed in the current context. This is useful for . /// skipping long running code when it's unnecessary . /// . /// This function should check the lint level for the same node, that the lint will . /// be emitted at. If the information is buffered to be emitted at a later point, please . /// make sure to use `span_lint_hir` functions to emit the lint. This ensures that . /// expectations at the checked nodes will be fulfilled. 40 ( 0.00%) pub fn is_lint_allowed(cx: &LateContext<'_>, lint: &'static Lint, id: HirId) -> bool { 20 ( 0.00%) cx.tcx.lint_level_spec_at_node(lint, id).is_allow() 8,513 ( 0.00%) => ???:::lint_level_spec_at_node (10x) 20 ( 0.00%) } . . pub fn strip_pat_refs<'hir>(mut pat: &'hir Pat<'hir>) -> &'hir Pat<'hir> { . while let PatKind::Ref(subpat, _, _) = pat.kind { . pat = subpat; . } . pat . } . -- line 1646 ---------------------------------------- -- line 1658 ---------------------------------------- . #[expect(clippy::cast_sign_loss)] . /// clip unused bytes . pub fn unsext(tcx: TyCtxt<'_>, u: i128, ity: IntTy) -> u128 { . let amt = 128 - int_bits(tcx, ity); . ((u as u128) << amt) >> amt . } . . /// clip unused bytes 1 ( 0.00%) pub fn clip(tcx: TyCtxt<'_>, u: u128, ity: UintTy) -> u128 { . let bits = Integer::from_uint_ty(&tcx, ity).size().bits(); . let amt = 128 - bits; 9 ( 0.00%) (u << amt) >> amt 3 ( 0.00%) } . . pub fn has_attr(attrs: &[hir::Attribute], symbol: Symbol) -> bool { . attrs.iter().any(|attr| attr.has_name(symbol)) . } . . pub fn has_repr_attr(cx: &LateContext<'_>, hir_id: HirId) -> bool { . find_attr!(cx.tcx, hir_id, Repr { .. }) . } -- line 1678 ---------------------------------------- -- line 1688 ---------------------------------------- . enclosing_node = tcx.hir_get_parent_item(enclosing_node).into(); . } . . false . } . . /// Checks if the given HIR node is inside an `impl` block with the `automatically_derived` . /// attribute. 2,752,526 ( 0.01%) pub fn in_automatically_derived(tcx: TyCtxt<'_>, id: HirId) -> bool { . tcx.hir_parent_owner_iter(id) 1,966,090 ( 0.01%) .filter(|(_, node)| matches!(node, OwnerNode::Item(item) if matches!(item.kind, ItemKind::Impl(_)))) . .any(|(id, _)| find_attr!(tcx, id.def_id, AutomaticallyDerived)) 2,752,526 ( 0.01%) } . . /// Checks if the given `DefId` matches the `libc` item. . pub fn match_libc_symbol(cx: &LateContext<'_>, did: DefId, name: Symbol) -> bool { . // libc is meant to be used as a flat list of names, but they're all actually defined in different . // modules based on the target platform. Ignore everything but crate name and the item name. . cx.tcx.crate_name(did.krate) == sym::libc && cx.tcx.def_path_str(did).ends_with(name.as_str()) . } . -- line 1708 ---------------------------------------- -- line 2052 ---------------------------------------- . None . } else if is_no_std_crate(cx) { . Some("core") . } else { . Some("std") . } . } . 1 ( 0.00%) pub fn is_no_std_crate(cx: &LateContext<'_>) -> bool { 2 ( 0.00%) find_attr!(cx.tcx, crate, NoStd) 45 ( 0.00%) => ???:::hir_krate_attrs (1x) 3 ( 0.00%) } . . pub fn is_no_core_crate(cx: &LateContext<'_>) -> bool { . find_attr!(cx.tcx, crate, NoCore) . } . . /// Check if parent of a hir node is a trait implementation block. . /// For example, `f` in . /// ```no_run . /// # struct S; . /// # trait Trait { fn f(); } . /// impl Trait for S { . /// fn f() {} . /// } . /// ``` 6 ( 0.00%) pub fn is_trait_impl_item(cx: &LateContext<'_>, hir_id: HirId) -> bool { 8 ( 0.00%) if let Node::Item(item) = cx.tcx.parent_hir_node(hir_id) { 1,084 ( 0.00%) => ???:::parent_hir_node (2x) . matches!(item.kind, ItemKind::Impl(Impl { of_trait: Some(_), .. })) . } else { . false . } 4 ( 0.00%) } . . /// Check if it's even possible to satisfy the `where` clause for the item. . /// . /// `trivial_bounds` feature allows functions with unsatisfiable bounds, for example: . /// . /// ```ignore . /// fn foo() where i32: Iterator { . /// for _ in 2i32 {} -- line 2091 ---------------------------------------- -- line 2098 ---------------------------------------- . .clauses_of(did) . .clauses . .iter() . .filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None }); . traits::impossible_clauses(cx.tcx, traits::elaborate(cx.tcx, clauses).collect::>()) . } . . /// Returns the `DefId` of the callee if the given expression is a function or method call. 1,572,872 ( 0.01%) pub fn fn_def_id(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option { 393,218 ( 0.00%) fn_def_id_with_node_args(cx, expr).map(|(did, _)| did) 10,223,775 ( 0.05%) => site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::fn_def_id_with_node_args (393,218x) 786,436 ( 0.00%) } . . /// Returns the `DefId` of the callee if the given expression is a function or method call, . /// as well as its node args. 2,752,526 ( 0.01%) pub fn fn_def_id_with_node_args<'tcx>( . cx: &LateContext<'tcx>, . expr: &Expr<'_>, . ) -> Option<(DefId, GenericArgsRef<'tcx>)> { . let typeck = cx.typeck_results(); 1,966,090 ( 0.01%) match &expr.kind { 3 ( 0.00%) ExprKind::MethodCall(..) => Some(( 6 ( 0.00%) typeck.type_dependent_def_id(expr.hir_id)?, 51 ( 0.00%) => ???:::type_dependent_def_id (1x) 4 ( 0.00%) typeck.node_args(expr.hir_id), 39 ( 0.00%) => ???:::node_args (1x) 1 ( 0.00%) )), . ExprKind::Call( . Expr { . kind: ExprKind::Path(qpath), . hir_id: path_hir_id, . .. . }, . .., . ) => { -- line 2129 ---------------------------------------- -- line 2134 ---------------------------------------- . { . Some((id, typeck.node_args(*path_hir_id))) . } else { . None . } . }, . _ => None, . } 3,538,962 ( 0.02%) } . . /// Returns `Option` where String is a textual representation of the type encapsulated in . /// the slice iff the given expression is a slice of primitives. . /// . /// (As defined in the `is_recursively_primitive_type` function.) Returns `None` otherwise. . pub fn is_slice_of_primitives(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option { . let expr_type = cx.typeck_results().expr_ty_adjusted(expr); . let expr_kind = expr_type.kind(); -- line 2150 ---------------------------------------- -- line 2267 ---------------------------------------- . count = count.wrapping_add(1); . curr_expr = local_expr; . } . (curr_expr, count) . } . . /// Peels off all references on the expression. Returns the underlying expression and the number of . /// references removed. 786,458 ( 0.00%) pub fn peel_hir_expr_refs<'a>(expr: &'a Expr<'a>) -> (&'a Expr<'a>, usize) { . let mut count = 0; 786,458 ( 0.00%) let e = peel_hir_expr_while(expr, |e| match e.kind { . ExprKind::AddrOf(ast::BorrowKind::Ref, _, e) => { . count += 1; . Some(e) . }, . _ => None, . }); . (e, count) 393,229 ( 0.00%) } . . /// Peels off all references on the type. Returns the underlying type and the number of references . /// removed. . pub fn peel_hir_ty_refs<'a>(mut ty: &'a hir::Ty<'a>) -> (&'a hir::Ty<'a>, usize) { . let mut count = 0; . loop { . match &ty.kind { . TyKind::Ref(_, ref_ty) => { -- line 2293 ---------------------------------------- -- line 2841 ---------------------------------------- . }) . } . . /// Checks whether a given span has any comment token . /// This checks for all types of comment: line "//", block "/**", doc "///" "//!" . pub fn span_contains_comment<'sm>(sm: impl HasSourceMap<'sm>, span: Span) -> bool { . span.check_text(sm, |snippet| { . tokenize(snippet, FrontmatterAllowed::No).any(|token| { 1,048,563 ( 0.01%) matches!( . token.kind, . TokenKind::BlockComment { .. } | TokenKind::LineComment { .. } . ) . }) . }) . } . . /// Checks whether a given span has any significant token. A significant token is a non-whitespace -- line 2857 ---------------------------------------- -- line 2942 ---------------------------------------- . /// Binary operation traits like `LangItem::Add` . pub static BINOP_TRAITS: &[LangItem] = &[$(LangItem::$name,)*]; . . /// Operator-Assign traits like `LangItem::AddAssign` . pub static OP_ASSIGN_TRAITS: &[LangItem] = &[$(LangItem::$assign,)*]; . . /// Converts `BinOpKind::Add` to `(LangItem::Add, LangItem::AddAssign)`, for example . pub fn binop_traits(kind: hir::BinOpKind) -> Option<(LangItem, LangItem)> { 2 ( 0.00%) match kind { . $(hir::BinOpKind::$name => Some((LangItem::$name, LangItem::$assign)),)* . _ => None, . } . } . }; . } . . op_utils! { -- line 2958 ---------------------------------------- 1,179,727 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/validations.rs -------------------------------------------------------------------------------- Ir -- line 29 ---------------------------------------- . /// . /// # Safety . /// . /// `bytes` must produce a valid UTF-8-like (UTF-8 or WTF-8) string . #[unstable(feature = "str_internals", issue = "none")] . #[inline] . pub unsafe fn next_code_point<'a, I: Iterator>(bytes: &mut I) -> Option { . // Decode UTF-8 13,275,957 ( 0.07%) let x = *bytes.next()?; 26,558,884 ( 0.13%) if x < 128 { . return Some(x as u32); . } . . // Multibyte case follows . // Decode from a byte combination out of: [[[x y] z] w] . // NOTE: Performance is sensitive to the exact formulation here . let init = utf8_first_byte(x, 2); . // SAFETY: `bytes` produces an UTF-8-like string, -- line 46 ---------------------------------------- -- line 76 ---------------------------------------- . /// `bytes` must produce a valid UTF-8-like (UTF-8 or WTF-8) string . #[inline] . pub(super) unsafe fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option . where . I: DoubleEndedIterator, . { . // Decode UTF-8 . let w = match *bytes.next_back()? { 99 ( 0.00%) next_byte if next_byte < 128 => return Some(next_byte as u32), . back_byte => back_byte, . }; . . // Multibyte case follows . // Decode from a byte combination out of: [x [y [z w]]] . let mut ch; . // SAFETY: `bytes` produces an UTF-8-like string, . // so the iterator must produce a value here. -- line 92 ---------------------------------------- 3,658,307 ( 0.02%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/implicit_saturating_sub.rs -------------------------------------------------------------------------------- Ir -- line 90 ---------------------------------------- . . impl ImplicitSaturatingSub { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ImplicitSaturatingSub { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . if let Some(higher::If { cond, then, r#else: None }) = higher::If::hir(expr) . . // Check if the conditional expression is a binary operation . && let ExprKind::Binary(ref cond_op, cond_left, cond_right) = cond.kind . { . check_with_condition(cx, expr, cond_op.node, cond_left, cond_right, then, self.msrv); -- line 107 ---------------------------------------- -- line 111 ---------------------------------------- . r#else: Some(else_block), . }) = higher::If::hir(expr) . && let ExprKind::Binary(ref cond_op, cond_left, cond_right) = cond.kind . { . check_manual_check( . cx, expr, cond_op, cond_left, cond_right, if_block, else_block, self.msrv, . ); . } 3,145,784 ( 0.02%) } . } . . #[expect(clippy::too_many_arguments)] . fn check_manual_check<'tcx>( . cx: &LateContext<'tcx>, . expr: &Expr<'tcx>, . condition: &BinOp, . left_hand: &Expr<'tcx>, -- line 127 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/ifs/mod.rs -------------------------------------------------------------------------------- Ir -- line 174 ---------------------------------------- . . pub struct CopyAndPaste<'tcx> { . interior_mut: InteriorMut<'tcx>, . } . . impl<'tcx> CopyAndPaste<'tcx> { . pub fn new(tcx: TyCtxt<'tcx>, conf: &'static Conf) -> Self { . Self { 4 ( 0.00%) interior_mut: InteriorMut::new(tcx, &conf.ignore_interior_mutability), 32,390 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/ty/mod.rs:::new (1x) . } . } . } . . impl<'tcx> LateLintPass<'tcx> for CopyAndPaste<'tcx> { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } 1,966,090 ( 0.01%) if matches!(expr.kind, ExprKind::If(..)) && !is_else_clause(cx.tcx, expr) { . let (conds, blocks) = if_sequence(expr); . ifs_same_cond::check(cx, &conds, &mut self.interior_mut); . same_functions_in_if_cond::check(cx, &conds); . let all_same = . !is_lint_allowed(cx, IF_SAME_THEN_ELSE, expr.hir_id) && if_same_then_else::check(cx, &conds, &blocks); . if !all_same && conds.len() != blocks.len() { . branches_sharing_code::check(cx, &conds, &blocks, expr); . } . } else if let ExprKind::Match(_, arms, _) = expr.kind { . branches_sharing_code::check_match(cx, expr, arms); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unnecessary_map_on_constructor.rs -------------------------------------------------------------------------------- Ir -- line 32 ---------------------------------------- . "using `map`/`map_err` on `Option` or `Result` constructors" . } . . declare_lint_pass!(UnnecessaryMapOnConstructor => [ . UNNECESSARY_MAP_ON_CONSTRUCTOR, . ]); . . impl<'tcx> LateLintPass<'tcx> for UnnecessaryMapOnConstructor { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) { 786,452 ( 0.00%) if !expr.span.from_expansion() 2 ( 0.00%) && let hir::ExprKind::MethodCall(path, recv, [map_arg], ..) = expr.kind . && !map_arg.span.from_expansion() . && let hir::ExprKind::Path(fun) = map_arg.kind . && let Some(sym::Option | sym::Result) = cx.typeck_results().expr_ty(recv).opt_diag_name(cx) . { . let (constructor_path, constructor_item) = if let hir::ExprKind::Call(constructor, [arg, ..]) = recv.kind . && let hir::ExprKind::Path(constructor_path) = constructor.kind . && !constructor.span.from_expansion() . && !arg.span.from_expansion() -- line 50 ---------------------------------------- -- line 81 ---------------------------------------- . "unnecessary `{}` on constructor `{constructor_snippet}(_)`", . path.ident.name . ), . "try", . format!("{constructor_snippet}({fun_snippet}({constructor_arg_snippet}))"), . app, . ); . } 3,145,784 ( 0.02%) } . } 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/mod.rs -------------------------------------------------------------------------------- Ir -- line 883 ---------------------------------------- . . impl Casts { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for Casts { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Cast(cast_from_expr, cast_to_hir) = expr.kind { . if expr.span.in_external_macro(cx.sess().source_map()) { . return; . } . if is_hir_ty_cfg_dependant(cx, cast_to_hir) { . return; . } . let (cast_from, cast_to) = ( . cx.typeck_results().expr_ty(cast_from_expr), -- line 900 ---------------------------------------- -- line 938 ---------------------------------------- . . let was_borrow_as_ptr_emitted = self.msrv.meets(cx, msrvs::BORROW_AS_PTR) . && borrow_as_ptr::check(cx, expr, cast_from_expr, cast_to_hir, self.msrv); . if !was_borrow_as_ptr_emitted && self.msrv.meets(cx, msrvs::PTR_FROM_REF) { . ref_as_ptr::check(cx, expr, cast_from_expr, cast_to_hir); . } . } . 2,752,561 ( 0.01%) if self.msrv.meets(cx, msrvs::RAW_REF_OP) { 5,898,345 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::meets (393,223x) 1,179,669 ( 0.01%) borrow_as_ptr::check_implicit_cast(cx, expr); 7,078,010 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/borrow_as_ptr.rs:clippy_lints::casts::borrow_as_ptr::check_implicit_cast (393,223x) . } 2,359,338 ( 0.01%) if self.msrv.meets(cx, msrvs::PTR_SLICE_RAW_PARTS) { 5,898,345 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::meets (393,223x) 1,179,669 ( 0.01%) cast_slice_from_raw_parts::check_implicit_cast(cx, expr); 8,650,920 ( 0.04%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_from_raw_parts.rs:clippy_lints::casts::cast_slice_from_raw_parts::check_implicit_cast (393,223x) . } 1,179,669 ( 0.01%) cast_ptr_alignment::check_cast_method(cx, expr); 5,111,904 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/cast_ptr_alignment.rs:clippy_lints::casts::cast_ptr_alignment::check_cast_method (393,223x) 1,572,892 ( 0.01%) cast_slice_different_sizes::check(cx, expr, self.msrv); 68,027,573 ( 0.33%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_different_sizes.rs:clippy_lints::casts::cast_slice_different_sizes::check (393,223x) 1,179,669 ( 0.01%) ptr_cast_constness::check_null_ptr_cast_method(cx, expr); 5,898,350 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/ptr_cast_constness.rs:clippy_lints::casts::ptr_cast_constness::check_null_ptr_cast_method (393,223x) 3,145,784 ( 0.02%) } . . fn check_body(&mut self, cx: &LateContext<'tcx>, body: &rustc_hir::Body<'tcx>) { 9 ( 0.00%) needless_type_cast::check(cx, body); 17,171,067 ( 0.08%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/casts/needless_type_cast.rs:clippy_lints::casts::needless_type_cast::check (3x) . } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unnecessary_mut_passed.rs -------------------------------------------------------------------------------- Ir -- line 34 ---------------------------------------- . pub UNNECESSARY_MUT_PASSED, . style, . "an argument passed as a mutable reference although the callee only demands an immutable reference" . } . . declare_lint_pass!(UnnecessaryMutPassed => [UNNECESSARY_MUT_PASSED]); . . impl<'tcx> LateLintPass<'tcx> for UnnecessaryMutPassed { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,446 ( 0.00%) if e.span.from_expansion() { . // Issue #11268 . return; . } . 1,966,090 ( 0.01%) match e.kind { . ExprKind::Call(fn_expr, arguments) => { . if let ExprKind::Path(ref path) = fn_expr.kind . && arguments.iter().any(is_mut_ref_arg) . { . check_arguments( . cx, . &mut arguments.iter(), . cx.typeck_results().expr_ty(fn_expr), -- line 56 ---------------------------------------- -- line 61 ---------------------------------------- . path, . ) . }, . "function", . ); . } . }, . ExprKind::MethodCall(path, receiver, arguments, _) 3 ( 0.00%) if iter::once(receiver).chain(arguments.iter()).any(is_mut_ref_arg) . && let Some(def_id) = cx.typeck_results().type_dependent_def_id(e.hir_id) => . { . let args = cx.typeck_results().node_args(e.hir_id); . let method_type = cx.tcx.type_of(def_id).instantiate(cx.tcx, args).skip_norm_wip(); . check_arguments( . cx, . &mut iter::once(receiver).chain(arguments.iter()), . method_type, . &|| path.ident.as_str().to_owned(), . "method", . ); . }, . _ => (), . } 3,145,784 ( 0.02%) } . } . . /// Only `&mut ...` arguments can lint, so the type and path lookups run only after one is found. . fn is_mut_ref_arg(argument: &Expr<'_>) -> bool { 2 ( 0.00%) matches!(argument.kind, ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, _)) . } . . fn check_arguments<'tcx>( . cx: &LateContext<'tcx>, . arguments: &mut dyn Iterator>, . type_definition: Ty<'tcx>, . name: &dyn Fn() -> String, . fn_kind: &str, -- line 97 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/octal_escapes.rs -------------------------------------------------------------------------------- Ir -- line 45 ---------------------------------------- . pub OCTAL_ESCAPES, . suspicious, . "string escape sequences looking like octal characters" . } . . declare_lint_pass!(OctalEscapes => [OCTAL_ESCAPES]); . . impl EarlyLintPass for OctalEscapes { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if let ExprKind::Lit(lit) = &expr.kind . // The number of bytes from the start of the token to the start of literal's text. 1,834,997 ( 0.01%) && let start_offset = BytePos::from_u32(match lit.kind { . LitKind::Str => 1, . LitKind::ByteStr | LitKind::CStr => 2, . _ => return, . }) 3 ( 0.00%) && !expr.span.in_external_macro(cx.sess().source_map()) . { . let s = lit.symbol.as_str(); . let mut iter = s.as_bytes().iter(); 106 ( 0.00%) while let Some(&c) = iter.next() { 212 ( 0.00%) if c == b'\\' . // Always move the iterator to read the escape char. . && let Some(b'0') = iter.next() . { . // C-style octal escapes read from one to three characters. . // The first character (`0`) has already been read. . let (tail, len, c_hi, c_lo) = match *iter.as_slice() { . [c_hi @ b'0'..=b'7', c_lo @ b'0'..=b'7', ref tail @ ..] => (tail, 4, c_hi, c_lo), . [c_lo @ b'0'..=b'7', ref tail @ ..] => (tail, 3, b'0', c_lo), -- line 74 ---------------------------------------- -- line 107 ---------------------------------------- . ); . }); . } else { . break; . } . } . } . } 3,145,768 ( 0.02%) } . } 524,288 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/misc_early/literal_suffix.rs -------------------------------------------------------------------------------- Ir . use clippy_utils::diagnostics::span_lint_and_then; . use rustc_errors::Applicability; . use rustc_lint::EarlyContext; . use rustc_span::Span; . . use super::{SEPARATED_LITERAL_SUFFIX, UNSEPARATED_LITERAL_SUFFIX}; . 786,444 ( 0.00%) pub(super) fn check(cx: &EarlyContext<'_>, lit_span: Span, lit_snip: &str, suffix: &str, sugg_type: &str) { 131,074 ( 0.00%) let Some(maybe_last_sep_idx) = lit_snip.len().checked_sub(suffix.len() + 1) else { . return; // It's useless so shouldn't lint. . }; . // Do not lint when literal is unsuffixed. 131,074 ( 0.00%) if !suffix.is_empty() { . if lit_snip.as_bytes()[maybe_last_sep_idx] == b'_' { . #[expect(clippy::collapsible_span_lint_calls, reason = "rust-clippy#7797")] . span_lint_and_then( . cx, . SEPARATED_LITERAL_SUFFIX, . lit_span, . format!("{sugg_type} type suffix should not be separated by an underscore"), . |diag| { -- line 21 ---------------------------------------- -- line 40 ---------------------------------------- . "add an underscore", . format!("{}_{suffix}", &lit_snip[..=maybe_last_sep_idx]), . Applicability::MachineApplicable, . ); . }, . ); . } . } 524,296 ( 0.00%) } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/strings.rs -------------------------------------------------------------------------------- Ir -- line 278 ---------------------------------------- . } . } . } . . // Max length a b"foo" string can take . const MAX_LENGTH_BYTE_STRING_LIT: usize = 32; . . impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { . use rustc_ast::LitKind; . 3,145,785 ( 0.02%) if let ExprKind::Call(fun, [bytes_arg]) = e.kind . // Find `std::str::converts::from_utf8` or `std::primitive::str::from_utf8` 3 ( 0.00%) && let Some(sym::str_from_utf8 | sym::str_inherent_from_utf8) = 1 ( 0.00%) fun.res(cx).opt_diag_name(cx) . . // Find string::as_bytes . && let ExprKind::AddrOf(BorrowKind::Ref, _, args) = bytes_arg.kind . && let ExprKind::Index(left, right, _) = args.kind . && let (method_names, expressions, _) = method_calls(left, 1) . && method_names == [sym::as_bytes] . && expressions.len() == 1 . && expressions[0].1.is_empty() -- line 300 ---------------------------------------- -- line 315 ---------------------------------------- . e.span, . "calling a slice of `as_bytes()` with `from_utf8` should be not necessary", . "try", . format!("Some(&{snippet_app}[{right_snip}])"), . applicability, . ); . } . 786,448 ( 0.00%) if !e.span.in_external_macro(cx.sess().source_map()) . && let ExprKind::MethodCall(path, receiver, ..) = &e.kind 2 ( 0.00%) && path.ident.name == sym::as_bytes . && let ExprKind::Lit(lit) = &receiver.kind . && let LitKind::Str(lit_content, _) = &lit.node . { . let callsite = snippet(cx, receiver.span.source_callsite(), r#""foo""#); . let mut applicability = Applicability::MachineApplicable; . if callsite.starts_with("include_str!") { . span_lint_and_sugg( . cx, -- line 333 ---------------------------------------- -- line 362 ---------------------------------------- . snippet_with_applicability(cx, receiver.span, r#""foo""#, &mut applicability) . ), . applicability, . ); . } . } . } . 393,225 ( 0.00%) if let ExprKind::MethodCall(path, recv, [], _) = &e.kind 2 ( 0.00%) && path.ident.name == sym::into_bytes . && let ExprKind::MethodCall(path, recv, [], _) = &recv.kind . && matches!(path.ident.name, sym::to_owned | sym::to_string) . && let ExprKind::Lit(lit) = &recv.kind . && let LitKind::Str(lit_content, _) = &lit.node . && lit_content.as_str().is_ascii() . && lit_content.as_str().len() <= MAX_LENGTH_BYTE_STRING_LIT . && !recv.span.from_expansion() . { -- line 379 ---------------------------------------- -- line 387 ---------------------------------------- . "consider using a byte string literal instead", . format!( . "b{}.to_vec()", . snippet_with_applicability(cx, recv.span, r#""..""#, &mut applicability) . ), . applicability, . ); . } 3,145,784 ( 0.02%) } . } . . impl<'tcx> LateLintPass<'tcx> for StrToString { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) { . if expr.span.from_expansion() { . return; . } . -- line 403 ---------------------------------------- -- line 438 ---------------------------------------- . "str::to_owned".to_string(), . Applicability::MachineApplicable, . ); . } . } . } . . impl<'tcx> LateLintPass<'tcx> for TrimSplitWhitespace { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) { . let tyckres = cx.typeck_results(); 786,449 ( 0.00%) if let ExprKind::MethodCall(path, split_recv, [], split_ws_span) = expr.kind 1 ( 0.00%) && path.ident.name == sym::split_whitespace . && let Some(split_ws_def_id) = tyckres.type_dependent_def_id(expr.hir_id) . && cx.tcx.is_diagnostic_item(sym::str_split_whitespace, split_ws_def_id) . && let ExprKind::MethodCall(path, _trim_recv, [], trim_span) = split_recv.kind . && let trim_fn_name @ (sym::trim | sym::trim_start | sym::trim_end) = path.ident.name . && let Some(trim_def_id) = tyckres.type_dependent_def_id(split_recv.hir_id) . && is_one_of_trim_diagnostic_items(cx, trim_def_id) . { . span_lint_and_sugg( -- line 457 ---------------------------------------- -- line 459 ---------------------------------------- . TRIM_SPLIT_WHITESPACE, . trim_span.with_hi(split_ws_span.lo()), . format!("found call to `str::{trim_fn_name}` before `str::split_whitespace`"), . format!("remove `{trim_fn_name}()`"), . String::new(), . Applicability::MachineApplicable, . ); . } 3,145,784 ( 0.02%) } . } . . fn is_one_of_trim_diagnostic_items(cx: &LateContext<'_>, trim_def_id: DefId) -> bool { . matches!( . cx.tcx.get_diagnostic_name(trim_def_id), . Some(sym::str_trim | sym::str_trim_start | sym::str_trim_end) . ) . } -- line 475 ---------------------------------------- 393,224 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_rem_euclid.rs -------------------------------------------------------------------------------- Ir -- line 43 ---------------------------------------- . . impl ManualRemEuclid { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualRemEuclid { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // (x % c + c) % c 786,446 ( 0.00%) if let ExprKind::Binary(rem_op, rem_lhs, rem_rhs) = expr.kind 1 ( 0.00%) && rem_op.node == BinOpKind::Rem . && let ExprKind::Binary(add_op, add_lhs, add_rhs) = rem_lhs.kind . && add_op.node == BinOpKind::Add . && let ctxt = expr.span.ctxt() . && rem_lhs.span.ctxt() == ctxt . && rem_rhs.span.ctxt() == ctxt . && add_lhs.span.ctxt() == ctxt . && add_rhs.span.ctxt() == ctxt . && !expr.span.in_external_macro(cx.sess().source_map()) -- line 62 ---------------------------------------- -- line 93 ---------------------------------------- . MANUAL_REM_EUCLID, . expr.span, . "manual `rem_euclid` implementation", . "consider using", . format!("{rem_of}.rem_euclid({const1})"), . app, . ); . } 3,145,784 ( 0.02%) } . } . . // Checks if either the left or right expressions can be an unsigned int constant and returns that . // constant along with the other expression unchanged if so . fn check_for_either_unsigned_int_constant<'a>( . cx: &'a LateContext<'_>, . ctxt: SyntaxContext, . left: &'a Expr<'_>, -- line 109 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/rc_clone_in_vec_init.rs -------------------------------------------------------------------------------- Ir -- line 44 ---------------------------------------- . pub RC_CLONE_IN_VEC_INIT, . suspicious, . "initializing reference-counted pointer in `vec![elem; len]`" . } . . declare_lint_pass!(RcCloneInVecInit => [RC_CLONE_IN_VEC_INIT]); . . impl LateLintPass<'_> for RcCloneInVecInit { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 3 ( 0.00%) let Some(macro_call) = root_macro_call_first_node(cx, expr) else { . return; . }; 5 ( 0.00%) let Some(VecArgs::Repeat(elem, len)) = VecArgs::hir(cx, expr) else { 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (1x) . return; . }; . let Some((symbol, func_span)) = ref_init(cx, elem) else { . return; . }; . . emit_lint(cx, symbol, macro_call.span, elem, len, func_span); 3,145,784 ( 0.02%) } . } . . fn loop_init_suggestion(elem: &str, len: &str, indent: &str) -> String { . format!( . r"{{ . {indent} let mut v = Vec::with_capacity({len}); . {indent} (0..{len}).for_each(|_| v.push({elem})); . {indent} v -- line 72 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/ptr_cast_constness.rs -------------------------------------------------------------------------------- Ir -- line 71 ---------------------------------------- . format!("try `pointer::cast_{constness}`, a safer alternative"), . format!("{}.cast_{constness}()", sugg.maybe_paren()), . app, . ); . } . } . } . 2,359,338 ( 0.01%) pub(super) fn check_null_ptr_cast_method(cx: &LateContext<'_>, expr: &Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::MethodCall(method, cast_from_expr, [], _) = expr.kind 2 ( 0.00%) && let ExprKind::Call(func, []) = cast_from_expr.kind . && let ExprKind::Path(QPath::Resolved(None, path)) = func.kind . && let Some(defid) = path.res.opt_def_id() . && let method = match (cx.tcx.get_diagnostic_name(defid), method.ident.name) { . (Some(sym::ptr_null), sym::cast_mut) => "null_mut", . (Some(sym::ptr_null_mut), sym::cast_const) => "null", . _ => return, . } . && let Some(prefix) = std_or_core(cx) -- line 89 ---------------------------------------- -- line 97 ---------------------------------------- . PTR_CAST_CONSTNESS, . expr.span, . "changing constness of a null pointer", . format!("use `{method}()` directly instead"), . format!("{prefix}::ptr::{method}::<{after_lt}"), . app, . ); . } 2,752,561 ( 0.01%) } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/non_copy_const.rs -------------------------------------------------------------------------------- Ir -- line 259 ---------------------------------------- . ignore_tys: DefIdSet, . // Cache checked types. We can recurse through a type multiple times so this . // can be hit quite frequently. . freeze_tys: FxHashMap, IsFreeze>, . } . . impl<'tcx> NonCopyConst<'tcx> { . pub fn new(tcx: TyCtxt<'tcx>, conf: &'static Conf) -> Self { 4 ( 0.00%) Self { . ignore_tys: conf . .ignore_interior_mutability . .iter() 16 ( 0.00%) .flat_map(|ignored_ty| lookup_path_str(tcx, PathNS::Type, ignored_ty)) 237,409 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/paths.rs:clippy_utils::paths::lookup_path_str (4x) . .collect(), . freeze_tys: FxHashMap::default(), . } . } . . /// Checks if a value of the given type is `Freeze`, or may be depending on the value. . fn is_ty_freeze(&mut self, tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>, ty: Ty<'tcx>) -> IsFreeze { . // FIXME: this should probably be using the trait solver -- line 279 ---------------------------------------- -- line 709 ---------------------------------------- . _ => return None, . }; . src_expr = use_expr; . } . } . } . . impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> { 28 ( 0.00%) fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) { 8 ( 0.00%) if let ItemKind::Const(ident, .., ct_rhs) = item.kind . && !ident.is_special() . && let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip() . && match self.is_ty_freeze(cx.tcx, cx.typing_env(), ty) { . IsFreeze::No => true, . IsFreeze::Yes => false, . IsFreeze::Maybe => match cx.tcx.const_eval_poly(item.owner_id.to_def_id()) { . Ok(val) if let Ok(is_freeze) = self.is_value_freeze(cx.tcx, cx.typing_env(), ty, val) => !is_freeze, . // FIXME: we just assume mgca rhs's are freeze -- line 726 ---------------------------------------- -- line 749 ---------------------------------------- . if implements_trait(cx, ty, sync_trait, &[]) { . diag.help("did you mean to make this a `static` item"); . } else { . diag.help("did you mean to make this a `thread_local!` item"); . } . }, . ); . } 32 ( 0.00%) } . . fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>) { . if let TraitItemKind::Const(_, ct_rhs_opt) = item.kind . && let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip() . && match self.is_ty_freeze(cx.tcx, cx.typing_env(), ty) { . IsFreeze::No => true, . IsFreeze::Maybe if let Some(ct_rhs) = ct_rhs_opt => { . match cx.tcx.const_eval_poly(item.owner_id.to_def_id()) { -- line 765 ---------------------------------------- -- line 845 ---------------------------------------- . cx, . DECLARE_INTERIOR_MUTABLE_CONST, . item.ident.span, . "named constant with interior mutability", . ); . } . } . 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::Path(qpath) = &e.kind . && let typeck = cx.typeck_results() 42 ( 0.00%) && let Res::Def(DefKind::Const { .. } | DefKind::AssocConst { .. }, did) = typeck.qpath_res(qpath, e.hir_id) 30 ( 0.00%) => ???:::qpath_res (2x) . // As of `1.80` constant contexts can't borrow any type with interior mutability . && !is_in_const_context(cx) . && !self.is_ty_freeze(cx.tcx, cx.typing_env(), typeck.expr_ty(e)).is_freeze() . && let Some(borrow_src) = { . // The extra block helps formatting a lot. . if let Ok(val) = cx.tcx.const_eval_resolve( . cx.typing_env(), . UnevaluatedConst::new(did, typeck.node_args(e.hir_id)), -- line 864 ---------------------------------------- -- line 884 ---------------------------------------- . |diag| { . if let Some(note) = borrow_src.cause.note() { . diag.note(note); . } . diag.help("this lint can be silenced by assigning the value to a local variable before borrowing"); . }, . ); . } 3,145,784 ( 0.02%) } . } . . struct ReplaceAssocFolder<'tcx> { . tcx: TyCtxt<'tcx>, . trait_id: DefId, . self_ty: Ty<'tcx>, . } . impl<'tcx> TypeFolder> for ReplaceAssocFolder<'tcx> { -- line 900 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_option_as_slice.rs -------------------------------------------------------------------------------- Ir -- line 48 ---------------------------------------- . . impl ManualOptionAsSlice { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl LateLintPass<'_> for ManualOptionAsSlice { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 1,966,115 ( 0.01%) let span = expr.span; . if span.from_expansion() { . return; . } 2,752,522 ( 0.01%) match expr.kind { . ExprKind::Match(scrutinee, [arm1, arm2], _) . if is_none_pattern(cx, arm2.pat) && check_arms(cx, arm2, arm1) . || is_none_pattern(cx, arm1.pat) && check_arms(cx, arm1, arm2) => . { . check_as_ref(cx, scrutinee, span, self.msrv); . }, . ExprKind::If(cond, then, Some(other)) => { . if let ExprKind::Let(let_expr) = cond.kind . && let Some(binding) = extract_ident_from_some_pat(cx, let_expr.pat) . && check_some_body(cx, binding, then) . && is_empty_slice(cx, other.peel_blocks()) . { . check_as_ref(cx, let_expr.init, span, self.msrv); . } . }, 5 ( 0.00%) ExprKind::MethodCall(seg, callee, [], _) if seg.ident.name == sym::unwrap_or_default => { . check_map(cx, callee, span, self.msrv); . }, . ExprKind::MethodCall(seg, callee, [or], _) => match seg.ident.name { . sym::unwrap_or if is_empty_slice(cx, or) => { . check_map(cx, callee, span, self.msrv); . }, . sym::unwrap_or_else if returns_empty_slice(cx, or) => { . check_map(cx, callee, span, self.msrv); -- line 85 ---------------------------------------- -- line 92 ---------------------------------------- . }, . sym::map_or_else if returns_empty_slice(cx, or_else) && is_slice_from_ref(cx, map) => { . check_as_ref(cx, callee, span, self.msrv); . }, . _ => {}, . }, . _ => {}, . } 3,145,784 ( 0.02%) } . } . . fn check_map(cx: &LateContext<'_>, map: &Expr<'_>, span: Span, msrv: Msrv) { . if let ExprKind::MethodCall(seg, callee, [mapping], _) = map.kind . && seg.ident.name == sym::map . && is_slice_from_ref(cx, mapping) . { . check_as_ref(cx, callee, span, msrv); -- line 108 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/needless_bool.rs -------------------------------------------------------------------------------- Ir -- line 118 ---------------------------------------- . return true; . } . inner = i; . } . false . } . . impl<'tcx> LateLintPass<'tcx> for NeedlessBool { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { . use self::Expression::{Bool, RetBool}; 786,446 ( 0.00%) if !e.span.from_expansion() . && let Some(higher::If { . cond, . then, . r#else: Some(else_expr), . }) = higher::If::hir(e) . && !span_contains_comment(cx, e.span) . { . let reduce = |ret, not| { -- line 136 ---------------------------------------- -- line 214 ---------------------------------------- . e.span, . "this if-then-else expression assigns a bool literal", . "you can reduce it to", . sugg, . applicability, . ); . } . } 3,145,784 ( 0.02%) } . 14 ( 0.00%) fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) { . // Detect the early-return form: . // if c { . // return Ok(true); . // } . // Ok(false) . // and reduce it to `Ok(c)`. The optional `Ok(..)` wrapper can be any tuple-like . // constructor (or absent), as long as the guard and the trailing expression use the . // same one. Constructors are pure, so folding the condition in keeps the behavior. 6 ( 0.00%) if let Some(tail) = block.expr 2 ( 0.00%) && !tail.span.from_expansion() . && let [.., last_stmt] = block.stmts . && let StmtKind::Semi(if_expr) | StmtKind::Expr(if_expr) = last_stmt.kind . && !if_expr.span.from_expansion() . && let Some(higher::If { . cond, . then, . r#else: None, . }) = higher::If::hir(if_expr) -- line 242 ---------------------------------------- -- line 274 ---------------------------------------- . NEEDLESS_BOOL, . span, . "this `if` guard returns a bool literal and is followed by another", . "you can reduce it to", . sugg, . applicability, . ); . } 16 ( 0.00%) } . } . . /// Returns the optional constructor call wrapping a bool literal (e.g. the `Ok` in `Ok(true)`) . /// along with the bool value. The constructor is returned as the unresolved callee expression; . /// resolving it to a `DefId` (via [`wrapper_ctors_match`]) needs `qpath_res`, which is . /// comparatively expensive, so callers should only do that once the cheap bool-value comparison . /// has passed. A bare bool literal yields `None`. . fn fetch_bool_and_wrapper<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<(Option<&'tcx Expr<'tcx>>, bool)> { -- line 290 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/match_result_ok.rs -------------------------------------------------------------------------------- Ir -- line 39 ---------------------------------------- . pub MATCH_RESULT_OK, . style, . "usage of `ok()` in `let Some(pat)` statements is unnecessary, match on `Ok(pat)` instead" . } . . declare_lint_pass!(MatchResultOk => [MATCH_RESULT_OK]); . . impl<'tcx> LateLintPass<'tcx> for MatchResultOk { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . let (let_pat, let_expr, ifwhile) = 1,572,892 ( 0.01%) if let Some(higher::IfLet { let_pat, let_expr, .. }) = higher::IfLet::hir(cx, expr) { 1,966,118 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . (let_pat, let_expr, "if") . } else if let Some(higher::WhileLet { let_pat, let_expr, .. }) = higher::WhileLet::hir(expr) { . (let_pat, let_expr, "while") . } else { . return; . }; . . if let ExprKind::MethodCall(ok_path, recv, [], ..) = let_expr.kind //check is expr.ok() has type Result.ok(, _) -- line 57 ---------------------------------------- -- line 74 ---------------------------------------- . MATCH_RESULT_OK, . expr.span.with_hi(let_expr.span.hi()), . "matching on `Some` with `ok()` is redundant", . format!("consider matching on `Ok({some_expr_string})` and removing the call to `ok` instead"), . sugg, . applicability, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_slice_size_calculation.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . . impl ManualSliceSizeCalculation { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if let ExprKind::Binary(ref op, left, right) = expr.kind 1 ( 0.00%) && BinOpKind::Mul == op.node . && !expr.span.from_expansion() . && let Some((receiver, refs_count)) = simplify(cx, left, right) . && (!is_in_const_context(cx) || self.msrv.meets(cx, msrvs::CONST_SIZE_OF_VAL)) . { . let ctxt = expr.span.ctxt(); . let mut app = Applicability::MachineApplicable; . let deref = if refs_count > 0 { . "*".repeat(refs_count - 1) -- line 65 ---------------------------------------- -- line 74 ---------------------------------------- . MANUAL_SLICE_SIZE_CALCULATION, . expr.span, . "manual slice size calculation", . "try", . format!("{sugg}::mem::size_of_val({deref}{val_name})"), . app, . ); . } 3,145,784 ( 0.02%) } . } . . fn simplify<'tcx>( . cx: &LateContext<'tcx>, . expr1: &'tcx Expr<'tcx>, . expr2: &'tcx Expr<'tcx>, . ) -> Option<(&'tcx Expr<'tcx>, usize)> { . let expr1 = expr_or_init(cx, expr1); -- line 90 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/borrow_deref_ref.rs -------------------------------------------------------------------------------- Ir -- line 46 ---------------------------------------- . pub BORROW_DEREF_REF, . complexity, . "deref on an immutable reference returns the same type as itself" . } . . declare_lint_pass!(BorrowDerefRef => [BORROW_DEREF_REF]); . . impl<'tcx> LateLintPass<'tcx> for BorrowDerefRef { 2,359,338 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, addrof_target) = e.kind . && let ExprKind::Unary(UnOp::Deref, deref_target) = addrof_target.kind . && !matches!(deref_target.kind, ExprKind::Unary(UnOp::Deref, ..)) . && !e.span.from_expansion() . && !deref_target.span.from_expansion() . && !addrof_target.span.from_expansion() . && let ref_ty = cx.typeck_results().expr_ty(deref_target) . && let ty::Ref(_, inner_ty, Mutability::Not) = ref_ty.kind() . && get_parent_expr(cx, e).is_none_or(|parent| { -- line 63 ---------------------------------------- -- line 119 ---------------------------------------- . e.span, . "if you would like to deref, try using `&**`", . format!("&**{deref_text}"), . Applicability::MaybeIncorrect, . ); . }, . ); . } 2,752,561 ( 0.01%) } . } . . /// Checks if `expr` is used as part of a `let` statement containing a `ref mut` binding. . fn potentially_bound_to_mutable_ref<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> bool { . matches!(cx.tcx.parent_hir_node(expr.hir_id), Node::LetStmt(let_stmt) . if let_stmt.pat.contains_explicit_ref_binding() == Some(Mutability::Mut)) . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter_nested.rs -------------------------------------------------------------------------------- Ir -- line 10 ---------------------------------------- . pub(super) trait SpecFromIterNested { . fn from_iter(iter: I) -> Self; . } . . impl SpecFromIterNested for Vec . where . I: Iterator, . { 3,145,972 ( 0.02%) default fn from_iter(mut iterator: I) -> Self { . // Unroll the first iteration, as the vector is going to be . // expanded on this iteration in every case when the iterable is not . // empty, but the loop in extend_desugared() is not going to see the . // vector being full in the few subsequent loop iterations. . // So we get better branch prediction. 49 ( 0.00%) let mut vector = match iterator.next() { 21 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/filter.rs:, core::slice::iter::Iter>>, clippy_lints::ptr::ptr_arg::check_fn_args::{closure#0}>, clippy_lints::ptr::ptr_arg::check_body::{closure#0}> as core::iter::traits::iterator::Iterator>::next (1x) . None => return Vec::new(), 1 ( 0.00%) Some(element) => { . let (lower, _) = iterator.size_hint(); . let initial_capacity = . cmp::max(RawVec::::MIN_NON_ZERO_CAP, lower.saturating_add(1)); . let mut vector = Vec::with_capacity(initial_capacity); . unsafe { . // SAFETY: We requested capacity at least 1 . ptr::write(vector.as_mut_ptr(), element); . vector.set_len(1); . } 28 ( 0.00%) vector . } . }; . // must delegate to spec_extend() since extend() itself delegates . // to spec_from for empty Vecs 127 ( 0.00%) as SpecExtend>::spec_extend(&mut vector, iterator); 30 ( 0.00%) => ???:0x0000000000173dc0 (1x) 42 ( 0.00%) vector 3,539,217 ( 0.02%) } . } . . impl SpecFromIterNested for Vec . where . I: TrustedLen, . { 35 ( 0.00%) fn from_iter(iterator: I) -> Self { . let mut vector = match iterator.size_hint() { . (_, Some(upper)) => Vec::with_capacity(upper), . // TrustedLen contract guarantees that `size_hint() == (_, None)` means that there . // are more than `usize::MAX` elements. . // Since the previous branch would eagerly panic if the capacity is too large . // (via `with_capacity`) we do the same here. . _ => panic!("capacity overflow"), . }; . // reuse extend specialization for TrustedLen . vector.spec_extend(iterator); 18 ( 0.00%) vector 40 ( 0.00%) } . } 42 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/operators/float_cmp.rs -------------------------------------------------------------------------------- Ir -- line 7 ---------------------------------------- . use rustc_hir::def_id::DefId; . use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; . use rustc_lint::LateContext; . use rustc_middle::ty; . use rustc_span::SyntaxContext; . . use super::{FLOAT_CMP, FLOAT_CMP_CONST}; . 3,539,007 ( 0.02%) pub(crate) fn check_assert<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { . if let Some(macro_call) = . first_node_macro_backtrace(cx, e).find(|macro_call| is_assert_eq_diag(cx, macro_call.def_id)) . && let Some((lhs, rhs, _)) = find_assert_eq_args(cx, e, macro_call.expn) . && is_float(cx, lhs) . { . let ecx = ConstEvalCtxt::new(cx); . let ctxt = macro_call.span.ctxt(); . -- line 23 ---------------------------------------- -- line 30 ---------------------------------------- . let msg = if is_comparing_arrays { . "strict comparison of `f32` or `f64` constant arrays" . } else { . "strict comparison of `f32` or `f64` constant" . }; . . clippy_utils::diagnostics::span_lint(cx, FLOAT_CMP_CONST, macro_call.span, msg); . } 3,145,784 ( 0.02%) } . . fn is_float_const(ecx: &ConstEvalCtxt<'_>, expr: &Expr<'_>, ctxt: SyntaxContext) -> bool { . match ecx.eval_with_source(expr, ctxt) { . Some((c, s)) if !is_allowed(&c) => !s.is_local(), . _ => false, . } . } . . fn is_assert_eq_diag(cx: &LateContext<'_>, def_id: DefId) -> bool { 6 ( 0.00%) matches!( 4 ( 0.00%) cx.tcx.get_diagnostic_name(def_id), 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::assert_eq_macro | sym::assert_ne_macro | sym::debug_assert_eq_macro | sym::debug_assert_ne_macro) . ) . } . . fn is_inside_assert_eq(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { . macro_backtrace(expr.span).any(|mc| is_assert_eq_diag(cx, mc.def_id)) . } . 12 ( 0.00%) pub(crate) fn check<'tcx>( . cx: &LateContext<'tcx>, . expr: &'tcx Expr<'_>, . op: BinOpKind, . left: &'tcx Expr<'_>, . right: &'tcx Expr<'_>, . ) { 7 ( 0.00%) if (op == BinOpKind::Eq || op == BinOpKind::Ne) && is_float(cx, left) { . // Skip if inside assert_eq!/assert_ne! macro to avoid double-linting . // (handled by check_assert) . if is_inside_assert_eq(cx, expr) { . return; . } . . let ecx = ConstEvalCtxt::new(cx); . let ctxt = expr.span.ctxt(); -- line 73 ---------------------------------------- -- line 108 ---------------------------------------- . lhs - rhs, . if op == BinOpKind::Eq { '<' } else { '>' } . ), . Applicability::HasPlaceholders, // snippet . ); . } . }); . } 8 ( 0.00%) } . . fn get_lint_and_message(is_local: bool, is_comparing_arrays: bool) -> (&'static rustc_lint::Lint, &'static str) { . if is_local { . ( . FLOAT_CMP, . if is_comparing_arrays { . "strict comparison of `f32` or `f64` arrays" . } else { -- line 124 ---------------------------------------- -- line 164 ---------------------------------------- . // the method call) . { . return is_float(cx, self_arg); . } . false . } . . fn is_float(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { 3 ( 0.00%) let value = &cx.typeck_results().expr_ty(expr).peel_refs().kind(); 40 ( 0.00%) => ???:::expr_ty (1x) . . if let ty::Array(arr_ty, _) = value { . return matches!(arr_ty.kind(), ty::Float(_)); . } . . matches!(value, ty::Float(_)) . } . -- line 180 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/redundant_async_block.rs -------------------------------------------------------------------------------- Ir -- line 35 ---------------------------------------- . pub REDUNDANT_ASYNC_BLOCK, . complexity, . "`async { future.await }` can be replaced by `future`" . } . . declare_lint_pass!(RedundantAsyncBlock => [REDUNDANT_ASYNC_BLOCK]); . . impl<'tcx> LateLintPass<'tcx> for RedundantAsyncBlock { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 393,223 ( 0.00%) let span = expr.span; 1,572,892 ( 0.01%) if !span.in_external_macro(cx.tcx.sess.source_map()) && 3,145,744 ( 0.02%) let Some(body_expr) = desugar_async_block(cx, expr) && 3,932,180 ( 0.02%) => site/frontend/rust-clippy/clippy_lints/src/redundant_async_block.rs:clippy_lints::redundant_async_block::desugar_async_block (393,218x) . let Some(expr) = desugar_await(peel_blocks(body_expr)) && . // The await prefix must not come from a macro as its content could change in the future. . expr.span.eq_ctxt(body_expr.span) && . // The await prefix must implement Future, as implementing IntoFuture is not enough. . let Some(future_trait) = cx.tcx.lang_items().future_trait() && . implements_trait(cx, cx.typeck_results().expr_ty(expr), future_trait, &[]) && . // An async block does not have immediate side-effects from a `.await` point-of-view. . (!expr.can_have_side_effects() || desugar_async_block(cx, expr).is_some()) && -- line 54 ---------------------------------------- -- line 59 ---------------------------------------- . REDUNDANT_ASYNC_BLOCK, . span, . "this async expression only awaits a single future", . "you can reduce it to", . snippet(cx, shortened_span, "..").into_owned(), . Applicability::MachineApplicable, . ); . } 3,145,784 ( 0.02%) } . } . . /// If `expr` is a desugared `async` block, return the original expression if it does not capture . /// any variable by ref. 1,179,654 ( 0.01%) fn desugar_async_block<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { 786,436 ( 0.00%) if let ExprKind::Closure(Closure { body, def_id, kind, .. }) = expr.kind . && let body = cx.tcx.hir_body(*body) . && matches!( . kind, . ClosureKind::Coroutine(CoroutineKind::Desugared( . CoroutineDesugaring::Async, . CoroutineSource::Block . )) . ) -- line 81 ---------------------------------------- -- line 89 ---------------------------------------- . .iter() . .all(|place| matches!(place.info.capture_kind, UpvarCapture::ByValue)) . }) . }) . .then_some(body.value) . } else { . None . } 1,572,872 ( 0.01%) } 393,218 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/reference.rs -------------------------------------------------------------------------------- Ir -- line 34 ---------------------------------------- . pub DEREF_ADDROF, . complexity, . "use of `*&` or `*&mut` in an expression" . } . . declare_lint_pass!(DerefAddrOf => [DEREF_ADDROF]); . . impl LateLintPass<'_> for DerefAddrOf { 2,359,338 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, e: &Expr<'_>) { 786,452 ( 0.00%) if !e.span.from_expansion() . && let ExprKind::Unary(UnOp::Deref, deref_target) = e.kind . && !deref_target.span.from_expansion() . && let ExprKind::AddrOf(_, _, addrof_target) = deref_target.kind . // NOTE(tesuji): `*&` forces rustc to const-promote the array to `.rodata` section. . // See #12854 for details. . && !matches!(addrof_target.kind, ExprKind::Array(_)) . && deref_target.span.eq_ctxt(e.span) . && !addrof_target.span.from_expansion() -- line 51 ---------------------------------------- -- line 73 ---------------------------------------- . DEREF_ADDROF, . e.span, . "immediately dereferencing a reference", . "try", . sugg.to_string(), . applicability, . ); . } 2,359,338 ( 0.01%) } . } . . /// Is this a `ManuallyDrop` reached through a union, and when is `DerefMut` called on it? . enum ManuallyDropThroughUnion { . /// `ManuallyDrop` reached through a union and immediately explicitely dereferenced . Directly, . /// `ManuallyDrop` reached through a union, and dereferenced later on . Indirect, -- line 89 ---------------------------------------- 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/cast_slice_from_raw_parts.rs -------------------------------------------------------------------------------- Ir -- line 54 ---------------------------------------- . "replace with", . format!("{krate}::ptr::slice_{func}({ptr}, {len})"), . applicability, . ); . } . } . . /// Checks for implicit cast from slice reference to raw slice pointer. 3,145,784 ( 0.02%) pub(super) fn check_implicit_cast(cx: &LateContext<'_>, expr: &Expr<'_>) { 4 ( 0.00%) if let ExprKind::Call(fun, [ptr_arg, len_arg]) = expr.peel_blocks().kind . && let ExprKind::Path(ref qpath) = fun.kind . && let Some(fun_def_id) = cx.qpath_res(qpath, fun.hir_id).opt_def_id() . && let Some(rpk) = raw_parts_kind(cx, fun_def_id) . && !matches!(get_parent_expr(cx, expr).map(|e| e.kind), Some(ExprKind::Cast(..))) . && let [deref, borrow] = cx.typeck_results().expr_adjustments(expr) . && matches!(deref.kind, Adjust::Deref(..)) . && let Adjustment { . kind: Adjust::Borrow(AutoBorrow::RawPtr(..)), -- line 71 ---------------------------------------- -- line 89 ---------------------------------------- . CAST_SLICE_FROM_RAW_PARTS, . expr.span, . format!("implicitly casting the result of `{func}` to `{target}`"), . "replace_with", . format!("{krate}::ptr::slice_{func}({ptr}, {len})"), . applicability, . ); . } 3,145,784 ( 0.02%) } 393,223 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/ranges.rs -------------------------------------------------------------------------------- Ir -- line 184 ---------------------------------------- . . impl Ranges { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for Ranges { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Binary(ref op, l, r) = expr.kind 1 ( 0.00%) && matches!( 2 ( 0.00%) op.node, . BinOpKind::And | BinOpKind::BitAnd | BinOpKind::Or | BinOpKind::BitOr . ) . && self.msrv.meets(cx, msrvs::RANGE_CONTAINS) . && !is_in_const_context(cx) . { . check_possible_range_contains(cx, op.node, l, r, expr, expr.span); . } . 2,359,338 ( 0.01%) if let Some(range) = higher::Range::hir(cx, expr) { 17,695,049 ( 0.09%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . check_exclusive_range_plus_one(cx, expr, &range); . check_inclusive_range_minus_one(cx, expr, &range); . check_reversed_empty_range(cx, expr, &range); . } 3,145,784 ( 0.02%) } . } . . fn check_possible_range_contains( . cx: &LateContext<'_>, . op: BinOpKind, . left: &Expr<'_>, . right: &Expr<'_>, . expr: &Expr<'_>, -- line 217 ---------------------------------------- 393,223 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/bit_width.rs -------------------------------------------------------------------------------- Ir -- line 93 ---------------------------------------- . . impl ManualBitWidth { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl LateLintPass<'_> for ManualBitWidth { 3,932,230 ( 0.02%) fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 1,179,669 ( 0.01%) if expr.span.in_external_macro(cx.sess().source_map()) { . return; . } . 786,438 ( 0.00%) match expr.kind { . // `T::BITS - n.leading_zeros()` . ExprKind::Binary(op, left, right) . if op.node == BinOpKind::Sub . && let ExprKind::MethodCall(leading_zeros, recv, [], _) = right.kind . && leading_zeros.ident.name == sym::leading_zeros . && let ExprKind::Path(QPath::TypeRelative(hir_ty, segment)) = left.kind . && segment.ident.name == sym::BITS . && let right_ty = cx.typeck_results().expr_ty(recv) -- line 114 ---------------------------------------- -- line 124 ---------------------------------------- . emit_manual_bit_width(cx, recv, expr, right_int_kind); . } else { . // mismatched calling types . emit_type_mismatch(cx, recv, expr, right_int_kind); . } . }, . _ => {}, . } 3,145,784 ( 0.02%) } . } . . fn get_int_kind<'a>(cx: &LateContext<'a>, ty: Ty<'a>) -> Option> { . match ty.kind() { . // int::BITS or uint::BITS . ty::Int(int_ty) => Some(IntKind::Int(*int_ty)), . ty::Uint(uint_ty) => Some(IntKind::Uint(*uint_ty)), . // NonZero::::BITS -- line 140 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/disallowed_methods.rs -------------------------------------------------------------------------------- Ir -- line 64 ---------------------------------------- . impl_lint_pass!(DisallowedMethods => [DISALLOWED_METHODS]); . . pub struct DisallowedMethods { . disallowed: DefIdMap<(&'static str, &'static DisallowedPath)>, . } . . impl DisallowedMethods { . pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { 10 ( 0.00%) let (disallowed, _) = create_disallowed_map( 38 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_config/src/types.rs:clippy_config::types::create_disallowed_map::::new::{closure#0}> (1x) . tcx, . &conf.disallowed_methods, . PathNS::Value, . |def_kind| { . matches!( . def_kind, . DefKind::Fn | DefKind::Ctor(_, CtorKind::Fn) | DefKind::AssocFn . ) . }, . "function", . false, 1 ( 0.00%) ); 4 ( 0.00%) Self { disallowed } . } . } . . impl<'tcx> LateLintPass<'tcx> for DisallowedMethods { 1,966,115 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 393,223 ( 0.00%) if self.disallowed.is_empty() { . return; . } . if expr.span.desugaring_kind().is_some() { . return; . } . let (id, span) = match &expr.kind { . ExprKind::Path(path) if let Res::Def(_, id) = cx.qpath_res(path, expr.hir_id) => (id, expr.span), . ExprKind::MethodCall(name, ..) if let Some(id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => { -- line 99 ---------------------------------------- -- line 105 ---------------------------------------- . span_lint_and_then( . cx, . DISALLOWED_METHODS, . span, . format!("use of a disallowed method `{path}`"), . disallowed_path.diag_amendment(span), . ); . } 2,359,338 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_main_separator_str.rs -------------------------------------------------------------------------------- Ir -- line 41 ---------------------------------------- . . impl ManualMainSeparatorStr { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl LateLintPass<'_> for ManualMainSeparatorStr { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 786,446 ( 0.00%) let (target, _) = peel_hir_expr_refs(expr); 1,966,115 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::peel_hir_expr_refs (393,223x) 786,449 ( 0.00%) if let ExprKind::MethodCall(path, receiver, &[], _) = target.kind 1 ( 0.00%) && path.ident.name == sym::to_string . && let ExprKind::Path(QPath::Resolved(None, path)) = receiver.kind . && let Res::Def(DefKind::Const { .. }, receiver_def_id) = path.res . && cx.ty_based_def(target).opt_parent(cx).is_diag_item(cx, sym::ToString) . && cx.tcx.is_diagnostic_item(sym::path_main_separator, receiver_def_id) . && let ty::Ref(_, ty, Mutability::Not) = cx.typeck_results().expr_ty_adjusted(expr).kind() . && ty.is_str() . && self.msrv.meets(cx, msrvs::PATH_MAIN_SEPARATOR_STR) . { -- line 60 ---------------------------------------- -- line 63 ---------------------------------------- . MANUAL_MAIN_SEPARATOR_STR, . expr.span, . "taking a reference on `std::path::MAIN_SEPARATOR` conversion to `String`", . "replace with", . "std::path::MAIN_SEPARATOR_STR".to_owned(), . Applicability::MachineApplicable, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/zero_div_zero.rs -------------------------------------------------------------------------------- Ir -- line 24 ---------------------------------------- . pub ZERO_DIVIDED_BY_ZERO, . complexity, . "usage of `0.0 / 0.0` to obtain NaN instead of `f32::NAN` or `f64::NAN`" . } . . declare_lint_pass!(ZeroDiv => [ZERO_DIVIDED_BY_ZERO]); . . impl<'tcx> LateLintPass<'tcx> for ZeroDiv { 2,359,338 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // check for instances of 0.0/0.0 786,446 ( 0.00%) if let ExprKind::Binary(ref op, left, right) = expr.kind 1 ( 0.00%) && op.node == BinOpKind::Div . // TODO - constant_simple does not fold many operations involving floats. . // That's probably fine for this lint - it's pretty unlikely that someone would . // do something like 0.0/(2.0 - 2.0), but it would be nice to warn on that case too. . && let ecx = ConstEvalCtxt::new(cx) . && let ctxt = expr.span.ctxt() . && let Some(lhs_value) = ecx.eval_local(left, ctxt) . && let Some(rhs_value) = ecx.eval_local(right, ctxt) . // FIXME(f16_f128): add these types when eq is available on all platforms -- line 43 ---------------------------------------- -- line 54 ---------------------------------------- . cx, . ZERO_DIVIDED_BY_ZERO, . expr.span, . "constant division of `0.0` with `0.0` will always result in NaN", . None, . format!("consider using `{float_type}::NAN` if you would like a constant representing NaN"), . ); . } 2,752,561 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs -------------------------------------------------------------------------------- Ir -- line 2128 ---------------------------------------- . // `ArcInner` structure itself is `Sync` because the inner data is . // `Sync` as well, so we're ok loaning out an immutable pointer to these . // contents. . unsafe { self.ptr.as_ref() } . } . . // Non-inlined part of `drop`. . #[inline(never)] 2 ( 0.00%) unsafe fn drop_slow(&mut self) { . // Drop the weak ref collectively held by all strong references when this . // variable goes out of scope. This ensures that the memory is deallocated . // even if the destructor of `T` panics. . // Take a reference to `self.alloc` instead of cloning because 1. it'll last long . // enough, and 2. you should be able to drop `Arc`s with unclonable allocators 2 ( 0.00%) let _weak = Weak { ptr: self.ptr, alloc: &self.alloc }; . . // Destroy the data at this time, even though we must not free the box . // allocation itself (there might still be weak pointers lying around). . // We cannot use `get_mut_unchecked` here, because `self.alloc` is borrowed. . unsafe { ptr::drop_in_place(&mut (*self.ptr.as_ptr()).data) }; . } . . /// Returns `true` if the two `Arc`s point to the same allocation in a vein similar to -- line 2150 ---------------------------------------- -- line 2424 ---------------------------------------- . // the worst already happened and we actually do overflow the `usize` counter. However, that . // requires the counter to grow from `isize::MAX` to `usize::MAX` between the increment . // above and the `abort` below, which seems exceedingly unlikely. . // . // This is a global invariant, and also applies when using a compare-exchange loop to increment . // counters in other methods. . // Otherwise, the counter could be brought to an almost-overflow using a compare-exchange loop, . // and then overflow using a few `fetch_add`s. 55 ( 0.00%) if old_size > MAX_REFCOUNT { . abort(); . } . 88 ( 0.00%) unsafe { Self::from_inner_in(self.ptr, self.alloc.clone()) } . } . } . . #[unstable(feature = "ergonomic_clones", issue = "132290")] . impl UseCloned for Arc {} . . #[unstable(feature = "share_trait", issue = "156756")] . impl Share for Arc {} . . #[stable(feature = "rust1", since = "1.0.0")] . impl Deref for Arc { . type Target = T; . . #[inline] . fn deref(&self) -> &T { 3,799,052 ( 0.02%) &self.inner().data . } . } . . #[unstable(feature = "pin_coerce_unsized_trait", issue = "150112")] . unsafe impl PinCoerceUnsized for Arc {} . . #[unstable(feature = "deref_pure_trait", issue = "87121")] . unsafe impl DerefPure for Arc {} -- line 2460 ---------------------------------------- -- line 2850 ---------------------------------------- . /// drop(foo); // Doesn't print anything . /// drop(foo2); // Prints "dropped!" . /// ``` . #[inline] . fn drop(&mut self) { . // Because `fetch_sub` is already atomic, we do not need to synchronize . // with other threads unless we are going to delete the object. This . // same logic applies to the below `fetch_sub` to the `weak` count. 653,288 ( 0.00%) if self.inner().strong.fetch_sub(1, Release) != 1 { . return; . } . . // This fence is needed to prevent reordering of use of the data and . // deletion of the data. Because it is marked `Release`, the decreasing . // of the reference count synchronizes with this `Acquire` fence. This . // means that use of the data happens before decreasing the reference . // count, which happens before this fence, which happens before the -- line 2866 ---------------------------------------- -- line 2893 ---------------------------------------- . // used by Default::default. . debug_assert!( . !ptr::addr_eq(self.ptr.as_ptr(), &STATIC_INNER_SLICE.inner), . "Arcs backed by a static should never reach a strong count of 0. \ . Likely decrement_strong_count or from_raw were called too many times.", . ); . . unsafe { 6 ( 0.00%) self.drop_slow(); 100 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:>>>::drop_slow (1x) 75 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:>>>::drop_slow (1x) . } . } . } . . impl Arc { . /// Attempts to downcast the `Arc` to a concrete type. . /// . /// # Examples -- line 2909 ---------------------------------------- -- line 3372 ---------------------------------------- . } . } . . /// Returns `None` when the pointer is dangling and there is no allocated `ArcInner`, . /// (i.e., when this `Weak` was created by `Weak::new`). . #[inline] . fn inner(&self) -> Option> { . let ptr = self.ptr.as_ptr(); 2 ( 0.00%) if is_dangling(ptr) { . None . } else { . // We are careful to *not* create a reference covering the "data" field, as . // the field may be mutated concurrently (for example, if the last `Arc` . // is dropped, the data field will be dropped in-place). . Some(unsafe { WeakInner { strong: &(*ptr).strong, weak: &(*ptr).weak } }) . } . } -- line 3388 ---------------------------------------- -- line 3524 ---------------------------------------- . // the memory orderings . // . // It's not necessary to check for the locked state here, because the . // weak count can only be locked if there was precisely one weak ref, . // meaning that drop could only subsequently run ON that remaining weak . // ref, which can only happen after the lock is released. . let inner = if let Some(inner) = self.inner() { inner } else { return }; . 2 ( 0.00%) if inner.weak.fetch_sub(1, Release) == 1 { . acquire!(inner.weak); . . // Make sure we aren't trying to "deallocate" the shared static for empty slices . // used by Default::default. . debug_assert!( . !ptr::addr_eq(self.ptr.as_ptr(), &STATIC_INNER_SLICE.inner), . "Arc/Weaks backed by a static should never be deallocated. \ . Likely decrement_strong_count or from_raw were called too many times.", -- line 3540 ---------------------------------------- 11,272,417 ( 0.06%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/permissions_set_readonly_false.rs -------------------------------------------------------------------------------- Ir -- line 27 ---------------------------------------- . "Checks for calls to `std::fs::Permissions.set_readonly` with argument `false`" . } . . declare_lint_pass!(PermissionsSetReadonlyFalse => [ . PERMISSIONS_SET_READONLY_FALSE, . ]); . . impl<'tcx> LateLintPass<'tcx> for PermissionsSetReadonlyFalse { 1,179,669 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,448 ( 0.00%) if let ExprKind::MethodCall(path, receiver, [arg], _) = &expr.kind . && let ExprKind::Lit(lit) = &arg.kind . && LitKind::Bool(false) == lit.node . && path.ident.name == sym::set_readonly . && cx . .typeck_results() . .expr_ty(receiver) . .is_diag_item(cx, sym::FsPermissions) . { -- line 44 ---------------------------------------- -- line 51 ---------------------------------------- . diag.note("on Unix platforms this results in the file being world writable"); . diag.help( . "you can set the desired permissions using `PermissionsExt`. For more information, see\n\ . https://doc.rust-lang.org/std/os/unix/fs/trait.PermissionsExt.html", . ); . }, . ); . } 1,572,892 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/source.rs -------------------------------------------------------------------------------- Ir -- line 46 ---------------------------------------- . #[inline] . fn source_map(self) -> &'sm SourceMap { . ::rustc_lint::LintContext::sess(self).source_map() . } . } . impl<'sm> HasSourceMap<'sm> for &LateContext<'sm> { . #[inline] . fn source_map(self) -> &'sm SourceMap { 6 ( 0.00%) self.tcx.sess.source_map() . } . } . . /// Conversion of a value into the range portion of a `Span`. . pub trait SpanRange: Sized { . fn into_range(self) -> Range; . } . impl SpanRange for Span { 1,633,060 ( 0.01%) fn into_range(self) -> Range { . let data = self.data(); 653,224 ( 0.00%) data.lo..data.hi 653,224 ( 0.00%) } . } . impl SpanRange for SpanData { . fn into_range(self) -> Range { . self.lo..self.hi . } . } . impl SpanRange for Range { . fn into_range(self) -> Range { -- line 74 ---------------------------------------- -- line 104 ---------------------------------------- . fn with_ctxt(self, ctxt: SyntaxContext) -> Span { . Span::new(self.start, self.end, ctxt, None) . } . } . . pub trait SpanExt: SpanRange { . /// Attempts to get a handle to the source text. Returns `None` if either the span is malformed, . /// or the source text is not accessible. 257,860 ( 0.00%) fn get_text<'sm>(self, sm: impl HasSourceMap<'sm>) -> Option { 2,088,579 ( 0.01%) get_source_range(sm.source_map(), self.into_range()).and_then(SourceText::new) 323 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/source.rs:clippy_utils::source::get_source_range (1x) 42 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/source.rs:::into_range (1x) 322,325 ( 0.00%) } . . /// Gets the source file, and range in the file, of the given span. Returns `None` if the span . /// extends through multiple files, or is malformed. . fn get_source_range<'sm>(self, sm: impl HasSourceMap<'sm>) -> Option { . get_source_range(sm.source_map(), self.into_range()) . } . . /// Calls the given function with the source text referenced and returns the value. Returns . /// `None` if the source text cannot be retrieved. 5 ( 0.00%) fn with_source_text<'sm, T>(self, sm: impl HasSourceMap<'sm>, f: impl for<'a> FnOnce(&'a str) -> T) -> Option { 17 ( 0.00%) with_source_text(sm.source_map(), self.into_range(), f) 42 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/source.rs:::into_range (1x) 6 ( 0.00%) } . . /// Checks if the referenced source text satisfies the given predicate. Returns `false` if the . /// source text cannot be retrieved. . fn check_text<'sm>(self, sm: impl HasSourceMap<'sm>, pred: impl for<'a> FnOnce(&'a str) -> bool) -> bool { 1 ( 0.00%) self.with_source_text(sm, pred).unwrap_or(false) 146,051,630 ( 0.72%) => site/frontend/rust-clippy/clippy_utils/src/source.rs:::with_source_text::::{closure#0}> (1x) . } . . /// Calls the given function with the both the text of the source file and the referenced range, . /// and returns the value. Returns `None` if the source text cannot be retrieved. . fn with_source_text_and_range<'sm, T>( . self, . sm: impl HasSourceMap<'sm>, . f: impl for<'a> FnOnce(&'a str, Range) -> T, -- line 139 ---------------------------------------- -- line 177 ---------------------------------------- . } . } . impl SpanExt for T {} . . /// Handle to a range of text in a source file. . pub struct SourceText(SourceFileRange); . impl SourceText { . /// Takes ownership of the source file handle if the source text is accessible. 326,608 ( 0.00%) pub fn new(text: SourceFileRange) -> Option { . if text.as_str().is_some() { 1,306,432 ( 0.01%) Some(Self(text)) . } else { . None . } 326,608 ( 0.00%) } . . /// Gets the source text. . pub fn as_str(&self) -> &str { . self.0.as_str().unwrap() . } . . /// Converts this into an owned string. . pub fn to_owned(&self) -> String { . self.as_str().to_owned() . } . } . impl Deref for SourceText { . type Target = str; . fn deref(&self) -> &Self::Target { . self.as_str() 326,608 ( 0.00%) } . } . impl AsRef for SourceText { . fn as_ref(&self) -> &str { . self.as_str() . } . } . impl Index for SourceText . where -- line 215 ---------------------------------------- -- line 226 ---------------------------------------- . } . } . impl fmt::Debug for SourceText { . fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { . self.as_str().fmt(f) . } . } . 3,266,120 ( 0.02%) fn get_source_range(sm: &SourceMap, sp: Range) -> Option { 2,612,896 ( 0.01%) let start = sm.lookup_byte_offset(sp.start); 40,499,888 ( 0.20%) => ???:::lookup_byte_offset (326,612x) 1,633,060 ( 0.01%) let end = sm.lookup_byte_offset(sp.end); 40,499,888 ( 0.20%) => ???:::lookup_byte_offset (326,612x) 979,836 ( 0.00%) if !Arc::ptr_eq(&start.sf, &end.sf) || start.pos > end.pos { . return None; . } 979,836 ( 0.00%) sm.ensure_source_file_source_present(&start.sf); 7,512,076 ( 0.04%) => ???:::ensure_source_file_source_present (326,612x) . let range = start.pos.to_usize()..end.pos.to_usize(); 1,306,448 ( 0.01%) Some(SourceFileRange { sf: start.sf, range }) 2,939,508 ( 0.01%) } . 22 ( 0.00%) fn with_source_text(sm: &SourceMap, sp: Range, f: impl for<'a> FnOnce(&'a str) -> T) -> Option { 34 ( 0.00%) if let Some(src) = get_source_range(sm, sp) 323 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/source.rs:clippy_utils::source::get_source_range (1x) 7 ( 0.00%) && let Some(src) = src.as_str() 28 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::as_str (1x) . { . Some(f(src)) . } else { . None . } 16 ( 0.00%) } . . fn with_source_text_and_range( . sm: &SourceMap, . sp: Range, . f: impl for<'a> FnOnce(&'a str, Range) -> T, . ) -> Option { . if let Some(src) = get_source_range(sm, sp) . && let Some(text) = &src.sf.src -- line 261 ---------------------------------------- -- line 355 ---------------------------------------- . } . impl SourceFileRange { . /// Attempts to get the text from the source file. This can fail if the source text isn't . /// loaded. . pub fn as_str(&self) -> Option<&str> { . (self.sf.src.as_ref().map(|src| src.as_str())) . .or_else(|| self.sf.external_src.get()?.get_source()) . .and_then(|x| x.get(self.range.clone())) 2 ( 0.00%) } . } . . /// Like [`snippet_block`], but add braces if the expr is not an `ExprKind::Block` with no label. . pub fn expr_block<'sm>( . sm: impl HasSourceMap<'sm>, . expr: &Expr<'_>, . outer: SyntaxContext, . default: &str, -- line 371 ---------------------------------------- -- line 583 ---------------------------------------- . *applicability = Applicability::HasPlaceholders; . } . Cow::Borrowed(default) . } . } . . /// Converts a span to a code snippet. Returns `None` if not available. . pub fn snippet_opt<'sm>(sm: impl HasSourceMap<'sm>, span: Span) -> Option { 131,077 ( 0.00%) sm.source_map().span_to_snippet(span).ok() 377 ( 0.00%) => ???:::span_to_snippet (1x) . } . . /// Converts a span (from a block) to a code snippet if available, otherwise use default. . /// . /// This trims the code of indentation, except for the first line. Use it for blocks or block-like . /// things which need to be printed as such. . /// . /// The `indent_relative_to` arg can be used, to provide a span, where the indentation of the -- line 599 ---------------------------------------- 1,306,444 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/incompatible_msrv.rs -------------------------------------------------------------------------------- Ir -- line 80 ---------------------------------------- . Since(RustcVersion), . } . . /// All known std crates containing a stability attribute. . struct StdCrates([Option; 6]); . impl StdCrates { . fn new(tcx: TyCtxt<'_>) -> Self { . let mut res = Self([None; _]); 38 ( 0.00%) for &krate in tcx.crates(()) { . // FIXME(@Jarcho): We should have an internal lint to detect when this list is out of date. . match tcx.crate_name(krate) { 142 ( 0.00%) sym::alloc => res.0[0] = Some(krate), . sym::core => res.0[1] = Some(krate), . sym::core_arch => res.0[2] = Some(krate), . sym::proc_macro => res.0[3] = Some(krate), . sym::std => res.0[4] = Some(krate), . sym::std_detect => res.0[5] = Some(krate), . _ => {}, . } . } -- line 99 ---------------------------------------- -- line 112 ---------------------------------------- . std_crates: StdCrates, . . // The most recently called path. Used to skip checking the path after it's . // been checked when visiting the call expression. . called_path: Option, . } . . impl IncompatibleMsrv { 9 ( 0.00%) pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { 19 ( 0.00%) Self { 2 ( 0.00%) msrv: conf.msrv.into(), . availability_cache: FxHashMap::default(), 1 ( 0.00%) check_in_tests: conf.check_incompatible_msrv_in_tests, . std_crates: StdCrates::new(tcx), . called_path: None, . } 8 ( 0.00%) } . . /// Returns the availability of `def_id`, whether it is enabled through a feature or . /// available since a given version (the default being Rust 1.0.0). `needs_const` requires . /// the `const`-stability to be looked up instead of the stability in non-`const` contexts. . fn get_def_id_availability(&mut self, tcx: TyCtxt<'_>, def_id: DefId, needs_const: bool) -> Availability { . if let Some(availability) = self.availability_cache.get(&(def_id, needs_const)) { . return *availability; . } -- line 136 ---------------------------------------- -- line 161 ---------------------------------------- . patch: 0, . }) . }; . self.availability_cache.insert((def_id, needs_const), version); . version . } . . /// Emit lint if `def_id`, associated with `node` and `span`, is below the current MSRV. 45 ( 0.00%) fn emit_lint_if_under_msrv( . &mut self, . cx: &LateContext<'_>, . needs_const: bool, . def_id: DefId, . node: HirId, . span: Span, . ) { . if !self.std_crates.contains(def_id.krate) { . // No stability attributes to lookup for these items. . return; . } . // Use `from_expansion` to fast-path the common case. . if span.from_expansion() { . let expn = span.ctxt().outer_expn_data(); 6 ( 0.00%) match expn.kind { . // FIXME(@Jarcho): Check that the actual desugaring or std macro is supported by the . // current MSRV. Note that nested expansions need to be handled as well. . ExpnKind::AstPass(_) | ExpnKind::Desugaring(_) => return, 1 ( 0.00%) ExpnKind::Macro(..) if expn.macro_def_id.is_some_and(|did| self.std_crates.contains(did.krate)) => { . return; . }, . // All other expansions share the target's MSRV. . // FIXME(@Jarcho): What should we do about version dependant macros from external crates? . _ => {}, . } . } . . // Check `is_in_test` last as it walks the HIR parent chain. 8 ( 0.00%) if let Some(current) = self.msrv.current(cx) 10 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::current (1x) . && let Availability::Since(version) = self.get_def_id_availability(cx.tcx, def_id, needs_const) . && version > current . && (self.check_in_tests || !is_in_test(cx.tcx, node)) . { . span_lint_and_then( . cx, . INCOMPATIBLE_MSRV, . span, -- line 206 ---------------------------------------- -- line 210 ---------------------------------------- . ), . |diag| { . if is_under_cfg_attribute(cx, node) { . diag.note_once("you may want to conditionally increase the MSRV considered by Clippy using the `clippy::msrv` attribute"); . } . }, . ); . } 24 ( 0.00%) } . } . . impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 2,752,555 ( 0.01%) match expr.kind { . ExprKind::MethodCall(_, _, _, span) => { 7 ( 0.00%) if let Some(method_did) = cx.typeck_results().type_dependent_def_id(expr.hir_id) { 51 ( 0.00%) => ???:::type_dependent_def_id (1x) 12 ( 0.00%) self.emit_lint_if_under_msrv(cx, is_in_const_context(cx), method_did, expr.hir_id, span); 331 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_in_const_context (1x) 62 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/incompatible_msrv.rs:::emit_lint_if_under_msrv (1x) . } . }, 7 ( 0.00%) ExprKind::Call(callee, _) if let ExprKind::Path(qpath) = callee.kind => { 2 ( 0.00%) self.called_path = Some(callee.hir_id); 3 ( 0.00%) let needs_const = is_in_const_context(cx); 331 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_in_const_context (1x) 6 ( 0.00%) let def_id = if let Some(def_id) = cx.qpath_res(&qpath, callee.hir_id).opt_def_id() { 23 ( 0.00%) => ???:::qpath_res (1x) . def_id . } else if needs_const && let ty::FnDef(def_id, _) = *cx.typeck_results().expr_ty(callee).kind() { . // Edge case where a function is first assigned then called. . // We previously would have warned for the non-const MSRV, when . // checking the path, but now that it's called the const MSRV . // must also be met. . def_id . } else { . return; . }; 7 ( 0.00%) self.emit_lint_if_under_msrv(cx, needs_const, def_id, expr.hir_id, callee.span); . }, . // Desugaring into function calls by the compiler will use `QPath::LangItem` variants. Those should . // not be linted as they will not be generated in older compilers if the function is not available, . // and the compiler is allowed to call unstable functions. 2 ( 0.00%) ExprKind::Path(qpath) 18 ( 0.00%) if let Some(path_def_id) = cx.qpath_res(&qpath, expr.hir_id).opt_def_id() 46 ( 0.00%) => ???:::qpath_res (2x) . && self.called_path != Some(expr.hir_id) => . { 7 ( 0.00%) self.emit_lint_if_under_msrv(cx, false, path_def_id, expr.hir_id, expr.span); . }, . _ => {}, . } 3,145,784 ( 0.02%) } . . fn check_ty(&mut self, cx: &LateContext<'tcx>, hir_ty: &'tcx hir::Ty<'tcx, AmbigArg>) { 30 ( 0.00%) if let hir::TyKind::Path(qpath) = hir_ty.kind 32 ( 0.00%) && let Some(ty_def_id) = cx.qpath_res(&qpath, hir_ty.hir_id).opt_def_id() 92 ( 0.00%) => ???:::qpath_res (4x) . // `CStr` and `CString` have been moved around but have been available since Rust 1.0.0 . && !matches!(cx.tcx.get_diagnostic_name(ty_def_id), Some(sym::cstr_type | sym::cstring_type)) . { . self.emit_lint_if_under_msrv(cx, false, ty_def_id, hir_ty.hir_id, hir_ty.span); . } . } . } . -- line 268 ---------------------------------------- 12 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/async_yields_async.rs -------------------------------------------------------------------------------- Ir -- line 43 ---------------------------------------- . pub ASYNC_YIELDS_ASYNC, . correctness, . "async blocks that return a type that can be awaited" . } . . declare_lint_pass!(AsyncYieldsAsync => [ASYNC_YIELDS_ASYNC]); . . impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) let ExprKind::Closure(Closure { . kind: ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, kind)), . body: body_id, . .. . }) = expr.kind . else { . return; . }; . -- line 60 ---------------------------------------- -- line 118 ---------------------------------------- . return_expr_span, . "consider awaiting this value", . format!("{return_expr_snip}.await"), . applicability, . ); . }, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/needless_nonzero_get.rs -------------------------------------------------------------------------------- Ir -- line 59 ---------------------------------------- . . impl NeedlessNonzeroGet { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for NeedlessNonzeroGet { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 2,752,555 ( 0.01%) match expr.kind { . // `.get().()` 2 ( 0.00%) ExprKind::MethodCall(method, get_call, [], _) 12 ( 0.00%) if let Some((recv, nz_ty, nonzero_did, get_span)) = nonzero_get(cx, get_call) 15 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/needless_nonzero_get.rs:clippy_lints::needless_nonzero_get::nonzero_get (1x) . // The outer call must resolve to an inherent method. A trait method of the same . // name could resolve differently once the receiver becomes a `NonZero`. . && let Some(method_did) = cx.typeck_results().type_dependent_def_id(expr.hir_id) . && cx.tcx.trait_of_assoc(method_did).is_none() . // Dropping `get` must leave the expression's type unchanged. Methods whose . // `NonZero` version returns a `NonZero` deliberately do not match. . && let ret_ty = cx.typeck_results().expr_ty(expr) . && has_matching_method(cx, nonzero_did, nz_ty, method.ident.name, ret_ty, self.msrv) => . { . emit_unnecessary_get(cx, expr, get_call, recv, get_span, method.ident.name.as_str()); . }, . . // ` / .get()` and ` % .get()` . ExprKind::Binary(op, lhs, get_call) 4 ( 0.00%) if matches!(op.node, BinOpKind::Div | BinOpKind::Rem) . && let Some((recv, nz_ty, _, get_span)) = nonzero_get(cx, get_call) . && let Some((trait_lang_item, _)) = binop_traits(op.node) . && let Some(trait_id) = cx.tcx.lang_items().get(trait_lang_item) . && has_nonzero_operator(cx, lhs, recv, nz_ty, trait_id, self.msrv) => . { . emit_unnecessary_get(cx, expr, get_call, recv, get_span, op.node.as_str()); . }, . -- line 94 ---------------------------------------- -- line 100 ---------------------------------------- . && let Some(trait_id) = cx.tcx.lang_items().get(trait_lang_item) . && has_nonzero_operator(cx, lhs, recv, nz_ty, trait_id, self.msrv) => . { . emit_unnecessary_get(cx, expr, get_call, recv, get_span, op.node.as_str()); . }, . . _ => {}, . } 3,145,784 ( 0.02%) } . } . . /// Returns the receiver, its `NonZero` type and definition, and the `get` identifier span when . /// `expr` is an inherent `NonZero::get()` call. 5 ( 0.00%) fn nonzero_get<'tcx>( . cx: &LateContext<'tcx>, . expr: &'tcx Expr<'tcx>, . ) -> Option<(&'tcx Expr<'tcx>, Ty<'tcx>, DefId, Span)> { 2 ( 0.00%) let ExprKind::MethodCall(get, recv, [], get_span) = expr.kind else { . return None; . }; . if get.ident.name != sym::get { . return None; . } . let get_did = cx.typeck_results().type_dependent_def_id(expr.hir_id)?; . if cx.tcx.trait_of_assoc(get_did).is_some() { . return None; -- line 125 ---------------------------------------- -- line 128 ---------------------------------------- . let ty::Adt(adt, _) = nz_ty.kind() else { . return None; . }; . if !cx.tcx.is_diagnostic_item(sym::NonZero, adt.did()) { . return None; . } . . Some((recv, nz_ty, adt.did(), get_span)) 6 ( 0.00%) } . . fn emit_unnecessary_get<'tcx>( . cx: &LateContext<'tcx>, . expr: &Expr<'tcx>, . get_call: &Expr<'tcx>, . recv: &Expr<'tcx>, . get_span: Span, . operation: &str, -- line 144 ---------------------------------------- 3 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs -------------------------------------------------------------------------------- Ir -- line 181 ---------------------------------------- . #[inline] . fn next(&mut self) -> Option<(usize, char)> { . let pre_len = self.iter.iter.len(); . match self.iter.next() { . None => None, . Some(ch) => { . let index = self.front_offset; . let len = self.iter.iter.len(); 26,344,581 ( 0.13%) self.front_offset += pre_len - len; . Some((index, ch)) . } . } . } . . #[inline] . fn count(self) -> usize { . self.iter.count() -- line 197 ---------------------------------------- -- line 504 ---------------------------------------- . } . . $(#[$common_stability_attribute])* . impl<'a, P: Pattern> Iterator for $forward_iterator<'a, P> { . type Item = $iterty; . . #[inline] . fn next(&mut self) -> Option<$iterty> { 346 ( 0.00%) self.0.next() 15,784 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:>::next (173x) . } . } . . $(#[$common_stability_attribute])* . impl<'a, P> Clone for $forward_iterator<'a, P> . where . P: Pattern: Clone>, . { -- line 520 ---------------------------------------- -- line 543 ---------------------------------------- . impl<'a, P> Iterator for $reverse_iterator<'a, P> . where . P: Pattern: ReverseSearcher<'a>>, . { . type Item = $iterty; . . #[inline] . fn next(&mut self) -> Option<$iterty> { 720,889 ( 0.00%) self.0.next_back() 35,099,635 ( 0.17%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:>::next_back (524,284x) . } . } . . $(#[$common_stability_attribute])* . impl<'a, P> Clone for $reverse_iterator<'a, P> . where . P: Pattern: Clone>, . { -- line 559 ---------------------------------------- -- line 636 ---------------------------------------- . .finish() . } . } . . impl<'a, P: Pattern> SplitInternal<'a, P> { . #[inline] . fn get_end(&mut self) -> Option<&'a str> { . if !self.finished { 10 ( 0.00%) self.finished = true; . 22 ( 0.00%) if self.allow_trailing_empty || self.end - self.start > 0 { . // SAFETY: `self.start` and `self.end` always lie on unicode boundaries. 12 ( 0.00%) let string = unsafe { self.matcher.haystack().get_unchecked(self.start..self.end) }; . return Some(string); . } . } . . None . } . . #[inline] 1,211 ( 0.00%) fn next(&mut self) -> Option<&'a str> { 524,696 ( 0.00%) if self.finished { . return None; . } . 378 ( 0.00%) let haystack = self.matcher.haystack(); . match self.matcher.next_match() { . // SAFETY: `Searcher` guarantees that `a` and `b` lie on unicode boundaries. . Some((a, b)) => unsafe { 182 ( 0.00%) let elt = haystack.get_unchecked(self.start..a); 355 ( 0.00%) self.start = b; . Some(elt) 173 ( 0.00%) }, . None => self.get_end(), . } 1,557 ( 0.00%) } . . #[inline] . fn next_inclusive(&mut self) -> Option<&'a str> { 2 ( 0.00%) if self.finished { . return None; . } . . let haystack = self.matcher.haystack(); . match self.matcher.next_match() { . // SAFETY: `Searcher` guarantees that `b` lies on unicode boundary, . // and self.start is either the start of the original string, . // or `b` was assigned to it, so it also lies on unicode boundary. . Some((_, b)) => unsafe { . let elt = haystack.get_unchecked(self.start..b); . self.start = b; . Some(elt) . }, 2 ( 0.00%) None => self.get_end(), . } . } . . #[inline] 3,669,988 ( 0.02%) fn next_back(&mut self) -> Option<&'a str> . where . P::Searcher<'a>: ReverseSearcher<'a>, . { 1,048,568 ( 0.01%) if self.finished { . return None; . } . 524,284 ( 0.00%) if !self.allow_trailing_empty { . self.allow_trailing_empty = true; . match self.next_back() { . Some(elt) if !elt.is_empty() => return Some(elt), . _ => { . if self.finished { . return None; . } . } . } . } . 786,426 ( 0.00%) let haystack = self.matcher.haystack(); . match self.matcher.next_match_back() { . // SAFETY: `Searcher` guarantees that `a` and `b` lie on unicode boundaries. . Some((a, b)) => unsafe { . let elt = haystack.get_unchecked(b..self.end); . self.end = a; . Some(elt) . }, . // SAFETY: `self.start` and `self.end` always lie on unicode boundaries. . None => unsafe { 262,142 ( 0.00%) self.finished = true; 524,284 ( 0.00%) Some(haystack.get_unchecked(self.start..self.end)) . }, . } 4,194,272 ( 0.02%) } . . #[inline] . fn next_back_inclusive(&mut self) -> Option<&'a str> . where . P::Searcher<'a>: ReverseSearcher<'a>, . { . if self.finished { . return None; -- line 737 ---------------------------------------- 1,573,912 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_retain.rs -------------------------------------------------------------------------------- Ir -- line 52 ---------------------------------------- . . impl ManualRetain { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualRetain { 1,966,115 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 786,446 ( 0.00%) if let Assign(left_expr, collect_expr, _) = &expr.kind . && let hir::ExprKind::MethodCall(seg, target_expr, [], _) = &collect_expr.kind . && seg.args.is_none() . && let Some(collect_def_id) = cx.typeck_results().type_dependent_def_id(collect_expr.hir_id) . && cx.tcx.is_diagnostic_item(sym::iterator_collect_fn, collect_def_id) . { . check_into_iter(cx, left_expr, target_expr, expr.span, self.msrv); . check_iter(cx, left_expr, target_expr, expr.span, self.msrv); . check_to_owned(cx, left_expr, target_expr, expr.span, self.msrv); . } 2,359,338 ( 0.01%) } . } . . fn check_into_iter( . cx: &LateContext<'_>, . left_expr: &hir::Expr<'_>, . target_expr: &hir::Expr<'_>, . parent_expr_span: Span, . msrv: Msrv, -- line 79 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/approx_const.rs -------------------------------------------------------------------------------- Ir -- line 74 ---------------------------------------- . impl ApproxConstant { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl LateLintPass<'_> for ApproxConstant { . fn check_lit(&mut self, cx: &LateContext<'_>, _hir_id: HirId, lit: Lit, _is_negated_pat: bool) { 1,114,101 ( 0.01%) match lit.node { . LitKind::Float(s, LitFloatType::Suffixed(fty)) => match fty { . FloatTy::F16 => self.check_known_consts(cx, lit.span, s, "f16"), . FloatTy::F32 => self.check_known_consts(cx, lit.span, s, "f32"), . FloatTy::F64 => self.check_known_consts(cx, lit.span, s, "f64"), . FloatTy::F128 => self.check_known_consts(cx, lit.span, s, "f128"), . }, . // FIXME(f16_f128): add `f16` and `f128` when these types become stable. 589,815 ( 0.00%) LitKind::Float(s, LitFloatType::Unsuffixed) => self.check_known_consts(cx, lit.span, s, "f{32, 64}"), 13,430,521,922 (66.06%) => site/frontend/rust-clippy/clippy_lints/src/approx_const.rs:::check_known_consts (196,605x) . _ => (), . } 65,538 ( 0.00%) } . } . . impl ApproxConstant { 2,555,865 ( 0.01%) fn check_known_consts(&self, cx: &LateContext<'_>, span: Span, s: symbol::Symbol, module: &str) { . let s = s.as_str(); 589,815 ( 0.00%) if let Ok(maybe_constant) = s.parse::() { 28,898,408 ( 0.14%) for &(constant, name, min_digits, msrv) in &KNOWN_CONSTS { 3,014,511 ( 0.01%) if is_approx_const(constant, s, maybe_constant, min_digits) 45 ( 0.00%) && msrv.is_none_or(|msrv| self.msrv.meets(cx, msrv)) 225 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::meets (15x) . { . span_lint_and_help( . cx, . APPROX_CONSTANT, . span, 306 ( 0.00%) format!("approximate value of `{module}::consts::{name}` found"), 51 ( 0.00%) None, . "consider using the constant directly", . ); . return; . } . } . } 1,572,840 ( 0.01%) } . } . . fn count_digits_after_dot(input: &str) -> usize { . input . .char_indices() 8,781,492 ( 0.04%) .find(|(_, ch)| *ch == '.') . .map_or(0, |(i, _)| input.len() - i - 1) . } . . /// Returns `false` if the number of significant figures in `value` are . /// less than `min_digits`; otherwise, returns true if `value` is equal . /// to `constant`, rounded to the number of significant digits present in `value`. . #[must_use] . fn is_approx_const(constant: f64, value: &str, f_value: f64, min_digits: usize) -> bool { 8,256,688 ( 0.04%) if value.len() <= min_digits { . // The value is not precise enough . false 8,802,251 ( 0.04%) } else if f_value.to_string().len() > min_digits && constant.to_string().starts_with(&f_value.to_string()) { . // The value represents the same value . true . } else { . // The value is a truncated constant . . // Print constant with numeric formatting (`0`), with the length of `value` as minimum width . // (`value_len$`), and with the same precision as `value` (`.value_prec$`). . // See https://doc.rust-lang.org/std/fmt/index.html. 24,116,088 ( 0.12%) let round_const = format!( . "{constant:0value_len$.value_prec$}", . value_len = value.len(), . value_prec = count_digits_after_dot(value) . ); . value == round_const . } . } 36,039,031 ( 0.18%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/cast_ptr_alignment.rs -------------------------------------------------------------------------------- Ir -- line 7 ---------------------------------------- . use rustc_middle::ty::{self, Ty}; . . use super::CAST_PTR_ALIGNMENT; . . pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, cast_from: Ty<'tcx>, cast_to: Ty<'tcx>) { . lint_cast_ptr_alignment(cx, expr, cast_from, cast_to); . } . 1,966,115 ( 0.01%) pub(super) fn check_cast_method(cx: &LateContext<'_>, expr: &Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::MethodCall(method_path, self_arg, [], _) = &expr.kind 2 ( 0.00%) && method_path.ident.name == sym::cast . && let Some(generic_args) = method_path.args . && let [GenericArg::Type(cast_to)] = generic_args.args . // There probably is no obvious reason to do this, just to be consistent with `as` cases. . && !is_hir_ty_cfg_dependant(cx, cast_to.as_unambig_ty()) . { . let (cast_from, cast_to) = (cx.typeck_results().expr_ty(self_arg), cx.typeck_results().expr_ty(expr)); . lint_cast_ptr_alignment(cx, expr, cast_from, cast_to); . } 2,359,338 ( 0.01%) } . . fn lint_cast_ptr_alignment<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, cast_from: Ty<'tcx>, cast_to: Ty<'tcx>) { . if let ty::RawPtr(from_ptr_ty, _) = *cast_from.kind() . && let ty::RawPtr(to_ptr_ty, _) = *cast_to.kind() . && let Ok(from_layout) = cx.layout_of(from_ptr_ty) . && let Ok(to_layout) = cx.layout_of(to_ptr_ty) . && from_layout.align.abi < to_layout.align.abi . // with c_void, we inherently need to trust the user -- line 34 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/byte_char_slices.rs -------------------------------------------------------------------------------- Ir -- line 32 ---------------------------------------- . pub BYTE_CHAR_SLICES, . style, . "hard to read byte char slice" . } . . declare_lint_pass!(ByteCharSlice => [BYTE_CHAR_SLICES]); . . impl<'tcx> LateLintPass<'tcx> for ByteCharSlice { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if !expr.span.from_expansion() . && let Some((has_ref, slice)) = is_byte_char_slices(cx, expr) . { . span_lint_and_then( . cx, . BYTE_CHAR_SLICES, . expr.span, . "can be more succinctly written as a byte str", . |diag| { -- line 49 ---------------------------------------- -- line 64 ---------------------------------------- . if !has_ref && !cx.typeck_results().expr_ty_adjusted(expr).is_array_slice() { . sugg = sugg.deref(); . } . . diag.span_suggestion(expr.span, "try", sugg, app); . }, . ); . } 3,145,784 ( 0.02%) } . } . . /// Checks whether the slice is that of byte chars, and if so, builds a byte-string out of it . fn is_byte_char_slices<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option<(bool, Vec)> { 1,179,654 ( 0.01%) let (has_ref, expr) = if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner) = expr.kind { . (true, inner) 1,966,090 ( 0.01%) } else if let Some(parent) = get_parent_expr(cx, expr) // Already checked by the parent expr. 46,792,942 ( 0.23%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::get_parent_expr (393,218x) 786,430 ( 0.00%) && let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, _) = parent.kind . { . return None; . } else { . (false, expr) . }; . 786,437 ( 0.00%) if let ExprKind::Array(members) = expr.kind 2 ( 0.00%) && !members.is_empty() 1 ( 0.00%) && !span_contains_comment(cx, expr.span) 5 ( 0.00%) && !span_contains_cfg(cx, expr.span) 2,708,489 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::span_contains_cfg (1x) . { . return members . .iter() . .try_fold(Vec::new(), |mut acc, member| { 2 ( 0.00%) if let ExprKind::Lit(lit) = member.kind . && let LitKind::Byte(_) = lit.node . && expr.span.eq_ctxt(member.span) . { . acc.push(lit.span); . return Some(acc); . } . None . }) -- line 103 ---------------------------------------- 1,572,875 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/memchr.rs -------------------------------------------------------------------------------- Ir -- line 19 ---------------------------------------- . x.wrapping_sub(LO_USIZE) & !x & HI_USIZE != 0 . } . . /// Returns the first index matching the byte `x` in `text`. . #[inline] . #[must_use] . pub const fn memchr(x: u8, text: &[u8]) -> Option { . // Fast path for small slices. 524,772 ( 0.00%) if text.len() < 2 * USIZE_BYTES { . return memchr_naive(x, text); . } . 90 ( 0.00%) memchr_aligned(x, text) 125 ( 0.00%) => ???:core::slice::memchr::memchr_aligned (1x) . } . . #[inline] . const fn memchr_naive(x: u8, text: &[u8]) -> Option { . let mut i = 0; . . // FIXME(const-hack): Replace with `text.iter().pos(|c| *c == x)`. 1,953,286 ( 0.01%) while i < text.len() { 1,428,930 ( 0.01%) if text[i] == x { . return Some(i); . } . 714,286 ( 0.00%) i += 1; . } . . None . } . . #[rustc_allow_const_fn_unstable(const_eval_select)] // fallback impl has same behavior . const fn memchr_aligned(x: u8, text: &[u8]) -> Option { . // The runtime version behaves the same as the compiletime version, it's -- line 52 ---------------------------------------- 1,311,099 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/default_instead_of_iter_empty.rs -------------------------------------------------------------------------------- Ir -- line 27 ---------------------------------------- . pub DEFAULT_INSTEAD_OF_ITER_EMPTY, . style, . "check `std::iter::Empty::default()` and replace with `std::iter::empty()`" . } . . declare_lint_pass!(DefaultIterEmpty => [DEFAULT_INSTEAD_OF_ITER_EMPTY]); . . impl<'tcx> LateLintPass<'tcx> for DefaultIterEmpty { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::Call(iter_expr, []) = &expr.kind . && let ExprKind::Path(QPath::TypeRelative(ty, _)) = &iter_expr.kind . && let TyKind::Path(ty_path) = &ty.kind . && let QPath::Resolved(None, path) = ty_path . && let def::Res::Def(_, def_id) = &path.res . && cx.tcx.is_diagnostic_item(sym::IterEmpty, *def_id) . && let ctxt = expr.span.ctxt() . && ty.span.ctxt() == ctxt . { -- line 44 ---------------------------------------- -- line 51 ---------------------------------------- . DEFAULT_INSTEAD_OF_ITER_EMPTY, . expr.span, . format!("`{path}()` is the more idiomatic way"), . "try", . sugg, . applicability, . ); . } 3,145,784 ( 0.02%) } . } . . fn make_sugg( . cx: &LateContext<'_>, . ty_path: &QPath<'_>, . ctxt: SyntaxContext, . applicability: &mut Applicability, . path: &str, -- line 67 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/misc.rs -------------------------------------------------------------------------------- Ir -- line 96 ---------------------------------------- . declare_lint_pass!(LintPass => [ . SHORT_CIRCUIT_STATEMENT, . USED_UNDERSCORE_BINDING, . USED_UNDERSCORE_ITEMS, . ]); . . impl<'tcx> LateLintPass<'tcx> for LintPass { . fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) { 3 ( 0.00%) if let StmtKind::Semi(expr) = stmt.kind 2 ( 0.00%) && let ExprKind::Binary(binop, a, b) = &expr.kind . && matches!(binop.node, BinOpKind::And | BinOpKind::Or) . && !stmt.span.from_expansion() . && expr.span.eq_ctxt(stmt.span) . { . span_lint_hir_and_then( . cx, . SHORT_CIRCUIT_STATEMENT, . expr.hir_id, -- line 113 ---------------------------------------- -- line 117 ---------------------------------------- . let mut app = Applicability::MachineApplicable; . let test = Sugg::hir_with_context(cx, a, expr.span.ctxt(), "_", &mut app); . let test = if binop.node == BinOpKind::Or { !test } else { test }; . let then = Sugg::hir_with_context(cx, b, expr.span.ctxt(), "_", &mut app); . diag.span_suggestion(stmt.span, "replace it with", format!("if {test} {{ {then}; }}"), app); . }, . ); . } 1 ( 0.00%) } . 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if expr.span.in_external_macro(cx.sess().source_map()) 1,179,654 ( 0.01%) || expr.span.desugaring_kind().is_some() 37,748,926 ( 0.19%) => ???:::desugaring_kind (393,218x) 3,145,744 ( 0.02%) || in_automatically_derived(cx.tcx, expr.hir_id) 125,436,542 ( 0.62%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::in_automatically_derived (393,218x) . { . return; . } . . used_underscore_binding(cx, expr); . used_underscore_items(cx, expr); 3,145,784 ( 0.02%) } . } . . fn used_underscore_items<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 2,752,517 ( 0.01%) let (def_id, ident) = match expr.kind { . ExprKind::Call(func, ..) => { . if let ExprKind::Path(QPath::Resolved(.., path)) = func.kind . && let Some(last_segment) = path.segments.last() . && let Res::Def(_, def_id) = last_segment.res . { . (def_id, last_segment.ident) . } else { . return; . } . }, . ExprKind::MethodCall(path, ..) => { 3 ( 0.00%) if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) { 51 ( 0.00%) => ???:::type_dependent_def_id (1x) 1 ( 0.00%) (def_id, path.ident) . } else { . return; . } 1 ( 0.00%) }, . ExprKind::Struct(QPath::Resolved(_, path), ..) => { . if let Some(last_segment) = path.segments.last() . && let Res::Def(_, def_id) = last_segment.res . { . (def_id, last_segment.ident) . } else { . return; . } . }, . _ => return, . }; . . let name = ident.name.as_str(); . let definition_span = cx.tcx.def_span(def_id); 1 ( 0.00%) if name.starts_with('_') . && !name.starts_with("__") . && !definition_span.from_expansion() . && def_id.is_local() . && !cx.tcx.is_foreign_item(def_id) . { . span_lint_and_then( . cx, . USED_UNDERSCORE_ITEMS, -- line 181 ---------------------------------------- -- line 184 ---------------------------------------- . |diag| { . diag.span_note(definition_span, "item is defined here".to_string()); . }, . ); . } . } . . fn used_underscore_binding<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 2,359,306 ( 0.01%) let (definition_hir_id, ident) = match expr.kind { . ExprKind::Path(ref qpath) => { 4 ( 0.00%) if let QPath::Resolved(None, path) = qpath 3 ( 0.00%) && let Res::Local(id) = path.res . && is_used(cx, expr) . { . (id, last_path_segment(qpath).ident) . } else { . return; . } . }, . ExprKind::Field(recv, ident) => { -- line 203 ---------------------------------------- 786,448 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/from_raw_with_void_ptr.rs -------------------------------------------------------------------------------- Ir -- line 34 ---------------------------------------- . pub FROM_RAW_WITH_VOID_PTR, . suspicious, . "creating a `Box` from a void raw pointer" . } . . declare_lint_pass!(FromRawWithVoidPtr => [FROM_RAW_WITH_VOID_PTR]); . . impl LateLintPass<'_> for FromRawWithVoidPtr { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::Call(box_from_raw, [arg]) = expr.kind 4 ( 0.00%) && let ExprKind::Path(QPath::TypeRelative(ty, seg)) = box_from_raw.kind . && seg.ident.name == sym::from_raw . && let Some(type_str) = ty.basic_res().opt_def_id().and_then(|id| def_id_matches_type(cx, id)) . && let arg_kind = cx.typeck_results().expr_ty(arg).kind() . && let ty::RawPtr(ty, _) = arg_kind . && is_c_void(cx, *ty) . { . let msg = format!("creating a `{type_str}` from a void raw pointer"); . span_lint_and_help( -- line 52 ---------------------------------------- -- line 53 ---------------------------------------- . cx, . FROM_RAW_WITH_VOID_PTR, . expr.span, . msg, . Some(arg.span), . "cast this to a pointer of the appropriate type", . ); . } 3,145,784 ( 0.02%) } . } . . /// Checks whether a `DefId` matches `Box`, `Rc`, `Arc`, or one of the `Weak` types. . /// Returns a static string slice with the name of the type, if one was found. . fn def_id_matches_type(cx: &LateContext<'_>, def_id: DefId) -> Option<&'static str> { . // Box . if Some(def_id) == cx.tcx.lang_items().owned_box() { . return Some("Box"); -- line 69 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs -------------------------------------------------------------------------------- Ir -- line 706 ---------------------------------------- . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] . #[rustc_diagnostic_item = "result_ok_method"] . pub const fn ok(self) -> Option . where . T: [const] Destruct, . E: [const] Destruct, . { 131,084 ( 0.00%) match self { 65,540 ( 0.00%) Ok(x) => Some(x), . Err(_) => None, . } . } . . /// Converts from `Result` to [`Option`]. . /// . /// Converts `self` into an [`Option`], consuming `self`, . /// and discarding the success value, if any. -- line 723 ---------------------------------------- -- line 828 ---------------------------------------- . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] . pub const fn map(self, op: F) -> Result . where . F: [const] FnOnce(T) -> U + [const] Destruct, . { 2 ( 0.00%) match self { . Ok(t) => Ok(op(t)), . Err(e) => Err(e), . } . } . . /// Returns the provided default (if [`Err`]), or . /// applies a function to the contained value (if [`Ok`]). . /// -- line 844 ---------------------------------------- -- line 957 ---------------------------------------- . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] . pub const fn map_err(self, op: O) -> Result . where . O: [const] FnOnce(E) -> F + [const] Destruct, . { 22,668,000 ( 0.11%) match self { 22,668,000 ( 0.11%) Ok(t) => Ok(t), . Err(e) => Err(op(e)), . } . } . . /// Calls a function with a reference to the contained value if [`Ok`]. . /// . /// Returns the original result. . /// -- line 974 ---------------------------------------- -- line 1174 ---------------------------------------- . /// [`std::error`](../../std/error/index.html) module docs. . #[inline] . #[track_caller] . #[stable(feature = "result_expect", since = "1.4.0")] . pub fn expect(self, msg: &str) -> T . where . E: fmt::Debug, . { 17,121,674 ( 0.08%) match self { . Ok(t) => t, . Err(e) => unwrap_failed(msg, &e), . } . } . . /// Returns the contained [`Ok`] value, consuming the `self` value. . /// . /// Because this function may panic, its use is generally discouraged. -- line 1190 ---------------------------------------- -- line 1222 ---------------------------------------- . /// ``` . #[inline(always)] . #[track_caller] . #[stable(feature = "rust1", since = "1.0.0")] . pub fn unwrap(self) -> T . where . E: fmt::Debug, . { 393,210 ( 0.00%) match self { 393,210 ( 0.00%) Ok(t) => t, . Err(e) => unwrap_failed("called `Result::unwrap()` on an `Err` value", &e), . } . } . . /// Returns the contained [`Ok`] value or a default . /// . /// Consumes the `self` argument then, if [`Ok`], returns the contained . /// value, otherwise if [`Err`], returns the default value for that -- line 1239 ---------------------------------------- -- line 1612 ---------------------------------------- . #[track_caller] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] . pub const fn unwrap_or_else(self, op: F) -> T . where . F: [const] FnOnce(E) -> T + [const] Destruct, . { . match self { 393,223 ( 0.00%) Ok(t) => t, . Err(e) => op(e), . } . } . . /// Returns the contained [`Ok`] value, consuming the `self` value, . /// without checking that the value is not an [`Err`]. . /// . /// # Safety -- line 1628 ---------------------------------------- -- line 1643 ---------------------------------------- . /// unsafe { x.unwrap_unchecked() }; // Undefined behavior! . /// ``` . #[inline] . #[track_caller] . #[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")] . #[rustc_const_unstable(feature = "const_result_unwrap_unchecked", issue = "148714")] . pub const unsafe fn unwrap_unchecked(self) -> T { . match self { 4 ( 0.00%) Ok(t) => t, . Err(e) => { . // FIXME(const-hack): to avoid E: const Destruct bound . super::mem::forget(e); . // SAFETY: the safety contract must be upheld by the caller. . unsafe { hint::unreachable_unchecked() } . } . } . } -- line 1659 ---------------------------------------- -- line 1714 ---------------------------------------- . #[rustc_allow_const_fn_unstable(const_precise_live_drops)] . pub const fn copied(self) -> Result . where . T: Copy, . { . // FIXME(const-hack): this implementation, which sidesteps using `Result::map` since it's not const . // ready yet, should be reverted when possible to avoid code repetition . match self { 130 ( 0.00%) Ok(&v) => Ok(v), . Err(e) => Err(e), . } . } . . /// Maps a `Result<&T, E>` to a `Result` by cloning the contents of the . /// `Ok` part. . /// . /// # Examples -- line 1730 ---------------------------------------- -- line 2169 ---------------------------------------- . . #[inline] . fn from_output(output: Self::Output) -> Self { . Ok(output) . } . . #[inline] . fn branch(self) -> ControlFlow { 22,668,000 ( 0.11%) match self { 11,333,998 ( 0.06%) Ok(v) => ControlFlow::Continue(v), . Err(e) => ControlFlow::Break(Err(e)), . } . } . } . . #[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")] . #[rustc_const_unstable(feature = "const_try", issue = "74935")] . const impl> ops::FromResidual> -- line 2186 ---------------------------------------- 34,067,543 ( 0.17%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/float_literal.rs -------------------------------------------------------------------------------- Ir -- line 71 ---------------------------------------- . pub fn new(conf: &'static Conf) -> Self { . Self { . const_literal_digits_threshold: conf.const_literal_digits_threshold, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for FloatLiteral { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 786,446 ( 0.00%) if let hir::ExprKind::Lit(lit) = expr.kind 524,286 ( 0.00%) && let LitKind::Float(sym, lit_float_ty) = lit.node 1,179,630 ( 0.01%) && let ty::Float(fty) = *cx.typeck_results().expr_ty(expr).kind() 7,864,200 ( 0.04%) => ???:::expr_ty (196,605x) . { . let sym_str = sym.as_str(); . let formatter = FloatFormat::new(sym_str); . // Try to bail out if the float is for sure fine. . // If its within the 2 decimal digits of being out of precision we . // check if the parsed representation is the same as the string . // since we'll need the truncated string anyway. 196,605 ( 0.00%) let digits = count_digits(sym_str); . let max = max_digits(fty); 393,210 ( 0.00%) let type_suffix = match lit_float_ty { . LitFloatType::Suffixed(FloatTy::F16) => Some("f16"), . LitFloatType::Suffixed(FloatTy::F32) => Some("f32"), . LitFloatType::Suffixed(FloatTy::F64) => Some("f64"), . LitFloatType::Suffixed(FloatTy::F128) => Some("f128"), 393,210 ( 0.00%) LitFloatType::Unsuffixed => None, . }; 1,376,235 ( 0.01%) let (is_whole, is_inf, mut float_str) = match fty { . FloatTy::F16 | FloatTy::F128 => { . // FIXME(f16_f128): do a check like the others when parsing is available . return; . }, . FloatTy::F32 => { . let value = sym_str.parse::().unwrap(); . . (value.fract() == 0.0, value.is_infinite(), formatter.format(value)) . }, . FloatTy::F64 => { . let value = sym_str.parse::().unwrap(); . 589,815 ( 0.00%) (value.fract() == 0.0, value.is_infinite(), formatter.format(value)) . }, . }; . 196,605 ( 0.00%) if is_inf { . return; . } . 393,556 ( 0.00%) if is_whole && !sym_str.contains(['e', 'E']) { . // Normalize the literal by stripping the fractional portion 173 ( 0.00%) if sym_str.split('.').next().unwrap() != float_str { . span_lint_and_then( . cx, . LOSSY_FLOAT_LITERAL, . expr.span, . "literal cannot be represented as the underlying type without loss of precision", . |diag| { . // If the type suffix is missing the suggestion would be . // incorrectly interpreted as an integer so adding a `.0` -- line 130 ---------------------------------------- -- line 136 ---------------------------------------- . expr.span, . "consider changing the type or replacing it with", . numeric_literal::format(&float_str, type_suffix, true), . Applicability::MachineApplicable, . ); . }, . ); . } 392,864 ( 0.00%) } else if digits > max as usize && count_digits(&float_str) < digits { . if digits >= self.const_literal_digits_threshold as usize . && matches!( . get_expr_use_site(cx.tcx, cx.typeck_results(), expr.span.ctxt(), expr).use_node(cx), . ExprUseNode::ConstStatic(_) . ) . { . // If a big enough number of digits is specified and it's a constant . // we assume the user is definining a constant, and excessive precision is ok -- line 152 ---------------------------------------- -- line 168 ---------------------------------------- . "consider changing the type or truncating it to", . numeric_literal::format(&float_str, type_suffix, true), . Applicability::MachineApplicable, . ); . }, . ); . } . } 3,145,784 ( 0.02%) } . } . . #[must_use] . fn max_digits(fty: FloatTy) -> u32 { 393,210 ( 0.00%) match fty { . FloatTy::F16 => f16::DIGITS, . FloatTy::F32 => f32::DIGITS, . FloatTy::F64 => f64::DIGITS, . FloatTy::F128 => f128::DIGITS, . } . } . . /// Counts the digits excluding leading zeros . #[must_use] . fn count_digits(s: &str) -> usize { . // Note that s does not contain the `f{16,32,64,128}` suffix, and underscores have been stripped . s.chars() 2,228,190 ( 0.01%) .filter(|c| *c != '-' && *c != '.') 2,752,470 ( 0.01%) .take_while(|c| *c != 'e' && *c != 'E') . .fold(0, |count, c| { . // leading zeros 6,422,430 ( 0.03%) if c == '0' && count == 0 { count } else { count + 1 } . }) . } . . enum FloatFormat { . LowerExp, . UpperExp, . Normal, . } . impl FloatFormat { . #[must_use] . fn new(s: &str) -> Self { . s.chars() 7,798,665 ( 0.04%) .find_map(|x| match x { . 'e' => Some(Self::LowerExp), . 'E' => Some(Self::UpperExp), . _ => None, . }) . .unwrap_or(Self::Normal) . } . fn format(&self, f: T) -> String . where . T: fmt::UpperExp + fmt::LowerExp + fmt::Display, . { 393,210 ( 0.00%) match self { . Self::LowerExp => format!("{f:e}"), . Self::UpperExp => format!("{f:E}"), 393,210 ( 0.00%) Self::Normal => format!("{f}"), . } . } . } . . fn maybe_let_stmt<'a>(cx: &LateContext<'a>, expr: &hir::Expr<'_>) -> Option<&'a hir::LetStmt<'a>> { . let parent = cx.tcx.parent_hir_node(expr.hir_id); . match parent { . hir::Node::LetStmt(let_stmt) => Some(let_stmt), -- line 233 ---------------------------------------- 1,441,773 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lexer/src/lib.rs -------------------------------------------------------------------------------- Ir -- line 63 ---------------------------------------- . . impl Token { . fn new(kind: TokenKind, len: u32) -> Token { . Token { kind, len } . } . } . . /// Enum representing common lexeme types. 4,194,258 ( 0.02%) #[derive(Clone, Copy, Debug, PartialEq, Eq)] . pub enum TokenKind { . /// A line comment, e.g. `// comment`. . LineComment { . doc_style: Option, . }, . . /// A block comment, e.g. `/* block comment */`. . /// -- line 79 ---------------------------------------- -- line 325 ---------------------------------------- . /// . /// When tokenizing a slice of a document, be sure to disallow frontmatters with [`FrontmatterAllowed::No`] . pub fn tokenize( . input: &str, . frontmatter_allowed: FrontmatterAllowed, . ) -> impl Iterator { . let mut cursor = Cursor::new(input, frontmatter_allowed); . std::iter::from_fn(move || { 3,145,692 ( 0.02%) let token = cursor.advance_token(); 127,176,990 ( 0.63%) => ???:::advance_token (1,048,564x) 3,145,691 ( 0.02%) if token.kind != TokenKind::Eof { Some(token) } else { None } . }) . } . . /// True if `c` is considered a whitespace according to Rust language definition. . /// See [Rust language reference](https://doc.rust-lang.org/reference/whitespace.html) . /// for definitions of these classes. . pub fn is_whitespace(c: char) -> bool { . // This is Pattern_White_Space. -- line 342 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/useless_concat.rs -------------------------------------------------------------------------------- Ir -- line 28 ---------------------------------------- . pub USELESS_CONCAT, . complexity, . "checks that the `concat` macro has at least two arguments" . } . . declare_lint_pass!(UselessConcat => [USELESS_CONCAT]); . . impl LateLintPass<'_> for UselessConcat { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { . // Check that the expression is generated by a macro. 786,452 ( 0.00%) if expr.span.from_expansion() . // Check that it's a string literal. . && let ExprKind::Lit(lit) = expr.kind . && let LitKind::Str(lit_s, _) = lit.node . // Get the direct parent of the expression. . && let Some(macro_call) = macro_backtrace(expr.span).next() . // Check if the `concat` macro from the `core` library. . && cx.tcx.is_diagnostic_item(sym::macro_concat, macro_call.def_id) . // We get the original code to parse it. -- line 46 ---------------------------------------- -- line 94 ---------------------------------------- . macro_call.span, . "unneeded use of `concat!` macro", . "replace with", . format!("{lit_s:?}"), . Applicability::MachineApplicable, . ); . } . } 3,145,784 ( 0.02%) } . } 10 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_take.rs -------------------------------------------------------------------------------- Ir -- line 48 ---------------------------------------- . . impl ManualTake { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl LateLintPass<'_> for ManualTake { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::If(cond, then, Some(otherwise)) = expr.kind . && let ExprKind::Path(_) = cond.kind . && let ExprKind::Block( . Block { . stmts: [stmt], . expr: Some(then_expr), . .. . }, . .., -- line 65 ---------------------------------------- -- line 98 ---------------------------------------- . expr.span, . "use", . format!("{negate}{std_or_core}::mem::take(&mut {taken})"), . app, . ); . }, . ); . } 3,145,784 ( 0.02%) } . } . . fn as_const_bool(e: &Expr<'_>) -> Option { . if let ExprKind::Lit(lit) = e.kind . && let LitKind::Bool(b) = lit.node . { . Some(b) . } else { -- line 114 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/if_let_mutex.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . correctness, . "locking a `Mutex` in an `if let` block can cause deadlocks" . } . . declare_lint_pass!(IfLetMutex => [IF_LET_MUTEX]); . . impl<'tcx> LateLintPass<'tcx> for IfLetMutex { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,179,669 ( 0.01%) if cx.tcx.sess.edition() >= Edition2024 { . return; . } . 393,223 ( 0.00%) if let Some(higher::IfLet { . let_expr, . if_then, . if_else: Some(if_else), . .. 786,446 ( 0.00%) }) = higher::IfLet::hir(cx, expr) 1,966,118 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . && let ctxt = expr.span.ctxt() . && let Some(op_mutex) = for_each_expr_without_closures(let_expr, |e| mutex_lock_call(cx, ctxt, e, None)) . && let Some(arm_mutex) = . for_each_expr_without_closures((if_then, if_else), |e| mutex_lock_call(cx, ctxt, e, Some(op_mutex))) . { . let diag = |diag: &mut Diag<'_, ()>| { . diag.span_label( . op_mutex.span, -- line 72 ---------------------------------------- -- line 81 ---------------------------------------- . span_lint_and_then( . cx, . IF_LET_MUTEX, . expr.span, . "calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock", . diag, . ); . } 393,223 ( 0.00%) } . } . . fn mutex_lock_call<'tcx>( . cx: &LateContext<'tcx>, . ctxt: SyntaxContext, . expr: &'tcx Expr<'_>, . op_mutex: Option<&'tcx Expr<'_>>, . ) -> ControlFlow<&'tcx Expr<'tcx>> { -- line 97 ---------------------------------------- 6,684,791 ( 0.03%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/default.rs -------------------------------------------------------------------------------- Ir -- line 73 ---------------------------------------- . . #[derive(Default)] . pub struct Default { . // Spans linted by `field_reassign_with_default`. . reassigned_linted: FxHashSet, . } . . impl<'tcx> LateLintPass<'tcx> for Default { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if !expr.span.from_expansion() . // Avoid cases already linted by `field_reassign_with_default` 393,218 ( 0.00%) && !self.reassigned_linted.contains(&expr.span) . && let ExprKind::Call(path, []) = expr.kind . && !in_automatically_derived(cx.tcx, expr.hir_id) . && let ExprKind::Path(ref qpath) = path.kind . && let Some(def_id) = cx.qpath_res(qpath, path.hir_id).opt_def_id() . && cx.tcx.is_diagnostic_item(sym::default_fn, def_id) . && !is_update_syntax_base(cx, expr) . // Detect and ignore ::default() because these calls do explicitly name the type. . && let QPath::Resolved(None, _path) = qpath -- line 92 ---------------------------------------- -- line 100 ---------------------------------------- . DEFAULT_TRAIT_ACCESS, . expr.span, . format!("calling `{replacement}` is more clear than this expression"), . "try", . replacement, . Applicability::Unspecified, // First resolve the TODO above . ); . } 3,145,784 ( 0.02%) } . . #[expect(clippy::too_many_lines)] 18 ( 0.00%) fn check_block(&mut self, cx: &LateContext<'tcx>, block: &Block<'tcx>) { . // start from the `let mut _ = _::default();` and look at all the following . // statements, see if they re-assign the fields of the binding . let stmts_head = match block.stmts { 8 ( 0.00%) [] | [_] => return, . // Skip the last statement since there cannot possibly be any following statements that re-assign fields. . [head @ .., _] => head, . }; . for (stmt_idx, stmt) in stmts_head.iter().enumerate() { . // find all binding statements like `let mut _ = T::default()` where `T::default()` is the . // `default` method of the `Default` trait, and store statement index in current block being . // checked and the name of the bound variable . let (local, variant, binding_name, binding_type, span) = if let StmtKind::Let(local) = stmt.kind -- line 123 ---------------------------------------- -- line 242 ---------------------------------------- . first_assign.unwrap().span, . "field assignment outside of initializer for an instance created with Default::default()", . Some(local.span), . format!("consider initializing the variable with `{sugg}` and removing relevant reassignments"), . ); . self.reassigned_linted.insert(span); . } . } 16 ( 0.00%) } . } . . /// Returns the reassigned field and the assigning expression (right-hand side of assign). . fn field_reassigned_by_stmt<'tcx>(this: &Stmt<'tcx>, binding_name: Symbol) -> Option<(Ident, &'tcx Expr<'tcx>)> { . if let StmtKind::Semi(later_expr) = this.kind . // only take assignments . && let ExprKind::Assign(assign_lhs, assign_rhs, _) = later_expr.kind . // only take assignments to fields where the left-hand side field is a field of -- line 258 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs -------------------------------------------------------------------------------- Ir -- line 467 ---------------------------------------- . #[must_use = "returns a new pointer rather than modifying its argument"] . #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] . #[inline(always)] . pub const fn wrapping_offset(self, count: isize) -> *mut T . where . T: Sized, . { . // SAFETY: the `arith_offset` intrinsic has no prerequisites to be called. 4 ( 0.00%) unsafe { intrinsics::arith_offset(self, count) as *mut T } . } . . /// Adds a signed offset in bytes to a pointer using wrapping arithmetic. . /// . /// `count` is in units of **bytes**. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [wrapping_offset][pointer::wrapping_offset] on it. See that method -- line 483 ---------------------------------------- -- line 963 ---------------------------------------- . ( . this: *const () = self as *const (), . count: usize = count, . size: usize = size_of::(), . ) => runtime_add_nowrap(this, count, size) . ); . . // SAFETY: the caller must uphold the safety contract for `offset`. 26,617,856 ( 0.13%) unsafe { intrinsics::offset(self, count) } . } . . /// Adds an unsigned offset in bytes to a pointer. . /// . /// `count` is in units of bytes. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [add][pointer::add] on it. See that method for documentation -- line 979 ---------------------------------------- -- line 1047 ---------------------------------------- . . if T::IS_ZST { . // Pointer arithmetic does nothing when the pointee is a ZST. . self . } else { . // SAFETY: the caller must uphold the safety contract for `offset`. . // Because the pointee is *not* a ZST, that means that `count` is . // at most `isize::MAX`, and thus the negation cannot overflow. 1,228 ( 0.00%) unsafe { intrinsics::offset(self, intrinsics::unchecked_sub(0, count as isize)) } . } . } . . /// Subtracts an unsigned offset in bytes from a pointer. . /// . /// `count` is in units of bytes. . /// . /// This is purely a convenience for casting to a `u8` pointer and -- line 1063 ---------------------------------------- 2,542,914 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/to_digit_is_some.rs -------------------------------------------------------------------------------- Ir -- line 43 ---------------------------------------- . . impl ToDigitIsSome { . pub(crate) fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ToDigitIsSome { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 786,448 ( 0.00%) if let hir::ExprKind::MethodCall(is_some_path, to_digit_expr, [], _) = &expr.kind 2 ( 0.00%) && is_some_path.ident.name == sym::is_some . { . let match_result = match to_digit_expr.kind { . hir::ExprKind::MethodCall(to_digits_path, char_arg, [radix_arg], _) => { . if to_digits_path.ident.name == sym::to_digit . && cx.typeck_results().expr_ty_adjusted(char_arg).is_char() . { . Some((true, char_arg, radix_arg)) . } else { -- line 61 ---------------------------------------- -- line 89 ---------------------------------------- . format!("{char_arg_snip}.is_digit({radix_snip})") . } else { . format!("char::is_digit({char_arg_snip}, {radix_snip})") . }, . applicability, . ); . } . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/char/methods.rs -------------------------------------------------------------------------------- Ir -- line 973 ---------------------------------------- . /// assert!(CAPITAL_DELTA_IS_UPPERCASE); . /// ``` . #[must_use] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")] . #[inline] . pub const fn is_uppercase(self) -> bool { . match self { 109 ( 0.00%) 'A'..='Z' => true, 70 ( 0.00%) '\0'..='\u{BF}' => false, . _ => unicode::Uppercase(self), . } . } . . /// Returns `true` if this `char` has one of the general categories for numbers. . /// . /// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric . /// characters, and `No` for other numeric characters) are [specified] in the Unicode Character -- line 990 ---------------------------------------- -- line 1080 ---------------------------------------- . /// . /// assert!(!'越'.is_whitespace()); . /// ``` . #[must_use] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_char_classify", since = "1.87.0")] . #[inline] . pub const fn is_whitespace(self) -> bool { 1,960,026 ( 0.01%) match self { . ' ' | '\x09'..='\x0d' => true, 653,344 ( 0.00%) '\0'..='\u{84}' => false, . _ => unicode::White_Space(self), . } . } . . /// Returns `true` if this `char` has the general category for control codes. . /// . /// Control codes (code points with the general category of `Cc`) are [described] in Chapter 23 . /// (Special Areas and Format Characters) of the Unicode Standard, and [specified] in the Unicode Character -- line 1098 ---------------------------------------- -- line 1703 ---------------------------------------- . /// holds across languages. . /// . /// [`to_titlecase()`]: Self::to_titlecase() . #[must_use = "this returns the uppercased character as a new iterator, \ . without modifying the original"] . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . pub fn to_uppercase(self) -> ToUppercase { 30 ( 0.00%) ToUppercase(CaseMappingIter::new(conversions::to_upper(self))) 220 ( 0.00%) => ???:core::unicode::unicode_data::conversions::to_upper (10x) . } . . /// Returns an iterator that yields the case folding of this `char` as one or more . /// `char`s. . /// . /// Case folding is meant to be used when performing case-insensitive string comparisons. . /// Case-folded strings should not usually be exposed directly to users. For most, . /// but not all, characters, the casefold mapping is identical to the lowercase one. -- line 1719 ---------------------------------------- -- line 2206 ---------------------------------------- . /// assert!(!lf.is_ascii_digit()); . /// assert!(!esc.is_ascii_digit()); . /// ``` . #[must_use] . #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] . #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")] . #[inline] . pub const fn is_ascii_digit(&self) -> bool { 1,110,895 ( 0.01%) matches!(*self, '0'..='9') . } . . /// Checks if the value is an ASCII octal digit: . /// U+0030 '0' ..= U+0037 '7'. . /// . /// # Examples . /// . /// ``` -- line 2222 ---------------------------------------- -- line 2475 ---------------------------------------- . escape_double_quote: true, . }; . } . . #[inline] . #[must_use] . const fn len_utf8(code: u32) -> usize { . match code { 66 ( 0.00%) ..MAX_ONE_B => 1, . ..MAX_TWO_B => 2, . ..MAX_THREE_B => 3, . _ => 4, . } . } . . #[inline] . #[must_use] -- line 2491 ---------------------------------------- -- line 2547 ---------------------------------------- . #[doc(hidden)] . #[inline] . pub const unsafe fn encode_utf8_raw_unchecked(code: u32, dst: *mut u8) { . let len = len_utf8(code); . // SAFETY: The caller must guarantee that the buffer pointed to by `dst` . // is at least `len` bytes long. . unsafe { . if len == 1 { 66 ( 0.00%) *dst = code as u8; . return; . } . . let last1 = (code >> 0 & 0x3F) as u8 | TAG_CONT; . let last2 = (code >> 6 & 0x3F) as u8 | TAG_CONT; . let last3 = (code >> 12 & 0x3F) as u8 | TAG_CONT; . let last4 = (code >> 18 & 0x3F) as u8 | TAG_FOUR_B; . -- line 2563 ---------------------------------------- 393,245 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs -------------------------------------------------------------------------------- Ir -- line 103 ---------------------------------------- . /// Constructs the associated searcher from . /// `self` and the `haystack` to search in. . fn into_searcher(self, haystack: &str) -> Self::Searcher<'_>; . . /// Checks whether the pattern matches anywhere in the haystack . #[inline] . fn is_contained_in(self, haystack: &str) -> bool { . self.into_searcher(haystack).next_match().is_some() 173 ( 0.00%) } . . /// Checks whether the pattern matches at the front of the haystack . #[inline] . fn is_prefix_of(self, haystack: &str) -> bool { . matches!(self.into_searcher(haystack).next(), SearchStep::Match(0, _)) . } . . /// Checks whether the pattern matches at the back of the haystack -- line 119 ---------------------------------------- -- line 243 ---------------------------------------- . /// . /// Unlike [`next()`][Searcher::next], there is no guarantee that the returned ranges . /// of this and [`next_reject`][Searcher::next_reject] will overlap. This will return . /// `(start_match, end_match)`, where start_match is the index of where . /// the match begins, and end_match is the index after the end of the match. . #[inline] . fn next_match(&mut self) -> Option<(usize, usize)> { . loop { 2,931 ( 0.00%) match self.next() { . SearchStep::Match(a, b) => return Some((a, b)), . SearchStep::Done => return None, . _ => continue, . } . } . } . . /// Finds the next [`Reject`][SearchStep::Reject] result. See [`next()`][Searcher::next] . /// and [`next_match()`][Searcher::next_match]. . /// . /// Unlike [`next()`][Searcher::next], there is no guarantee that the returned ranges . /// of this and [`next_match`][Searcher::next_match] will overlap. . #[inline] . fn next_reject(&mut self) -> Option<(usize, usize)> { 1,955,350 ( 0.01%) loop { 391,070 ( 0.00%) match self.next() { . SearchStep::Reject(a, b) => return Some((a, b)), . SearchStep::Done => return None, . _ => continue, . } . } . } . } . -- line 275 ---------------------------------------- -- line 324 ---------------------------------------- . } . } . . /// Finds the next [`Reject`][SearchStep::Reject] result. . /// See [`next_back()`][ReverseSearcher::next_back]. . #[inline] . fn next_reject_back(&mut self) -> Option<(usize, usize)> { . loop { 10 ( 0.00%) match self.next_back() { . SearchStep::Reject(a, b) => return Some((a, b)), . SearchStep::Done => return None, . _ => continue, . } . } . } . } . -- line 340 ---------------------------------------- -- line 416 ---------------------------------------- . // starts at the end and only decreases . let slice = unsafe { self.haystack.get_unchecked(old_finger..self.finger_back) }; . let mut iter = slice.chars(); . let old_len = iter.iter.len(); . if let Some(ch) = iter.next() { . // add byte offset of current character . // without re-encoding as utf-8 . self.finger += old_len - iter.iter.len(); 391,070 ( 0.00%) if ch == self.needle { . SearchStep::Match(old_finger, self.finger) . } else { . SearchStep::Reject(old_finger, self.finger) . } . } else { . SearchStep::Done . } . } . #[inline] . fn next_match(&mut self) -> Option<(usize, usize)> { . loop { . // get the haystack after the last character found . let bytes = self.haystack.as_bytes().get(self.finger..self.finger_back)?; . // the last byte of the utf8 encoded needle . // SAFETY: we have an invariant that `utf8_size < 5` 873 ( 0.00%) let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size() - 1) }; 786,956 ( 0.00%) if let Some(index) = memchr::memchr(last_byte, bytes) { . // The new finger is the index of the byte we found, . // plus one, since we memchr'd for the last byte of the character. . // . // Note that this doesn't always give us a finger on a UTF8 boundary. . // If we *didn't* find our character . // we may have indexed to the non-last byte of a 3-byte or 4-byte character. . // We can't just skip to the next valid starting byte because a character like . // ꁁ (U+A041 YI SYLLABLE PA), utf-8 `EA 81 81` will have us always find -- line 449 ---------------------------------------- -- line 451 ---------------------------------------- . // . // However, this is totally okay. While we have the invariant that . // self.finger is on a UTF8 boundary, this invariant is not relied upon . // within this method (it is relied upon in CharSearcher::next()). . // . // We only exit this method when we reach the end of the string, or if we . // find something. When we find something the `finger` will be set . // to a UTF8 boundary. 563 ( 0.00%) self.finger += index + 1; 931 ( 0.00%) if self.finger >= self.utf8_size() { . let found_char = self.finger - self.utf8_size(); . if let Some(slice) = self.haystack.as_bytes().get(found_char..self.finger) { 239 ( 0.00%) if slice == &self.utf8_encoded[0..self.utf8_size()] { . return Some((found_char, self.finger)); . } . } . } . } else { . // found nothing, exit 2 ( 0.00%) self.finger = self.finger_back; . return None; . } . } . } . . // let next_reject use the default implementation from the Searcher trait . } . -- line 478 ---------------------------------------- -- line 501 ---------------------------------------- . fn next_match_back(&mut self) -> Option<(usize, usize)> { . let haystack = self.haystack.as_bytes(); . loop { . // get the haystack up to but not including the last character searched . let bytes = haystack.get(self.finger..self.finger_back)?; . // the last byte of the utf8 encoded needle . // SAFETY: we have an invariant that `utf8_size < 5` . let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size() - 1) }; 1,572,852 ( 0.01%) if let Some(index) = memchr::memrchr(last_byte, bytes) { 15,963,269 ( 0.08%) => ???:core::slice::memchr::memrchr (262,142x) . // we searched a slice that was offset by self.finger, . // add self.finger to recoup the original index . let index = self.finger + index; . // memrchr will return the index of the byte we wish to . // find. In case of an ASCII character, this is indeed . // were we wish our new finger to be ("after" the found . // char in the paradigm of reverse iteration). For . // multibyte chars we need to skip down by the number of more -- line 517 ---------------------------------------- -- line 535 ---------------------------------------- . // or when the haystack has been searched completely. . // . // Unlike next_match this does not . // have the problem of repeated bytes in utf-8 because . // we're searching for the last byte, and we can only have . // found the last byte when searching in reverse. . self.finger_back = index; . } else { 262,142 ( 0.00%) self.finger_back = self.finger; . // found nothing, exit . return None; . } . } . } . . // let next_reject_back use the default implementation from the Searcher trait . } -- line 551 ---------------------------------------- -- line 691 ---------------------------------------- . fn next(&mut self) -> SearchStep { . let s = &mut self.char_indices; . // Compare lengths of the internal byte slice iterator . // to find length of current char . let pre_len = s.iter.iter.len(); . if let Some((i, c)) = s.next() { . let len = s.iter.iter.len(); . let char_len = pre_len - len; 4 ( 0.00%) if self.char_eq.matches(c) { . return SearchStep::Match(i, i + char_len); . } else { . return SearchStep::Reject(i, i + char_len); . } . } . SearchStep::Done . } . } -- line 707 ---------------------------------------- -- line 736 ---------------------------------------- . . #[inline] . fn into_searcher<$a>(self, haystack: &$a str) -> $t { . ($smap)(($pmap)(self).into_searcher(haystack)) . } . . #[inline] . fn is_contained_in<$a>(self, haystack: &$a str) -> bool { 692 ( 0.00%) ($pmap)(self).is_contained_in(haystack) 12,477 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs: as core::str::pattern::Pattern>::is_contained_in (173x) . } . . #[inline] . fn is_prefix_of<$a>(self, haystack: &$a str) -> bool { . ($pmap)(self).is_prefix_of(haystack) . } . . #[inline] -- line 752 ---------------------------------------- -- line 970 ---------------------------------------- . /// ``` . /// assert_eq!("Hello world".find("world"), Some(6)); . /// ``` . impl<'b> Pattern for &'b str { . type Searcher<'a> = StrSearcher<'a, 'b>; . . #[inline] . fn into_searcher(self, haystack: &str) -> StrSearcher<'_, 'b> { 259 ( 0.00%) StrSearcher::new(haystack, self) 692 ( 0.00%) => ???:::new (1x) . } . . /// Checks whether the pattern matches at the front of the haystack. . #[inline] . fn is_prefix_of(self, haystack: &str) -> bool { . haystack.as_bytes().starts_with(self.as_bytes()) . } . -- line 986 ---------------------------------------- -- line 1012 ---------------------------------------- . } . _ => self == haystack, . } . } . . /// Removes the pattern from the front of haystack, if it matches. . #[inline] . fn strip_prefix_of(self, haystack: &str) -> Option<&str> { 55 ( 0.00%) if self.is_prefix_of(haystack) { . // SAFETY: prefix was just verified to exist. . unsafe { Some(haystack.get_unchecked(self.as_bytes().len()..)) } . } else { . None . } . } . . /// Checks whether the pattern matches at the back of the haystack. -- line 1028 ---------------------------------------- -- line 1035 ---------------------------------------- . } . . /// Removes the pattern from the back of haystack, if it matches. . #[inline] . fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str> . where . Self::Searcher<'a>: ReverseSearcher<'a>, . { 5 ( 0.00%) if self.is_suffix_of(haystack) { 3 ( 0.00%) let i = haystack.len() - self.as_bytes().len(); . // SAFETY: suffix was just verified to exist. . unsafe { Some(haystack.get_unchecked(..i)) } . } else { . None . } . } . . #[inline] -- line 1052 ---------------------------------------- -- line 1165 ---------------------------------------- . } . otherwise => otherwise, . } . } . } . } . . #[inline] 311 ( 0.00%) fn next_match(&mut self) -> Option<(usize, usize)> { 100 ( 0.00%) match self.searcher { . StrSearcherImpl::Empty(..) => loop { . match self.next() { . SearchStep::Match(a, b) => return Some((a, b)), . SearchStep::Done => return None, . SearchStep::Reject(..) => {} . } . }, . StrSearcherImpl::TwoWay(ref mut searcher) => { 101 ( 0.00%) let is_long = searcher.memory == usize::MAX; . // write out `true` and `false` cases to encourage the compiler . // to specialize the two cases separately. 51 ( 0.00%) if is_long { . searcher.next::( . self.haystack.as_bytes(), . self.needle.as_bytes(), . true, . ) . } else { . searcher.next::( . self.haystack.as_bytes(), . self.needle.as_bytes(), . false, . ) . } . } . } 280 ( 0.00%) } . } . . unsafe impl<'a, 'b> ReverseSearcher<'a> for StrSearcher<'a, 'b> { . #[inline] . fn next_back(&mut self) -> SearchStep { . match self.searcher { . StrSearcherImpl::Empty(ref mut searcher) => { . if searcher.is_finished { -- line 1209 ---------------------------------------- -- line 1446 ---------------------------------------- . . #[inline] . fn byteset_create(bytes: &[u8]) -> u64 { . bytes.iter().fold(0, |a, &b| (1 << (b & 0x3f)) | a) . } . . #[inline] . fn byteset_contains(&self, byte: u8) -> bool { 658 ( 0.00%) (self.byteset >> ((byte & 0x3f) as usize)) & 1 != 0 . } . . // One of the main ideas of Two-Way is that we factorize the needle into . // two halves, (u, v), and begin trying to find v in the haystack by scanning . // left to right. If v matches, we try to match u by scanning right to left. . // How far we can jump when we encounter a mismatch is all based on the fact . // that (u, v) is a critical factorization for the needle. . #[inline] . fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> S::Output . where . S: TwoWayStrategy, . { . // `next()` uses `self.position` as its cursor . let old_pos = self.position; 50 ( 0.00%) let needle_last = needle.len() - 1; . 'search: loop { . // Check that we have room to search in . // position + needle_last can not overflow if we assume slices . // are bounded by isize's range. 350 ( 0.00%) let tail_byte = match haystack.get(self.position + needle_last) { . Some(&b) => b, . None => { 32 ( 0.00%) self.position = haystack.len(); . return S::rejecting(old_pos, self.position); . } . }; . . if S::use_early_reject() && old_pos != self.position { . return S::rejecting(old_pos, self.position); . } . . // Quickly skip by large portions unrelated to our substring 481 ( 0.00%) if !self.byteset_contains(tail_byte) { 564 ( 0.00%) self.position += needle.len(); . if !long_period { . self.memory = 0; . } . continue 'search; . } . . // See if the right part of the needle matches . let start = -- line 1496 ---------------------------------------- -- line 1497 ---------------------------------------- . if long_period { self.crit_pos } else { cmp::max(self.crit_pos, self.memory) }; . for i in start..needle.len() { . // SAFETY: on every iteration of `'search`, the `haystack.get(self.position + needle_last)` . // check returned `Some`, so `self.position + needle_last < haystack.len()`. . // Since `i < needle.len()` implies `i <= needle_last`, we have . // `self.position + i < haystack.len()`. . // Every path that mutates `self.position` below either returns or re-enters `'search`, . // which re-runs the check before reaching the loop again. 157 ( 0.00%) if needle[i] != unsafe { *haystack.get_unchecked(self.position + i) } { 18 ( 0.00%) self.position += i - self.crit_pos + 1; 6 ( 0.00%) if !long_period { . self.memory = 0; . } . continue 'search; . } . } . . // See if the left part of the needle matches . let start = if long_period { 0 } else { self.memory }; -- line 1515 ---------------------------------------- -- line 1528 ---------------------------------------- . continue 'search; . } . } . . // We have found a match! . let match_pos = self.position; . . // Note: add self.period instead of needle.len() to have overlapping matches 38 ( 0.00%) self.position += needle.len(); . if !long_period { 28 ( 0.00%) self.memory = 0; // set to needle.len() - self.period for overlapping matches . } . . return S::matching(match_pos, match_pos + needle.len()); . } . } . . // Follows the ideas in `next()`. . // -- line 1546 ---------------------------------------- -- line 1759 ---------------------------------------- . false . } . #[inline] . fn rejecting(_a: usize, _b: usize) -> Self::Output { . None . } . #[inline] . fn matching(a: usize, b: usize) -> Self::Output { 30 ( 0.00%) Some((a, b)) . } . } . . /// Emit Rejects regularly . enum RejectAndMatch {} . . impl TwoWayStrategy for RejectAndMatch { . type Output = SearchStep; -- line 1775 ---------------------------------------- 1,570,490 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/ineffective_open_options.rs -------------------------------------------------------------------------------- Ir -- line 38 ---------------------------------------- . pub INEFFECTIVE_OPEN_OPTIONS, . suspicious, . "usage of both `write(true)` and `append(true)` on same `OpenOptions`" . } . . declare_lint_pass!(IneffectiveOpenOptions => [INEFFECTIVE_OPEN_OPTIONS]); . . impl<'tcx> LateLintPass<'tcx> for IneffectiveOpenOptions { 1,572,892 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::MethodCall(name, recv, [_], _) = expr.kind . && name.ident.name == sym::open . && !expr.span.from_expansion() . && cx . .typeck_results() . .expr_ty(recv) . .peel_refs() . .is_diag_item(cx, sym::FsOpenOptions) . { -- line 55 ---------------------------------------- -- line 94 ---------------------------------------- . write_span, . "unnecessary use of `.write(true)` because there is `.append(true)`", . "remove `.write(true)`", . String::new(), . Applicability::MachineApplicable, . ); . } . } 1,572,892 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs -------------------------------------------------------------------------------- Ir -- line 890 ---------------------------------------- . pub const fn checked_add(self, rhs: Self) -> Option { . // This used to use `overflowing_add`, but that means it ends up being . // a `wrapping_add`, losing some optimization opportunities. Notably, . // phrasing it this way helps `.checked_add(1)` optimize to a check . // against `MAX` and a `add nuw`. . // Per , . // LLVM is happy to re-form the intrinsic later if useful. . 11,334,062 ( 0.06%) if intrinsics::unlikely(intrinsics::add_with_overflow(self, rhs).1) { . None . } else { . // SAFETY: Just checked it doesn't overflow . Some(unsafe { intrinsics::unchecked_add(self, rhs) }) . } . } . . /// Strict integer addition. Computes `self + rhs`, panicking -- line 906 ---------------------------------------- -- line 965 ---------------------------------------- . ( . lhs: $SelfT = self, . rhs: $SelfT = rhs, . ) => !lhs.overflowing_add(rhs).1, . ); . . // SAFETY: this is guaranteed to be safe by the caller. . unsafe { 256 ( 0.00%) intrinsics::unchecked_add(self, rhs) . } . } . . /// Checked addition with a signed integer. Computes `self + rhs`, . /// returning `None` if overflow occurred. . /// . /// # Examples . /// -- line 981 ---------------------------------------- -- line 1044 ---------------------------------------- . without modifying the original"] . #[inline] . pub const fn checked_sub(self, rhs: Self) -> Option { . // Per PR#103299, there's no advantage to the `overflowing` intrinsic . // for *unsigned* subtraction and we just emit the manual check anyway. . // Thus, rather than using `overflowing_sub` that produces a wrapping . // subtraction, check it ourself so we can use an unchecked one. . 1,770,165 ( 0.01%) if self < rhs { . None . } else { . // SAFETY: just checked this can't overflow 786,909 ( 0.00%) Some(unsafe { intrinsics::unchecked_sub(self, rhs) }) . } . } . . /// Strict integer subtraction. Computes `self - rhs`, panicking if . /// overflow occurred. . /// . /// # Panics . /// -- line 1064 ---------------------------------------- -- line 1353 ---------------------------------------- . ( . lhs: $SelfT = self, . rhs: $SelfT = rhs, . ) => !lhs.overflowing_mul(rhs).1, . ); . . // SAFETY: this is guaranteed to be safe by the caller. . unsafe { 2,832,259 ( 0.01%) intrinsics::unchecked_mul(self, rhs) . } . } . . /// Checked integer division. Computes `self / rhs`, returning `None` . /// if `rhs == 0`. . /// . /// # Examples . /// -- line 1369 ---------------------------------------- -- line 2448 ---------------------------------------- . #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_add(127), ", stringify!($SelfT), "::MAX);")] . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use = "this returns the result of the operation, \ . without modifying the original"] . #[rustc_const_stable(feature = "const_saturating_int_methods", since = "1.47.0")] . #[inline(always)] . pub const fn saturating_add(self, rhs: Self) -> Self { 5 ( 0.00%) intrinsics::saturating_add(self, rhs) . } . . /// Saturating addition with a signed integer. Computes `self + rhs`, . /// saturating at the numeric bounds instead of overflowing. . /// . /// # Examples . /// . /// ``` -- line 2464 ---------------------------------------- -- line 2604 ---------------------------------------- . #[doc = concat!("assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::MAX), 199);")] . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")] . #[must_use = "this returns the result of the operation, \ . without modifying the original"] . #[inline(always)] . pub const fn wrapping_add(self, rhs: Self) -> Self { 327,380 ( 0.00%) intrinsics::wrapping_add(self, rhs) . } . . /// Wrapping (modular) addition with a signed integer. Computes . /// `self + rhs`, wrapping around at the boundary of the type. . /// . /// # Examples . /// . /// ``` -- line 2620 ---------------------------------------- -- line 2641 ---------------------------------------- . #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::MAX), 101);")] . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")] . #[must_use = "this returns the result of the operation, \ . without modifying the original"] . #[inline(always)] . pub const fn wrapping_sub(self, rhs: Self) -> Self { 24,381,147 ( 0.12%) intrinsics::wrapping_sub(self, rhs) . } . . /// Wrapping (modular) subtraction with a signed integer. Computes . /// `self - rhs`, wrapping around at the boundary of the type. . /// . /// # Examples . /// . /// ``` -- line 2657 ---------------------------------------- -- line 2680 ---------------------------------------- . /// assert_eq!(25u8.wrapping_mul(12), 44); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")] . #[must_use = "this returns the result of the operation, \ . without modifying the original"] . #[inline(always)] . pub const fn wrapping_mul(self, rhs: Self) -> Self { 392 ( 0.00%) intrinsics::wrapping_mul(self, rhs) . } . . /// Wrapping (modular) division. Computes `self / rhs`. . /// . /// Wrapped division on unsigned types is just normal division. There's . /// no way wrapping could ever happen. This function exists so that all . /// operations are accounted for in the wrapping operations. . /// -- line 2696 ---------------------------------------- -- line 3164 ---------------------------------------- . /// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true)); . /// ``` . #[stable(feature = "wrapping", since = "1.7.0")] . #[rustc_const_stable(feature = "const_wrapping_math", since = "1.32.0")] . #[must_use = "this returns the result of the operation, \ . without modifying the original"] . #[inline(always)] . pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) { 45,690,743 ( 0.22%) let (a, b) = intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT); . (a as Self, b) . } . . /// Calculates the "full multiplication" `self * rhs + carry` . /// without the possibility to overflow. . /// . /// This returns the low-order (wrapping) bits and the high-order (overflow) bits . /// of the result as two separate values, in that order. -- line 3180 ---------------------------------------- -- line 3860 ---------------------------------------- . // . // This method cannot overflow, as in the `next_power_of_two` . // overflow cases it instead ends up returning the maximum value . // of the type, and can return 0 for 0. . #[inline] . const fn one_less_than_next_power_of_two(self) -> Self { . if self <= 1 { return 0; } . 6 ( 0.00%) let p = self - 1; . // SAFETY: Because `p > 0`, it cannot consist entirely of leading zeros. . // That means the shift is always in-bounds, and some processors . // (such as intel pre-haswell) have more efficient ctlz . // intrinsics when the argument is non-zero. 3 ( 0.00%) let z = unsafe { intrinsics::ctlz_nonzero(p) }; 6 ( 0.00%) <$SelfT>::MAX >> z . } . . /// Returns the smallest power of two greater than or equal to `self`. . /// . /// When return value overflows (i.e., `self > (1 << (N-1))` for type . /// `uN`), it panics in debug mode and the return value is wrapped to 0 in . /// release mode (the only situation in which this method can return 0). . /// -- line 3882 ---------------------------------------- -- line 4010 ---------------------------------------- . without modifying the original"] . #[allow(unnecessary_transmutes)] . // SAFETY: const sound because integers are plain old datatypes so we can always . // transmute them to arrays of bytes . #[inline] . pub const fn to_ne_bytes(self) -> [u8; size_of::()] { . // SAFETY: integers are plain old datatypes so we can always transmute them to . // arrays of bytes 32 ( 0.00%) unsafe { mem::transmute(self) } . } . . /// Creates a native endian integer value from its representation . /// as a byte array in big endian. . /// . #[doc = $from_xe_bytes_doc] . /// . /// # Examples -- line 4026 ---------------------------------------- 47,872,906 ( 0.24%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs -------------------------------------------------------------------------------- Ir -- line 565 ---------------------------------------- . ub_checks::maybe_is_aligned_and_not_null(src, align, zero_size) . && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size) . && ub_checks::maybe_is_nonoverlapping(src, dst, size, count) . } . ); . . // SAFETY: the safety contract for `copy_nonoverlapping` must be . // upheld by the caller. 49,000,014 ( 0.24%) unsafe { crate::intrinsics::copy_nonoverlapping(src, dst, count) } 18 ( 0.00%) => ???:0x0000000000173dc0 (1x) . } . . /// Copies `count * size_of::()` bytes from `src` to `dst`. The source . /// and destination may overlap. . /// . /// If the source and destination will *never* overlap, . /// [`copy_nonoverlapping`] can be used instead. . /// -- line 581 ---------------------------------------- -- line 656 ---------------------------------------- . src: *const () = src as *const (), . dst: *mut () = dst as *mut (), . align: usize = align_of::(), . zero_size: bool = T::IS_ZST || count == 0, . ) => . ub_checks::maybe_is_aligned_and_not_null(src, align, zero_size) . && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size) . ); 7 ( 0.00%) crate::intrinsics::copy(src, dst, count) 24 ( 0.00%) => ???:0x0000000000173dc0 (2x) . } . } . . /// Sets `count * size_of::()` bytes of memory starting at `dst` to . /// `val`. . /// . /// `write_bytes` is similar to C's [`memset`], but sets `count * . /// size_of::()` bytes to `val`. -- line 672 ---------------------------------------- -- line 727 ---------------------------------------- . check_language_ub, . "ptr::write_bytes requires that the destination pointer is aligned and non-null", . ( . addr: *const () = dst as *const (), . align: usize = align_of::(), . zero_size: bool = T::IS_ZST || count == 0, . ) => ub_checks::maybe_is_aligned_and_not_null(addr, align, zero_size) . ); 48 ( 0.00%) crate::intrinsics::write_bytes(dst, val, count) 12 ( 0.00%) => ???:0x00000000001747c0 (1x) . } . } . . /// Executes the destructor (if any) of the pointed-to value. . /// . /// This is almost the same as calling [`ptr::read`] and discarding . /// the result, but has the following advantages: . // FIXME: say something more useful than "almost the same"? -- line 743 ---------------------------------------- -- line 834 ---------------------------------------- . // Due to historic reasons, `drop_in_place` takes a pointer rather than a reference, . // which results in worse codegen since we don't apply noalias/dereferenceable llvm . // attributes to pointer arguments. To workaround this without breaking public . // interface, `drop_in_place` calls the lang item, rather than being one directly. . . // SAFETY: . // - compiler glue has the same safety requirements as this function . // - the pointer must be valid as per the safety requirement of this function 7 ( 0.00%) unsafe { drop_glue(&mut *to_drop) } . } . . /// Helper function for `drop_in_place`. The compiler replaces this by the actual drop glue. . #[lang = "drop_glue"] 1,221,576 ( 0.01%) pub(crate) const unsafe fn drop_glue(_: &mut T) 292 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:core::ptr::drop_glue:: (3x) . where . T: [const] Destruct, . { . // Code here does not matter - this is replaced by the . // real drop glue by the compiler. . } . . /// Creates a null raw pointer. -- line 855 ---------------------------------------- -- line 1464 ---------------------------------------- . i += 1; . } . } . . // Don't let MIR inline this, because we really want it to keep its noalias metadata . #[rustc_no_mir_inline] . #[inline] . fn swap_chunk(x: &mut MaybeUninit<[u8; N]>, y: &mut MaybeUninit<[u8; N]>) { 16 ( 0.00%) let a = *x; . let b = *y; 48 ( 0.00%) *x = b; . *y = a; . } . . #[inline] . unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, bytes: NonZero) { . // Same as `swap_nonoverlapping::<[u8; N]>`. . unsafe fn swap_nonoverlapping_chunks( . x: *mut MaybeUninit<[u8; N]>, -- line 1482 ---------------------------------------- -- line 1747 ---------------------------------------- . check_language_ub, . "ptr::read requires that the pointer argument is aligned and non-null", . ( . addr: *const () = src as *const (), . align: usize = align_of::(), . is_zst: bool = T::IS_ZST, . ) => ub_checks::maybe_is_aligned_and_not_null(addr, align, is_zst) . ); 136 ( 0.00%) crate::intrinsics::read_via_copy(src) . } . } . . /// Reads the value from `src` without moving it. This leaves the . /// memory in `src` unchanged. . /// . /// Unlike [`read`], `read_unaligned` works with unaligned pointers. . /// -- line 1763 ---------------------------------------- -- line 1955 ---------------------------------------- . check_language_ub, . "ptr::write requires that the pointer argument is aligned and non-null", . ( . addr: *mut () = dst as *mut (), . align: usize = align_of::(), . is_zst: bool = T::IS_ZST, . ) => ub_checks::maybe_is_aligned_and_not_null(addr, align, is_zst) . ); 4,837 ( 0.00%) intrinsics::write_via_move(dst, src) 150 ( 0.00%) => ???:0x0000000000173dc0 (5x) . } . } . . /// Overwrites a memory location with the given value without reading or . /// dropping the old value. . /// . /// Unlike [`write()`], the pointer may be unaligned. . /// -- line 1971 ---------------------------------------- -- line 2500 ---------------------------------------- . /// assert!(!std::ptr::eq(&a[0..2], &a[1..3])); . /// ``` . #[stable(feature = "ptr_eq", since = "1.17.0")] . #[inline(always)] . #[must_use = "pointer comparison produces a value"] . #[rustc_diagnostic_item = "ptr_eq"] . #[allow(ambiguous_wide_pointer_comparisons)] // it's actually clear here . pub fn eq(a: *const T, b: *const T) -> bool { 4 ( 0.00%) a == b . } . . /// Compares the *addresses* of the two pointers for equality, . /// ignoring any metadata in fat pointers. . /// . /// If the arguments are thin pointers of the same type, . /// then this is the same as [`eq`]. . /// -- line 2516 ---------------------------------------- -- line 2524 ---------------------------------------- . /// . /// assert!(ptr::addr_eq(whole, first)); . /// assert!(!ptr::eq::(whole, first)); . /// ``` . #[stable(feature = "ptr_addr_eq", since = "1.76.0")] . #[inline(always)] . #[must_use = "pointer comparison produces a value"] . pub fn addr_eq(p: *const T, q: *const U) -> bool { 1,306,448 ( 0.01%) (p as *const ()) == (q as *const ()) . } . . /// Compares the *addresses* of the two function pointers for equality. . /// . /// This is the same as `f == g`, but using this function makes clear that the potentially . /// surprising semantics of function pointer comparison are involved. . /// . /// There are **very few guarantees** about how functions are compiled and they have no intrinsic -- line 2540 ---------------------------------------- 556 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/combined_early_pass.rs -------------------------------------------------------------------------------- Ir -- line 19 ---------------------------------------- . /// Run one field's `check_*`. . /// . /// Fully qualified through [`rustc_lint::EarlyLintPass`] since some passes impl . /// both `EarlyLintPass` and `LateLintPass` with like-named methods, which would . /// be ambiguous on the concrete field type. . #[macro_export] . macro_rules! run_combined_early_lint_pass_field { . ($self:ident, $field:ident, $name:ident, ($($arg:expr),* $(,)?)) => { 32,244,488 ( 0.16%) rustc_lint::EarlyLintPass::$name(&mut $self.$field, $($arg),*); 1,776 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/module_style.rs:::check_item (4x) 983 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/empty_line_after.rs:::check_item (4x) 312 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/single_component_path_imports.rs:::check_item (4x) 120 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/definition_in_module_root.rs:::check_item (4x) 70 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/unnecessary_self_imports.rs:::check_item (4x) 68 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/duplicate_mod.rs:::check_item (4x) 68 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/partial_pub_fields.rs:::check_item (4x) 36 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/crate_in_macro_def.rs:::check_item (4x) 12 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/visibility.rs:::check_item (4x) . }; . } . . /// Forward one `check_*` method to every field of the combined pass. . #[macro_export] . macro_rules! expand_combined_early_lint_pass_method { . ([$($field:ident),*], $self:ident, $name:ident, $args:tt) => ({ . $($crate::run_combined_early_lint_pass_field!($self, $field, $name, $args);)* -- line 35 ---------------------------------------- -- line 36 ---------------------------------------- . }) . } . . /// Generate the combined `EarlyLintPass` impl's `check_*` methods, one per method . /// in rustc's early-pass method list. . #[macro_export] . macro_rules! expand_combined_early_lint_pass_methods { . ($fields:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( 10,617,199 ( 0.05%) $(#[inline(always)] fn $name(&mut self, cx: &rustc_lint::EarlyContext<'_>, $($param: $arg),*) { . $crate::expand_combined_early_lint_pass_method!($fields, self, $name, (cx, $($param),*)); 1,966,180 ( 0.01%) })* . ) . } . . /// Declare the combined struct (one field per pass) plus its . /// `LintPass`/`EarlyLintPass` impls. The method list comes from . /// `rustc_lint::early_lint_methods!` so it can't drift from rustc's. . /// . /// Each entry is `Field: Type = constructor`; `new`'s params (`conf`, ...) come -- line 54 ---------------------------------------- -- line 60 ---------------------------------------- . $methods:tt . ) => { . #[allow(non_snake_case)] . pub struct $name { . $($field: $fty,)* . } . . impl $name { 9 ( 0.00%) pub fn new($($pname: $pty,)*) -> Self { 81 ( 0.00%) Self { . $($field: $ctor,)* . } 9 ( 0.00%) } . } . . #[allow(rustc::lint_pass_impl_without_macro)] . impl rustc_lint::LintPass for $name { . fn name(&self) -> &'static str { . stringify!($name) . } . fn get_lints(&self) -> rustc_lint::LintVec { -- line 80 ---------------------------------------- 4 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/functions/result.rs -------------------------------------------------------------------------------- Ir -- line 10 ---------------------------------------- . use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_then}; . use clippy_utils::ty::{AdtVariantInfo, approx_ty_size}; . use clippy_utils::{is_no_std_crate, trait_ref_of_method}; . . use super::{RESULT_LARGE_ERR, RESULT_UNIT_ERR}; . . /// The type of the `Err`-variant in a `std::result::Result` returned by the . /// given `FnDecl` 11 ( 0.00%) fn result_err_ty<'tcx>( . cx: &LateContext<'tcx>, . decl: &hir::FnDecl<'tcx>, . id: hir::def_id::LocalDefId, . item_span: Span, . ) -> Option<(&'tcx hir::Ty<'tcx>, Ty<'tcx>)> { 4 ( 0.00%) if !item_span.in_external_macro(cx.sess().source_map()) . && let hir::FnRetTy::Return(hir_ty) = decl.output . { . let mut ty = cx . .tcx . .instantiate_bound_regions_with_erased(cx.tcx.fn_sig(id).instantiate_identity().skip_norm_wip().output()); . . // for async functions, peel through `impl Future` to get `T` . if cx.tcx.ty_is_opaque_future(ty) -- line 32 ---------------------------------------- -- line 38 ---------------------------------------- . if let ty::Adt(adt_def, args) = ty.kind() . && cx.tcx.is_diagnostic_item(sym::Result, adt_def.did()) . { . let err_ty = args.type_at(1); . return Some((hir_ty, err_ty)); . } . } . None 9 ( 0.00%) } . 36 ( 0.00%) pub(super) fn check_item<'tcx>( . cx: &LateContext<'tcx>, . item: &hir::Item<'tcx>, . large_err_threshold: u64, . large_err_ignored: &DefIdSet, . msrv: Msrv, . ) { 8 ( 0.00%) if let hir::ItemKind::Fn { ref sig, .. } = item.kind 12 ( 0.00%) && let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.owner_id.def_id, item.span) 141 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/functions/result.rs:clippy_lints::functions::result::result_err_ty (1x) . { . if cx.effective_visibilities.is_exported(item.owner_id.def_id) { . let fn_header_span = item.span.with_hi(sig.decl.output.span().hi()); . check_result_unit_err(cx, err_ty, fn_header_span, msrv); . } . check_result_large_err(cx, err_ty, hir_ty.span, large_err_threshold, large_err_ignored, false); . } 32 ( 0.00%) } . . pub(super) fn check_impl_item<'tcx>( . cx: &LateContext<'tcx>, . item: &hir::ImplItem<'tcx>, . large_err_threshold: u64, . large_err_ignored: &DefIdSet, . msrv: Msrv, . ) { -- line 72 ---------------------------------------- -- line 178 ---------------------------------------- . diag.span_label(hir_ty_span, format!("the `Err`-variant is at least {ty_size} bytes")); . diag.help(format!("try reducing the size of `{err_ty}`, for example by boxing large elements or replacing it with `Box<{err_ty}>`")); . }, . ); . } . } . } . 2,752,561 ( 0.01%) pub(super) fn check_expr<'tcx>( . cx: &LateContext<'tcx>, . expr: &'tcx hir::Expr<'tcx>, . large_err_threshold: u64, . large_err_ignored: &DefIdSet, . ) { 786,446 ( 0.00%) if let hir::ExprKind::Closure(closure) = expr.kind . && let ty::Closure(_, args) = cx.typeck_results().expr_ty(expr).kind() . && let closure_sig = args.as_closure().sig() . && let Ok(err_binder) = closure_sig.output().try_map_bound(|output_ty| { . if let ty::Adt(adt, args) = output_ty.kind() . && let [_, err_arg] = args.as_slice() . && let Some(err_ty) = err_arg.as_type() . && adt.is_diag_item(cx, sym::Result) . { -- line 200 ---------------------------------------- -- line 206 ---------------------------------------- . { . let err_ty = cx.tcx.instantiate_bound_regions_with_erased(err_binder); . let hir_ty_span = match closure.fn_decl.output { . hir::FnRetTy::Return(hir_ty) => hir_ty.span, . hir::FnRetTy::DefaultReturn(_) => expr.span, . }; . check_result_large_err(cx, err_ty, hir_ty_span, large_err_threshold, large_err_ignored, true); . } 3,145,784 ( 0.02%) } 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/msrvs.rs -------------------------------------------------------------------------------- Ir -- line 110 ---------------------------------------- . } . } . . impl Msrv { . /// Returns the MSRV at the current node . /// . /// If the crate being linted uses an `#[clippy::msrv]` attribute this will search the parent . /// nodes for that attribute, prefer to run this check after cheaper pattern matching operations 3 ( 0.00%) pub fn current(self, cx: &LateContext<'_>) -> Option { 786,464 ( 0.00%) if SEEN_MSRV_ATTR.load(Ordering::Relaxed) { . self.for_attrs(cx.tcx, cx.last_node_with_lint_attrs) . } else { . self.0 . } 4 ( 0.00%) } . . /// Returns the MSRV at the specified node . /// . /// If the crate being linted uses an `#[clippy::msrv]` attribute this will search the parent . /// nodes for that attribute, prefer to run this check after cheaper pattern matching operations . pub fn at(self, tcx: TyCtxt<'_>, node: HirId) -> Option { 1 ( 0.00%) if SEEN_MSRV_ATTR.load(Ordering::Relaxed) { . self.for_attrs(tcx, node) . } else { . self.0 . } . } . . fn for_attrs(self, tcx: TyCtxt<'_>, node: HirId) -> Option { . once(node) -- line 139 ---------------------------------------- -- line 141 ---------------------------------------- . .find_map(|id| parse_attrs(tcx.hir_attrs(id))) . .or(self.0) . } . . /// Checks if a required version from [this module](self) is met at the current node . /// . /// If the crate being linted uses an `#[clippy::msrv]` attribute this will search the parent . /// nodes for that attribute, prefer to run this check after cheaper pattern matching operations 3,932,315 ( 0.02%) pub fn meets(self, cx: &LateContext<'_>, required: RustcVersion) -> bool { . self.current(cx).is_none_or(|msrv| msrv >= required) 3,145,852 ( 0.02%) } . /// Checks if a required version from [this module](self) is met at the specified node . /// . /// If the crate being linted uses an `#[clippy::msrv]` attribute this will search the parent . /// nodes for that attribute, prefer to run this check after cheaper pattern matching operations . pub fn meets_at(self, tcx: TyCtxt<'_>, node: HirId, required: RustcVersion) -> bool { . self.at(tcx, node).is_none_or(|msrv| msrv >= required) . } . -- line 159 ---------------------------------------- -- line 233 ---------------------------------------- . . impl MsrvStack { . pub fn current(&self) -> Option { . self.stack.last().copied() . } . . pub fn meets(&self, required: RustcVersion) -> bool { . self.current().is_none_or(|msrv| msrv >= required) 393,225 ( 0.00%) } . . pub fn check_attributes(&mut self, attrs: &[Attribute]) { . if let Some(version) = parse_attrs(attrs) { . SEEN_MSRV_ATTR.store(true, Ordering::Relaxed); . self.stack.push(version); . } 2,359,356 ( 0.01%) } . . pub fn check_attributes_post(&mut self, attrs: &[Attribute]) { . if parse_attrs(attrs).is_some() { . self.stack.pop(); . } 2,359,356 ( 0.01%) } . } . . fn parse_attrs(attrs: &[impl AttributeExt]) -> Option { 40 ( 0.00%) let msrv_attr = attrs.iter().find(|attr| attr.path_matches(&[sym::clippy, sym::msrv]))?; 40 ( 0.00%) => ???:::path_matches (5x) . . let msrv = msrv_attr.value_str()?; . . parse_version(msrv) . } . 3,145,824 ( 0.02%) pub fn check_attrs(sess: &Session, attrs: &[impl AttributeExt]) { 4 ( 0.00%) let mut msrv_attrs = attrs.iter().filter(|attr| attr.path_matches(&[sym::clippy, sym::msrv])); 8 ( 0.00%) => ???:::path_matches (1x) . . let Some(msrv_attr) = msrv_attrs.next() else { . return; . }; . . if let Some(duplicate) = msrv_attrs.next_back() { . sess.dcx() . .struct_span_err(duplicate.span(), "`clippy::msrv` is defined multiple times") -- line 274 ---------------------------------------- -- line 280 ---------------------------------------- . sess.dcx().span_err(msrv_attr.span(), "bad clippy attribute"); . return; . }; . . if parse_version(msrv).is_none() { . sess.dcx() . .span_err(msrv_attr.span(), format!("`{msrv}` is not a valid Rust version")); . } 3,145,824 ( 0.02%) } 1,179,689 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_is_ascii_check.rs -------------------------------------------------------------------------------- Ir -- line 85 ---------------------------------------- . /// 'A..=F' . UpperHexLetter, . /// '0..=9' | 'a..=f' | 'A..=F' . HexDigit, . Otherwise, . } . . impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,671 ( 0.01%) if !matches!( 786,446 ( 0.00%) expr.kind, 1 ( 0.00%) ExprKind::Match(_, [_, ..], _) | ExprKind::MethodCall(_, _, [_], _) . ) { . return; . } . . if !self.msrv.meets(cx, msrvs::IS_ASCII_DIGIT) { . return; . } . -- line 104 ---------------------------------------- -- line 127 ---------------------------------------- . let range = check_expr_range(start, end); . (arg, expr.span, range) . } else { . return; . }; . . let ty_sugg = get_ty_sugg(cx, arg); . check_is_ascii(cx, span, arg, &range, ty_sugg); 3,145,784 ( 0.02%) } . } . . fn get_ty_sugg<'tcx>(cx: &LateContext<'tcx>, arg: &Expr<'_>) -> Option<(Span, Ty<'tcx>)> { . let local_hid = arg.res_local_id()?; . if let Node::Param(Param { ty_span, span, .. }) = cx.tcx.parent_hir_node(local_hid) . // `ty_span` and `span` are the same for inferred type, thus a type suggestion must be given . && ty_span == span . { -- line 143 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/panicking_overflow_checks.rs -------------------------------------------------------------------------------- Ir -- line 44 ---------------------------------------- . correctness, . "overflow checks which will panic in debug mode" . } . . declare_lint_pass!(PanickingOverflowChecks => [PANICKING_OVERFLOW_CHECKS]); . . impl<'tcx> LateLintPass<'tcx> for PanickingOverflowChecks { . // a + b < a, a > a + b, a < a - b, a - b > a 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,450 ( 0.00%) if let ExprKind::Binary(op, lhs, rhs) = expr.kind 3 ( 0.00%) && let (lt, gt) = match op.node { . BinOpKind::Lt => (lhs, rhs), . BinOpKind::Gt => (rhs, lhs), . _ => return, . } . && let ctxt = expr.span.ctxt() . && let (op_lhs, op_rhs, other, commutative) = match (<.kind, >.kind) { . (&ExprKind::Binary(op, lhs, rhs), _) if op.node == BinOpKind::Add && ctxt == lt.span.ctxt() => { . (lhs, rhs, gt, true) -- line 62 ---------------------------------------- -- line 76 ---------------------------------------- . { . span_lint( . cx, . PANICKING_OVERFLOW_CHECKS, . expr.span, . "you are trying to use classic C overflow conditions that will fail in Rust", . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/nonnull_unchecked_on_box_ptr.rs -------------------------------------------------------------------------------- Ir -- line 43 ---------------------------------------- . . impl NonnullUncheckedOnBoxPtr { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for NonnullUncheckedOnBoxPtr { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,452 ( 0.00%) if !expr.span.from_expansion() . && let ExprKind::Call(nonnull_new_unchecked, [arg]) = expr.kind . && let ExprKind::Call(box_into_raw, [arg]) = arg.kind . && nonnull_new_unchecked . .ty_rel_def_if_named(cx, sym::new_unchecked) . .opt_parent(cx) . .opt_impl_ty(cx) . .is_diag_item(cx, sym::NonNull) . && box_into_raw -- line 60 ---------------------------------------- -- line 89 ---------------------------------------- . } else { . format!("NonNull::from(Box::leak({arg_name}))") . }; . . diag.span_suggestion(span, "try", sugg, app); . }, . ); . } 3,145,784 ( 0.02%) } . } 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/raw_strings.rs -------------------------------------------------------------------------------- Ir -- line 60 ---------------------------------------- . . pub struct RawStrings { . pub allow_one_hash_in_raw_strings: bool, . } . . impl RawStrings { . pub fn new(conf: &'static Conf) -> Self { . Self { 1 ( 0.00%) allow_one_hash_in_raw_strings: conf.allow_one_hash_in_raw_strings, . } . } . } . . impl EarlyLintPass for RawStrings { 3,538,989 ( 0.02%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 1,441,819 ( 0.01%) if let ExprKind::FormatArgs(format_args) = &expr.kind . && !format_args.span.in_external_macro(cx.sess().source_map()) . && format_args.span.check_text(cx, |src| src.starts_with('r')) . && let Some(str) = snippet_opt(cx.sess(), format_args.span) . && let count_hash = str.bytes().skip(1).take_while(|b| *b == b'#').count() . && let Some(str) = str.get(count_hash + 2..str.len() - count_hash - 1) . { . self.check_raw_string( . cx, -- line 83 ---------------------------------------- -- line 84 ---------------------------------------- . str, . format_args.span, . "r", . u8::try_from(count_hash).unwrap(), . "string", . ); . } . 1,048,572 ( 0.01%) if let ExprKind::Lit(lit) = expr.kind 1,310,715 ( 0.01%) && let (prefix, max) = match lit.kind { . LitKind::StrRaw(max) => ("r", max), . LitKind::ByteStrRaw(max) => ("br", max), . LitKind::CStrRaw(max) => ("cr", max), . _ => return, . } . && !expr.span.in_external_macro(cx.sess().source_map()) . && expr.span.check_text(cx, |src| src.starts_with(prefix)) . { . self.check_raw_string(cx, lit.symbol.as_str(), expr.span, prefix, max, lit.kind.descr()); . } 3,145,768 ( 0.02%) } . } . . impl RawStrings { . fn check_raw_string(&self, cx: &EarlyContext<'_>, str: &str, lit_span: Span, prefix: &str, max: u8, descr: &str) { . if !str.contains(['\\', '"']) { . span_lint_and_then( . cx, . NEEDLESS_RAW_STRINGS, -- line 112 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/format.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . . impl UselessFormat { . pub fn new(format_args: FormatArgsStorage) -> Self { . Self { format_args } . } . } . . impl<'tcx> LateLintPass<'tcx> for UselessFormat { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // Loosened from `root_macro_call_first_node` so the lint also fires when `format!` is . // the tail of a block emitted by another macro. The `!= macro_call.expn` check filters . // HIR nodes inside `format!`'s own expansion (its outer block's tail, its nested . // `format_args!`), which would otherwise also pass `first_node_in_macro` and cause the . // lint to fire multiple times per call. 1,966,115 ( 0.01%) if let Some(macro_call) = matching_root_macro_call(cx, expr.span, sym::format_macro) 25,954,199 ( 0.13%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::matching_root_macro_call (393,223x) . && first_node_in_macro(cx, expr).is_some_and(|p_expn| p_expn != macro_call.expn) . && let Some(format_args) = self.format_args.get(cx, expr, macro_call.expn) . { . let mut applicability = Applicability::MachineApplicable; . let call_site = macro_call.span; . . match (format_args.arguments.all_args(), &format_args.template[..]) { . ([], []) => span_useless_format_empty(cx, call_site, "String::new()".to_owned(), applicability), -- line 69 ---------------------------------------- -- line 101 ---------------------------------------- . format!("{}.to_string()", sugg.maybe_paren()) . }; . span_useless_format(cx, call_site, sugg, applicability); . } . }, . _ => {}, . } . } 3,145,784 ( 0.02%) } . } . . fn span_useless_format_empty(cx: &LateContext<'_>, span: Span, sugg: String, applicability: Applicability) { . span_lint_and_sugg( . cx, . USELESS_FORMAT, . span, . "useless use of `format!`", -- line 117 ---------------------------------------- 393,223 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/mem_replace.rs -------------------------------------------------------------------------------- Ir -- line 292 ---------------------------------------- . . impl MemReplace { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for MemReplace { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::Call(func, [dest, src]) = expr.kind . // Check that `expr` is a call to `mem::replace()` . && let ExprKind::Path(ref func_qpath) = func.kind . && let Some(def_id) = cx.qpath_res(func_qpath, func.hir_id).opt_def_id() . && cx.tcx.is_diagnostic_item(sym::mem_replace, def_id) . // Check that second argument is `Option::None` . && !check_replace_option_with_none(cx, src, dest, expr.span) . && !check_replace_option_with_some(cx, src, dest, expr.span, self.msrv) . && !check_replace_with_default(cx, src, dest, expr, self.msrv) . { . check_replace_with_uninit(cx, src, dest, expr.span); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_rotate.rs -------------------------------------------------------------------------------- Ir -- line 64 ---------------------------------------- . _ => return None, . }; . return Some((dir, l, r)); . } . None . } . . impl LateLintPass<'_> for ManualRotate { 2,752,561 ( 0.01%) fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 786,449 ( 0.00%) if let ExprKind::Binary(op, l, r) = expr.kind 3 ( 0.00%) && let BinOpKind::Add | BinOpKind::BitOr = op.node . && let Some((l_shift_dir, l_expr, l_amount)) = parse_shift(l) . && let Some((r_shift_dir, r_expr, r_amount)) = parse_shift(r) . && l_shift_dir != r_shift_dir . && let ctxt = expr.span.ctxt() . && clippy_utils::eq_expr_value(cx, ctxt, l_expr, r_expr) . && let Some(bit_width) = match cx.typeck_results().expr_ty(expr).kind() { . ty::Int(itype) => itype.bit_width(), . ty::Uint(itype) => itype.bit_width(), -- line 82 ---------------------------------------- -- line 130 ---------------------------------------- . expr.span, . "this expression can be rewritten as", . format!("{expr_sugg}.{shift_function}({amount})"), . applicability, . ); . }, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs -------------------------------------------------------------------------------- Ir -- line 114 ---------------------------------------- . #[stable(feature = "global_alloc", since = "1.28.0")] . #[must_use = "losing the pointer will leak memory"] . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . pub unsafe fn alloc(layout: Layout) -> *mut u8 { . unsafe { . // Make sure we don't accidentally allow omitting the allocator shim in . // stable code until it is actually stabilized. 60,076 ( 0.00%) __rust_no_alloc_shim_is_unstable_v2(); 1 ( 0.00%) => ???:std::exception::~exception() (1x) . 26,039,742 ( 0.13%) __rust_alloc(layout.size(), layout.alignment()) 108 ( 0.00%) => ???:__rustc::__rust_alloc (3x) . } . } . . /// Deallocates memory with the global allocator. . /// . /// This function forwards calls to the [`GlobalAlloc::dealloc`] method . /// of the allocator registered with the `#[global_allocator]` attribute . /// if there is one, or the `std` crate’s default. -- line 132 ---------------------------------------- -- line 161 ---------------------------------------- . pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) { . unsafe { dealloc_nonnull(NonNull::new_unchecked(ptr), layout) } . } . . /// Same as [`dealloc`] but when you already have a non-null pointer . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . unsafe fn dealloc_nonnull(ptr: NonNull, layout: Layout) { 41,064,435 ( 0.20%) unsafe { __rust_dealloc(ptr, layout.size(), layout.alignment()) } 2,660 ( 0.00%) => ???:__rustc::__rdl_dealloc (70x) . } . . /// Reallocates memory with the global allocator. . /// . /// This function forwards calls to the [`GlobalAlloc::realloc`] method . /// of the allocator registered with the `#[global_allocator]` attribute . /// if there is one, or the `std` crate’s default. . /// -- line 177 ---------------------------------------- -- line 214 ---------------------------------------- . pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { . unsafe { realloc_nonnull(NonNull::new_unchecked(ptr), layout, new_size) } . } . . /// Same as [`realloc`] but when you already have a non-null pointer . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . unsafe fn realloc_nonnull(ptr: NonNull, layout: Layout, new_size: usize) -> *mut u8 { 13,865,725 ( 0.07%) unsafe { __rust_realloc(ptr, layout.size(), layout.alignment(), new_size) } 663,083,868 ( 3.26%) => ???:__rustc::__rust_realloc (2,773,145x) . } . . /// Allocates zero-initialized memory with the global allocator. . /// . /// This function forwards calls to the [`GlobalAlloc::alloc_zeroed`] method . /// of the allocator registered with the `#[global_allocator]` attribute . /// if there is one, or the `std` crate’s default. . /// -- line 230 ---------------------------------------- -- line 284 ---------------------------------------- . __rust_alloc_zeroed(layout.size(), layout.alignment()) . } . } . . impl Global { . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . fn alloc_impl_runtime(layout: Layout, zeroed: bool) -> Result, AllocError> { 17,121,712 ( 0.08%) match layout.size() { . 0 => Ok(layout.dangling_ptr().cast_slice(0)), . // SAFETY: `layout` is non-zero in size, . size => unsafe { 8,560,863 ( 0.04%) let raw_ptr = if zeroed { alloc_zeroed(layout) } else { alloc(layout) }; 4 ( 0.00%) => ???:std::exception::~exception() (4x) . let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?; . Ok(ptr.cast_slice(size)) . }, . } . } . . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . fn deallocate_impl_runtime(ptr: NonNull, layout: Layout) { 65,576 ( 0.00%) if layout.size() != 0 { . // SAFETY: . // * We have checked that `layout` is non-zero in size. . // * The caller is obligated to provide a layout that "fits", and in this case, . // "fit" always means a layout that is equal to the original, because our . // `allocate()`, `grow()`, and `shrink()` implementations never returns a larger . // allocation than requested. . // * Other conditions must be upheld by the caller, as per `Allocator::deallocate()`'s . // safety documentation. -- line 314 ---------------------------------------- 26,386,160 ( 0.13%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/suspicious_trait_impl.rs -------------------------------------------------------------------------------- Ir -- line 55 ---------------------------------------- . . declare_lint_pass!(SuspiciousImpl => [ . SUSPICIOUS_ARITHMETIC_IMPL, . SUSPICIOUS_OP_ASSIGN_IMPL, . ]); . . impl<'tcx> LateLintPass<'tcx> for SuspiciousImpl { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 1,572,892 ( 0.01%) match expr.kind { 1 ( 0.00%) hir::ExprKind::Binary(op, _, _) => { 4 ( 0.00%) check_expr_inner(cx, expr, op.node, op.span); . }, . hir::ExprKind::AssignOp(op, _, _) => { . check_expr_inner(cx, expr, op.node.into(), op.span); . }, . _ => {}, . } . } . } . 7 ( 0.00%) fn check_expr_inner<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, binop: hir::BinOpKind, span: Span) { . if let Some((binop_trait_lang, op_assign_trait_lang)) = binop_traits(binop) . && let Some(binop_trait_id) = cx.tcx.lang_items().get(binop_trait_lang) . && let Some(op_assign_trait_id) = cx.tcx.lang_items().get(op_assign_trait_lang) . . // Check for more than one binary operation in the implemented function . // Linting when multiple operations are involved can result in false positives . && let parent_fn = cx.tcx.hir_get_parent_item(expr.hir_id).def_id . && let hir::Node::ImplItem(impl_item) = cx.tcx.hir_node_by_def_id(parent_fn) -- line 83 ---------------------------------------- -- line 101 ---------------------------------------- . span, . format!( . "suspicious use of `{}` in `{}` impl", . binop.as_str(), . cx.tcx.item_name(trait_id) . ), . ); . } 8 ( 0.00%) } . . fn count_binops(expr: &hir::Expr<'_>) -> u32 { . let mut count = 0u32; . let _: Option = for_each_expr_without_closures(expr, |e| { . if matches!( . e.kind, . hir::ExprKind::Binary(..) . | hir::ExprKind::Unary(hir::UnOp::Not | hir::UnOp::Neg, _) -- line 117 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/doc/suspicious_doc_comments.rs -------------------------------------------------------------------------------- Ir -- line 4 ---------------------------------------- . use rustc_errors::Applicability; . use rustc_hir::Attribute; . use rustc_hir::attrs::AttributeKind; . use rustc_lint::LateContext; . use rustc_span::Span; . . use super::SUSPICIOUS_DOC_COMMENTS; . 2,752,603 ( 0.01%) pub fn check(cx: &LateContext<'_>, attrs: &[Attribute]) -> bool { . let replacements: Vec<_> = collect_doc_replacements(attrs); . 786,458 ( 0.00%) if let Some((&(lo_span, _), &(hi_span, _))) = replacements.first().zip(replacements.last()) { . span_lint_and_then( . cx, . SUSPICIOUS_DOC_COMMENTS, . lo_span.to(hi_span), . "this is an outer doc comment and does not apply to the parent module or crate", . |diag| { . diag.multipart_suggestion( . "use an inner doc comment to document the parent module or crate", -- line 23 ---------------------------------------- -- line 26 ---------------------------------------- . ); . }, . ); . . true . } else { . false . } 3,145,832 ( 0.02%) } . . fn collect_doc_replacements(attrs: &[Attribute]) -> Vec<(Span, String)> { . attrs . .iter() . .filter_map(|attr| { 2 ( 0.00%) if let Attribute::Parsed(AttributeKind::DocComment { . style: AttrStyle::Outer, . kind: DocFragmentKind::Sugared(comment_kind), . comment, . .. . }) = attr . && let Some(com) = comment.as_str().strip_prefix('!') . { . let sugg = match comment_kind { . CommentKind::Block => format!("/*!{com}*/"), . CommentKind::Line => format!("//!{com}"), . }; . Some((attr.span(), sugg)) . } else { 1 ( 0.00%) None . } . }) . .collect() . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/multi_assignments.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . expr . } . }, . _ => expr, . } . } . . impl EarlyLintPass for MultiAssignments { 1,179,663 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if let ExprKind::Assign(target, source, _) = &expr.kind { . if let ExprKind::Assign(_target, _source, _) = &strip_paren_blocks(target).kind { . span_lint(cx, MULTI_ASSIGNMENTS, expr.span, "assignments don't nest intuitively"); . } . if let ExprKind::Assign(_target, _source, _) = &strip_paren_blocks(source).kind { . span_lint(cx, MULTI_ASSIGNMENTS, expr.span, "assignments don't nest intuitively"); . } . } 1,572,884 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/assertions_on_constants.rs -------------------------------------------------------------------------------- Ir -- line 39 ---------------------------------------- . } . impl AssertionsOnConstants { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 7 ( 0.00%) if let Some(macro_call) = root_macro_call_first_node(cx, e) 5 ( 0.00%) && let is_debug = match cx.tcx.get_diagnostic_name(macro_call.def_id) { 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::debug_assert_macro) => true, . Some(sym::assert_macro) => false, . _ => return, . } 7 ( 0.00%) && let Some((condition, _)) = find_assert_args(cx, e, macro_call.expn) 1,108 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::find_assert_args (1x) . // Check if the whole expression can be moved into a const context. . // Note that const eval can evaluate things which cannot be moved (e.g. `false && x`). 5 ( 0.00%) && is_const_evaluatable(cx.tcx, cx.typeck_results(), condition) 6,494 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:clippy_utils::visitors::is_const_evaluatable (1x) . && let Some((Constant::Bool(assert_val), const_src)) = . ConstEvalCtxt::new(cx).eval_with_source(condition, macro_call.span.ctxt()) . && let in_const_context = is_inside_always_const_context(cx.tcx, e.hir_id) . && (const_src.is_local() || !in_const_context) . && !(is_debug && as_bool_lit(condition) == Some(false)) . { . let (msg, help) = if !const_src.is_local() { . let help = if self.msrv.meets(cx, msrvs::CONST_BLOCKS) { -- line 65 ---------------------------------------- -- line 76 ---------------------------------------- . ( . "this assertion is always `false`", . "replace this with `panic!()` or `unreachable!()`", . ) . }; . . span_lint_and_help(cx, ASSERTIONS_ON_CONSTANTS, macro_call.span, msg, None, help); . } 3,145,784 ( 0.02%) } . } . . fn as_bool_lit(e: &Expr<'_>) -> Option { . if let ExprKind::Lit(l) = e.kind . && let LitKind::Bool(b) = l.node . { . Some(b) . } else { -- line 92 ---------------------------------------- 5 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/double_parens.rs -------------------------------------------------------------------------------- Ir -- line 36 ---------------------------------------- . pub DOUBLE_PARENS, . complexity, . "Warn on unnecessary double parentheses" . } . . declare_lint_pass!(DoubleParens => [DOUBLE_PARENS]); . . impl EarlyLintPass for DoubleParens { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 2,752,541 ( 0.01%) match &expr.kind { . // ((..)) . // ^^^^^^ expr . // ^^^^ inner . ExprKind::Paren(inner) . if matches!(inner.kind, ExprKind::Paren(_) | ExprKind::Tup(_)) . && expr.span.eq_ctxt(inner.span) . && !expr.span.in_external_macro(cx.sess().source_map()) . && check_source(cx, inner) => -- line 53 ---------------------------------------- -- line 69 ---------------------------------------- . applicability, . ); . }, . . // func((n)) . // ^^^^^^^^^ expr . // ^^^ arg . // ^ inner 1 ( 0.00%) ExprKind::Call(_, args) | ExprKind::MethodCall(MethodCall { args, .. }) 4 ( 0.00%) if let [arg] = &**args 3 ( 0.00%) && let ExprKind::Paren(inner) = &arg.kind . && expr.span.eq_ctxt(arg.span) . && !arg.span.in_external_macro(cx.sess().source_map()) . && check_source(cx, arg) => . { . // suggest removing the inner parens . . let mut applicability = Applicability::MachineApplicable; . let sugg = snippet_with_context(cx.sess(), inner.span, arg.span.ctxt(), "_", &mut applicability).0; -- line 87 ---------------------------------------- -- line 92 ---------------------------------------- . "unnecessary parentheses", . "remove them", . sugg.to_string(), . applicability, . ); . }, . _ => {}, . } 3,145,768 ( 0.02%) } . } . . /// Check that the span does indeed look like `( (..) )` . fn check_source(cx: &EarlyContext<'_>, inner: &Expr) -> bool { . if let Some(sfr) = inner.span.get_source_range(cx) . // this is the same as `SourceFileRange::as_str`, but doesn't apply the range right away, because . // we're interested in the source code outside it . && let Some(src) = sfr.sf.src.as_ref().map(|src| src.as_str()) -- line 108 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs -------------------------------------------------------------------------------- Ir -- line 17 ---------------------------------------- . let $len = unsafe { &mut *(&raw mut $this.end_or_len).cast::() }; . $zst_body . } else { . // SAFETY: for non-ZSTs, the type invariant ensures it cannot be null . let $end = unsafe { &mut *(&raw mut $this.end_or_len).cast::>() }; . $other_body . } . }}; 1,572,955 ( 0.01%) ($this:ident, $len:ident => $zst_body:expr, $end:ident => $other_body:expr,) => {{ . #![allow(unused_unsafe)] // we're sometimes used within an unsafe block . 2 ( 0.00%) if T::IS_ZST { . let $len = $this.end_or_len.addr(); . $zst_body . } else { . // SAFETY: for non-ZSTs, the type invariant ensures it cannot be null . let $end = unsafe { mem::transmute::<*const T, NonNull>($this.end_or_len) }; . $other_body . } . }}; -- line 36 ---------------------------------------- -- line 172 ---------------------------------------- . // cannot wrap. (Ideally this would be `checked_sub`, which . // does the same thing internally, but as of 2025-02 that . // doesn't optimize quite as small in MIR.) . self.end_or_len = without_provenance_mut(len.unchecked_sub(1)); . } else { . // SAFETY: by type invariant, the `end_or_len` field is always . // non-null for a non-ZST pointee. (This transmute ensures we . // get `!nonnull` metadata on the load of the field.) 27,296,780 ( 0.13%) if ptr == crate::intrinsics::transmute::<$ptr, NonNull>(end_or_len) { . return None; . } . // SAFETY: since it's not empty, per the check above, moving . // forward one keeps us inside the slice, and this is valid. 2 ( 0.00%) self.ptr = ptr.add(1); . } . // SAFETY: Now that we know it wasn't empty and we've moved past . // the first one (to avoid giving a duplicate `&mut` next time), . // we can give out a reference to it. . Some({ptr}.$into_ref()) . } . } . -- line 193 ---------------------------------------- -- line 266 ---------------------------------------- . return init; . } . let mut acc = init; . let mut i = 0; . let len = len!(self); . loop { . // SAFETY: the loop iterates `i in 0..len`, which always is in bounds of . // the slice allocation 970 ( 0.00%) acc = f(acc, unsafe { & $( $mut_ )? *self.ptr.add(i).as_ptr() }); . // SAFETY: `i` can't overflow since it'll only reach usize::MAX if the . // slice had that length, in which case we'll break out of the loop . // after the increment . i = unsafe { i.unchecked_add(1) }; 819 ( 0.00%) if i == len { . break; . } . } . acc . } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is -- line 287 ---------------------------------------- -- line 302 ---------------------------------------- . // faster to compile. . #[inline] . fn all(&mut self, mut f: F) -> bool . where . Self: Sized, . F: FnMut(Self::Item) -> bool, . { . while let Some(x) = self.next() { 10 ( 0.00%) if !f(x) { . return false; . } . } . true . } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is -- line 318 ---------------------------------------- -- line 319 ---------------------------------------- . // faster to compile. . #[inline] . fn any(&mut self, mut f: F) -> bool . where . Self: Sized, . F: FnMut(Self::Item) -> bool, . { . while let Some(x) = self.next() { 507 ( 0.00%) if f(x) { . return true; . } . } . false . } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is -- line 335 ---------------------------------------- -- line 336 ---------------------------------------- . // faster to compile. . #[inline] . fn find

(&mut self, mut predicate: P) -> Option . where . Self: Sized, . P: FnMut(&Self::Item) -> bool, . { . while let Some(x) = self.next() { 38 ( 0.00%) if predicate(&x) { . return Some(x); . } . } . None . } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is -- line 352 ---------------------------------------- -- line 353 ---------------------------------------- . // faster to compile. . #[inline] . fn find_map(&mut self, mut f: F) -> Option . where . Self: Sized, . F: FnMut(Self::Item) -> Option, . { . while let Some(x) = self.next() { 7 ( 0.00%) if let Some(y) = f(x) { 12 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:<&mut clippy_lints::doc::suspicious_doc_comments::collect_doc_replacements::{closure#0} as core::ops::function::FnMut<(&rustc_hir::hir::Attribute,)>>::call_mut (1x) . return Some(y); . } . } . None 3 ( 0.00%) } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is . // faster to compile. Also, the `assume` avoids a bounds check. . #[inline] . fn position

{ . pub(crate) active: bool, . pub(crate) pass: P, . } . . impl Gated

{ . #[inline] . pub fn new bool>(is_active: &F, pass: P) -> Self { 70 ( 0.00%) let active = is_active(&pass.get_lints()); 368 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lint_defs/src/lib.rs:::get_lints (1x) 361 ( 0.00%) Gated { active, pass } 90 ( 0.00%) => ???:0x0000000000173dc0 (3x) . } . } . . /// Run one field's `check_*`, if that field is active. . /// . /// Fully qualified through [`rustc_lint::LateLintPass`] since some passes impl . /// both `EarlyLintPass` and `LateLintPass` with like-named methods, which would . /// be ambiguous on the concrete field type. The args arrive as one `tt` and are . /// re-parsed here so the per-field and per-argument repetitions never share a . /// nesting level. . #[macro_export] . macro_rules! run_combined_late_lint_pass_field { . ($self:ident, $field:ident, $name:ident, ($($arg:expr),* $(,)?)) => { 182,850,181 ( 0.90%) if $self.$field.active { 163,712,561 ( 0.81%) rustc_lint::LateLintPass::$name(&mut $self.$field.pass, $($arg),*); 330 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/items_after_test_module.rs:::check_mod (1x) . } . }; . } . . /// Forward one `check_*` method to every field of the combined pass. . #[macro_export] . macro_rules! expand_combined_late_lint_pass_method { . ([$($field:ident),*], $self:ident, $name:ident, $args:tt) => ({ -- line 48 ---------------------------------------- -- line 50 ---------------------------------------- . }) . } . . /// Generate the combined `LateLintPass` impl's `check_*` methods, one per method . /// in rustc's late-pass method list. . #[macro_export] . macro_rules! expand_combined_late_lint_pass_methods { . ($fields:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( 9,830,983 ( 0.05%) $(#[inline(always)] fn $name(&mut self, cx: &rustc_lint::LateContext<'tcx>, $($param: $arg),*) { . $crate::expand_combined_late_lint_pass_method!($fields, self, $name, (cx, $($param),*)); 4,718,932 ( 0.02%) })* . ) . } . . /// Declare the combined struct (one [`Gated`] field per pass) plus its . /// `LintPass`/`LateLintPass` impls. The method list comes from . /// `rustc_lint::late_lint_methods!` so it can't drift from rustc's. . /// . /// Each entry is `Field: Type = constructor`; `new`'s params (`tcx`, `conf`, ...) -- line 68 ---------------------------------------- -- line 74 ---------------------------------------- . $methods:tt . ) => { . #[allow(non_snake_case)] . pub struct $name<'tcx> { . $($field: $crate::combined_late_pass::Gated<$fty>,)* . } . . impl<'tcx> $name<'tcx> { 17 ( 0.00%) pub fn new bool>($($pname: $pty,)* is_active: &F) -> Self { 55 ( 0.00%) Self { 9 ( 0.00%) $($field: $crate::combined_late_pass::Gated::new(is_active, $ctor),)* . } 8 ( 0.00%) } . } . . #[allow(rustc::lint_pass_impl_without_macro)] . impl<'tcx> rustc_lint::LintPass for $name<'tcx> { . fn name(&self) -> &'static str { . stringify!($name) . } 10 ( 0.00%) fn get_lints(&self) -> rustc_lint::LintVec { 1 ( 0.00%) => ???:std::exception::~exception() (1x) . // Reserve at least one slot per pass up front to skip the early reallocations. . let mut lints = Vec::with_capacity([$(stringify!($field)),*].len()); 3 ( 0.00%) $(lints.extend(self.$field.pass.get_lints());)* 368 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lint_defs/src/lib.rs:::get_lints (1x) 3 ( 0.00%) lints 9 ( 0.00%) } . } . . impl<'tcx> rustc_lint::LateLintPass<'tcx> for $name<'tcx> { . $crate::expand_combined_late_lint_pass_methods!([$($field),*], $methods); . } . }; . } 2,752,779 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unit_return_expecting_ord.rs -------------------------------------------------------------------------------- Ir -- line 153 ---------------------------------------- . Some((fn_decl_span, None)) . } . } else { . None . } . } . . impl<'tcx> LateLintPass<'tcx> for UnitReturnExpectingOrd { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,447 ( 0.00%) if let ExprKind::MethodCall(_, receiver, args, _) = expr.kind . && args.iter().any(|arg| { . matches!( . arg.peel_blocks().peel_borrows().peel_drop_temps().kind, . ExprKind::Path(_) | ExprKind::Closure(_) . ) . }) . && let Some(fn_mut_trait) = cx.tcx.lang_items().fn_mut_trait() . { -- line 170 ---------------------------------------- -- line 190 ---------------------------------------- . if let Some(last_semi) = last_semi { . diag.span_help(last_semi, "probably caused by this trailing semicolon"); . } . }, . ); . } . } . } 3,145,784 ( 0.02%) } . } 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/size_of_in_element_count.rs -------------------------------------------------------------------------------- Ir -- line 71 ---------------------------------------- . sym::add, . sym::wrapping_add, . sym::sub, . sym::wrapping_sub, . sym::offset, . sym::wrapping_offset, . ]; . 1,966,117 ( 0.01%) if let ExprKind::Call(func, [.., count]) = expr.kind . // Find calls to ptr::{copy, copy_nonoverlapping} . // and ptr::swap_nonoverlapping, 3 ( 0.00%) && let ExprKind::Path(ref func_qpath) = func.kind 5 ( 0.00%) && let Some(def_id) = cx.qpath_res(func_qpath, func.hir_id).opt_def_id() 23 ( 0.00%) => ???:::qpath_res (1x) 13 ( 0.00%) && matches!(cx.tcx.get_diagnostic_name(def_id), Some( 80 ( 0.00%) => ???:::get_diagnostic_name (1x) . sym::ptr_copy . | sym::ptr_copy_nonoverlapping . | sym::ptr_slice_from_raw_parts . | sym::ptr_slice_from_raw_parts_mut . | sym::ptr_swap_nonoverlapping . | sym::slice_from_raw_parts . | sym::slice_from_raw_parts_mut . )) . . // Get the pointee type . && let Some(pointee_ty) = cx.typeck_results().node_args(func.hir_id).types().next() . { . return Some((pointee_ty, count)); . } 3 ( 0.00%) if let ExprKind::MethodCall(method_path, ptr_self, [.., count], _) = expr.kind . // Find calls to copy_{from,to}{,_nonoverlapping} . && let method_ident = method_path.ident.name . && METHODS.contains(&method_ident) . . // Get the pointee type . && let ty::RawPtr(pointee_ty, _) = . cx.typeck_results().expr_ty(ptr_self).kind() . { . return Some((*pointee_ty, count)); . } . None . } . . impl<'tcx> LateLintPass<'tcx> for SizeOfInElementCount { 2,359,338 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . const HELP_MSG: &str = "use a count of elements instead of a count of bytes\ . , it already gets multiplied by the size of the type"; . . const LINT_MSG: &str = "found a count of bytes \ . instead of a count of elements of `T`"; . . if let Some((pointee_ty, count_expr)) = get_pointee_ty_and_count_expr(cx, expr) . // Using a number of bytes for a byte type isn't suspicious -- line 122 ---------------------------------------- -- line 126 ---------------------------------------- . . // Find a size_of call in the count parameter expression and . // check that it's the same type . && let Some(ty_used_for_size_of) = get_size_of_ty(cx, count_expr, false) . && pointee_ty == ty_used_for_size_of . { . span_lint_and_help(cx, SIZE_OF_IN_ELEMENT_COUNT, count_expr.span, LINT_MSG, None, HELP_MSG); . } 2,359,338 ( 0.01%) } . } 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs -------------------------------------------------------------------------------- Ir . use rustc_ast::ast::{LitFloatType, LitIntType, LitKind}; . use std::iter; . . /// Represents the base of a numeric literal, used for parsing and formatting. 915,356 ( 0.00%) #[derive(Debug, PartialEq, Eq, Copy, Clone)] . pub enum Radix { . /// A binary literal (e.g., `0b1010`) . Binary, . /// An octal literal (e.g., `0o670`) . Octal, . /// A decimal literal (e.g., `123`) . Decimal, . /// A hexadecimal literal (e.g., `0xFF`) -- line 13 ---------------------------------------- -- line 47 ---------------------------------------- . pub exponent: Option<(&'a str, &'a str)>, . . /// The type suffix, including preceding underscore if present. . pub suffix: Option<&'a str>, . } . . impl<'a> NumericLiteral<'a> { . /// Attempts to parse a `NumericLiteral` from the source string of an `ast::LitKind`. 2,939,463 ( 0.01%) pub fn from_lit_kind(src: &'a str, lit_kind: &LitKind) -> Option> { . let unsigned_src = src.strip_prefix('-').map_or(src, |s| s); . if lit_kind.is_numeric() . && unsigned_src . .trim_start() . .chars() . .next() . .is_some_and(|c| c.is_ascii_digit()) . { . let (unsuffixed, suffix) = split_suffix(src, lit_kind); 979,821 ( 0.00%) let float = matches!(lit_kind, LitKind::Float(..)); 1,306,428 ( 0.01%) Some(NumericLiteral::new(unsuffixed, suffix, float)) 44,162,435 ( 0.22%) => site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::new (326,607x) . } else { . None . } 2,612,856 ( 0.01%) } . . /// Parses a raw numeric literal string into its structured `NumericLiteral` parts. . #[must_use] 2,737,490 ( 0.01%) pub fn new(lit: &'a str, suffix: Option<&'a str>, float: bool) -> Self { . let unsigned_lit = lit.trim_start_matches('-'); . // Determine delimiter for radix prefix, if present, and radix. 391,069 ( 0.00%) let radix = if unsigned_lit.starts_with("0x") { . Radix::Hexadecimal 326,602 ( 0.00%) } else if unsigned_lit.starts_with("0b") { . Radix::Binary 326,602 ( 0.00%) } else if unsigned_lit.starts_with("0o") { . Radix::Octal . } else { . Radix::Decimal . }; . . // Grab part of the literal after prefix, if present. . let (prefix, mut sans_prefix) = if radix == Radix::Decimal { . (None, lit) . } else { . let (p, s) = lit.split_at(2); . (Some(p), s) . }; . 717,673 ( 0.00%) if suffix.is_some() && sans_prefix.ends_with('_') { . // The '_' before the suffix isn't part of the digits . sans_prefix = &sans_prefix[..sans_prefix.len() - 1]; . } . . let (integer, fraction, exponent) = Self::split_digit_parts(sans_prefix, float); . 5,866,050 ( 0.03%) Self { . radix, . prefix, . integer, . fraction, . exponent, . suffix, . } 3,519,630 ( 0.02%) } . . /// Checks if the literal's radix is `Radix::Decimal` . pub fn is_decimal(&self) -> bool { . self.radix == Radix::Decimal . } . . fn split_digit_parts(digits: &str, float: bool) -> (&str, Option<&str>, Option<(&str, &str)>) { . let mut integer = digits; . let mut fraction = None; . let mut exponent = None; . 782,140 ( 0.00%) if float { 5,898,150 ( 0.03%) for (i, c) in digits.char_indices() { . match c { . '.' => { . integer = &digits[..i]; 196,605 ( 0.00%) fraction = Some(&digits[i + 1..]); . }, . 'e' | 'E' => { . let exp_start = if digits[..i].ends_with('_') { i - 1 } else { i }; . . if integer.len() > exp_start { . integer = &digits[..exp_start]; . } else { . fraction = Some(&digits[integer.len() + 1..exp_start]); -- line 135 ---------------------------------------- -- line 235 ---------------------------------------- . .map_or((src, None), |split_pos| { . let (unsuffixed, suffix) = src.split_at(split_pos); . (unsuffixed, Some(suffix)) . }) . } . . fn lit_suffix_length(lit_kind: &LitKind) -> Option { . debug_assert!(lit_kind.is_numeric()); 653,214 ( 0.00%) let suffix = match lit_kind { 520,008 ( 0.00%) LitKind::Int(_, int_lit_kind) => match int_lit_kind { . LitIntType::Signed(int_ty) => Some(int_ty.name_str()), . LitIntType::Unsigned(uint_ty) => Some(uint_ty.name_str()), . LitIntType::Unsuffixed => None, . }, 589,815 ( 0.00%) LitKind::Float(_, float_lit_kind) => match float_lit_kind { . LitFloatType::Suffixed(float_ty) => Some(float_ty.name_str()), . LitFloatType::Unsuffixed => None, . }, . _ => None, . }; . . suffix.map(str::len) . } -- line 257 ---------------------------------------- 1,299,996 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unit_types/mod.rs -------------------------------------------------------------------------------- Ir -- line 110 ---------------------------------------- . } . . impl<'tcx> LateLintPass<'tcx> for UnitTypes { . fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) { . let_unit_value::check(cx, &self.format_args, local); . } . . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,179,669 ( 0.01%) unit_cmp::check(cx, expr); 11,407,983 ( 0.06%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_cmp.rs:clippy_lints::unit_types::unit_cmp::check (393,223x) 1,179,669 ( 0.01%) unit_arg::check(cx, expr); 60,162,667 ( 0.30%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/unit_types/unit_arg.rs:clippy_lints::unit_types::unit_arg::check (393,223x) . } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_clamp.rs -------------------------------------------------------------------------------- Ir -- line 134 ---------------------------------------- . struct InputMinMax<'tcx> { . input: &'tcx Expr<'tcx>, . min: &'tcx Expr<'tcx>, . max: &'tcx Expr<'tcx>, . is_float: bool, . } . . impl<'tcx> LateLintPass<'tcx> for ManualClamp { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { . // Cheap kind check before the costlier const context query. 393,223 ( 0.00%) if matches!( 786,446 ( 0.00%) expr.kind, . ExprKind::If(..) | ExprKind::Match(..) | ExprKind::MethodCall(..) | ExprKind::Call(..) 6 ( 0.00%) ) && !expr.span.from_expansion() 4 ( 0.00%) && !is_in_const_context(cx) 331 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_in_const_context (1x) . { . let suggestion = is_if_elseif_else_pattern(cx, expr) 2 ( 0.00%) .or_else(|| is_max_min_pattern(cx, expr)) . .or_else(|| is_call_max_min_pattern(cx, expr)) . .or_else(|| is_match_pattern(cx, expr)) . .or_else(|| is_if_elseif_pattern(cx, expr)); . if let Some(suggestion) = suggestion . && self.msrv.meets(cx, msrvs::CLAMP) . { . maybe_emit_suggestion(cx, &suggestion); . } . } 3,145,784 ( 0.02%) } . 14 ( 0.00%) fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) { . // Cheap `if`-statement check before the costlier const context query. 2 ( 0.00%) if !block . .stmts . .iter() 2 ( 0.00%) .any(|stmt| matches!(stmt.kind, StmtKind::Expr(e) if matches!(e.kind, ExprKind::If(..)))) . { . return; . } . . if is_in_const_context(cx) || !self.msrv.meets(cx, msrvs::CLAMP) { . return; . } . for suggestion in is_two_if_pattern(cx, block) { . maybe_emit_suggestion(cx, &suggestion); . } 16 ( 0.00%) } . } . . fn maybe_emit_suggestion<'tcx>(cx: &LateContext<'tcx>, suggestion: &ClampSuggestion<'tcx>) { . if !suggestion.min_less_than_max(cx) { . return; . } . let ClampSuggestion { . params: InputMinMax { -- line 187 ---------------------------------------- -- line 302 ---------------------------------------- . /// . /// ```no_run . /// # let (input, min_value, max_value) = (0, -3, 12); . /// . /// input.max(min_value).min(max_value) . /// # ; . /// ``` . fn is_max_min_pattern<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option> { 4 ( 0.00%) if let ExprKind::MethodCall(seg_second, receiver, [arg_second], _) = expr.kind . && let ExprKind::MethodCall(seg_first, input, [arg_first], _) = &receiver.kind . // Match method names before the costlier type queries. . && let Some((min, max)) = match (seg_first.ident.name, seg_second.ident.name) { . (sym::min, sym::max) => Some((arg_second, arg_first)), . (sym::max, sym::min) => Some((arg_first, arg_second)), . _ => None, . } . && (cx.typeck_results().expr_ty_adjusted(receiver).is_floating_point() -- line 318 ---------------------------------------- -- line 416 ---------------------------------------- . make_assignment: None, . hir_with_ignore_attr: None, . }) . } else { . None . } . } . 8 ( 0.00%) if let ExprKind::Call(outer_fn, [first, second]) = &expr.kind { . check(cx, outer_fn, first, second, expr.span).or_else(|| check(cx, outer_fn, second, first, expr.span)) . } else { . None . } . } . . /// Targets patterns like . /// -- line 432 ---------------------------------------- -- line 436 ---------------------------------------- . /// match input { . /// input if input > max => max, . /// input if input < min => min, . /// input => input, . /// } . /// # ; . /// ``` . fn is_match_pattern<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option> { 2 ( 0.00%) if let ExprKind::Match(value, [first_arm, second_arm, last_arm], rustc_hir::MatchSource::Normal) = &expr.kind { . // Find possible min/max branches . let minmax_values = |a: &'tcx Arm<'tcx>| { . if let PatKind::Binding(_, var_hir_id, _, None) = &a.pat.kind . && let Some(e) = a.guard . { . Some((e, var_hir_id, a.body)) . } else { . None -- line 452 ---------------------------------------- 1,179,664 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/question_mark.rs -------------------------------------------------------------------------------- Ir -- line 285 ---------------------------------------- . /// if result.is_err() { . /// return result; . /// } . /// ``` . /// . /// If it matches, it will suggest to use the `?` operator instead . fn check_is_none_or_err_and_early_return<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { . if let Some(higher::If { cond, then, r#else }) = higher::If::hir(expr) 6 ( 0.00%) && !is_else_clause(cx.tcx, expr) 162 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_else_clause (1x) 2 ( 0.00%) && let ExprKind::MethodCall(segment, caller, [], _) = &cond.kind . && let caller_ty = cx.typeck_results().expr_ty(caller) . && let if_block = IfBlockType::IfIs(caller, caller_ty, segment.ident.name, then) . && (is_early_return(sym::Option, cx, &if_block) || is_early_return(sym::Result, cx, &if_block)) . { . let mut applicability = Applicability::MachineApplicable; . let receiver_str = snippet_with_context(cx, caller.span, expr.span.ctxt(), "..", &mut applicability).0; . let by_ref = !cx.type_is_copy_modulo_regions(caller_ty) . && !matches!(caller.kind, ExprKind::Call(..) | ExprKind::MethodCall(..)); -- line 302 ---------------------------------------- -- line 461 ---------------------------------------- . #[derive(Debug)] . enum IfLetOrMatchThen<'tcx> { . /// Return the binding from an if let or match arm as is. . DirectReturn, . /// Working on the binding from an if let or match arm as if it comes from a `?`. . ManualUnwrap(Span, &'tcx Expr<'tcx>), . } . 8 ( 0.00%) fn check_if_try_match<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 2 ( 0.00%) if let ExprKind::Match(scrutinee, [arm1, arm2], MatchSource::Normal | MatchSource::Postfix) = expr.kind . && !expr.span.from_expansion() . && let Some(mode) = find_try_mode(cx, scrutinee) . && !span_contains_cfg(cx, expr.span) . && let Some(if_let_or_match_then) = check_arms_are_try(cx, mode, arm1, arm2) . { . span_lint_and_then( . cx, . QUESTION_MARK, -- line 478 ---------------------------------------- -- line 509 ---------------------------------------- . ); . } . diag.span_suggestion(expr.span, "try instead", sugg, applicability); . }, . } . }, . ); . } 8 ( 0.00%) } . . fn check_if_let_some_or_err_and_early_return<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 1 ( 0.00%) if let Some(higher::IfLet { . let_pat, . let_expr, . if_then, . if_else, . .. 5 ( 0.00%) }) = higher::IfLet::hir(cx, expr) 8 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (1x) . && let PatKind::TupleStruct(ref path1, [field], ddpos) = let_pat.kind . && ddpos.as_opt_usize().is_none() . && let PatKind::Binding(BindingMode(by_ref, _), bind_id, ident, None) = field.kind . && let caller_ty = cx.typeck_results().expr_ty(let_expr) . && let if_block = IfBlockType::IfLet( . cx.qpath_res(path1, let_pat.hir_id), . caller_ty, . ident.name, -- line 534 ---------------------------------------- -- line 602 ---------------------------------------- . . impl QuestionMark { . fn inside_try_block(&self) -> bool { . self.try_block_depth_stack.last() > Some(&0) . } . } . . fn is_try_block(cx: &LateContext<'_>, bl: &Block<'_>) -> bool { 8 ( 0.00%) if let Some(expr) = bl.expr 10 ( 0.00%) && let ExprKind::Call(callee, [_]) = expr.kind 14 ( 0.00%) && let ExprKind::Path(qpath) = callee.kind 4 ( 0.00%) && cx.tcx.qpath_is_lang_item(qpath, LangItem::TryTraitFromOutput) 129 ( 0.00%) => ???:::qpath_is_lang_item (1x) . { . true . } else { . false . } . } . . fn is_inferred_ret_closure(expr: &Expr<'_>) -> bool { 2,752,557 ( 0.01%) let ExprKind::Closure(closure) = expr.kind else { . return false; . }; . . match closure.fn_decl.output { . FnRetTy::Return(ret_ty) => ret_ty.is_suggestable_infer_ty(), . FnRetTy::DefaultReturn(_) => true, . } . } . . impl<'tcx> LateLintPass<'tcx> for QuestionMark { 7 ( 0.00%) fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) { . // Cheap `let` check before the costlier lint level and const context queries. 2 ( 0.00%) if !matches!(stmt.kind, StmtKind::Let(..)) { . return; . } . . if !is_lint_allowed(cx, QUESTION_MARK_USED, stmt.hir_id) || !self.msrv.meets(cx, msrvs::QUESTION_MARK_OPERATOR) . { . return; . } . . if !self.inside_try_block() && !is_in_const_context(cx) { . check_let_some_else_return_none(cx, stmt); . } . self.check_manual_let_else(cx, stmt); 8 ( 0.00%) } . 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if is_inferred_ret_closure(expr) { . self.inferred_ret_closure_stack += 1; . return; . } . . // Cheap `if`/`match` check before the costlier lint level and const context queries. . if matches!(expr.kind, ExprKind::If(..) | ExprKind::Match(..)) 3 ( 0.00%) && !self.inside_try_block() 4 ( 0.00%) && !is_in_const_context(cx) 331 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_in_const_context (1x) 7 ( 0.00%) && is_lint_allowed(cx, QUESTION_MARK_USED, expr.hir_id) 414 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_lint_allowed (1x) 6 ( 0.00%) && self.msrv.meets(cx, msrvs::QUESTION_MARK_OPERATOR) 15 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:::meets (1x) . { . check_is_none_or_err_and_early_return(cx, expr); . check_if_let_some_or_err_and_early_return(cx, expr); . 2 ( 0.00%) if self.inferred_ret_closure_stack == 0 { 3 ( 0.00%) check_if_try_match(cx, expr); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/question_mark.rs:clippy_lints::question_mark::check_if_try_match (1x) . } . } 3,145,784 ( 0.02%) } . . fn check_expr_post(&mut self, _: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { . if is_inferred_ret_closure(expr) { . self.inferred_ret_closure_stack -= 1; . } . } . . fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) { 5 ( 0.00%) if is_try_block(cx, block) { . *self . .try_block_depth_stack . .last_mut() . .expect("blocks are always part of bodies and must have a depth") += 1; . } . } . . fn check_body(&mut self, _: &LateContext<'tcx>, _: &Body<'tcx>) { -- line 687 ---------------------------------------- -- line 688 ---------------------------------------- . self.try_block_depth_stack.push(0); . } . . fn check_body_post(&mut self, _: &LateContext<'tcx>, _: &Body<'tcx>) { . self.try_block_depth_stack.pop(); . } . . fn check_block_post(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) { 5 ( 0.00%) if is_try_block(cx, block) { . *self . .try_block_depth_stack . .last_mut() . .expect("blocks are always part of bodies and must have a depth") -= 1; . } . } . } 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs -------------------------------------------------------------------------------- Ir -- line 61 ---------------------------------------- . pub struct Map { . // Used for `SplitWhitespace` and `SplitAsciiWhitespace` `as_str` methods . pub(crate) iter: I, . f: F, . } . . impl Map { . pub(in crate::iter) const fn new(iter: I, f: F) -> Map { 1,966,150 ( 0.01%) Map { iter, f } . } . . pub(crate) fn into_inner(self) -> I { . self.iter . } . } . . #[stable(feature = "core_impl_debug", since = "1.9.0")] -- line 77 ---------------------------------------- -- line 80 ---------------------------------------- . f.debug_struct("Map").field("iter", &self.iter).finish() . } . } . . fn map_fold( . mut f: impl FnMut(T) -> B, . mut g: impl FnMut(Acc, B) -> Acc, . ) -> impl FnMut(Acc, T) -> Acc { 18 ( 0.00%) move |acc, elt| g(acc, f(elt)) . } . . fn map_try_fold<'a, T, B, Acc, R>( . f: &'a mut impl FnMut(T) -> B, . mut g: impl FnMut(Acc, B) -> R + 'a, . ) -> impl FnMut(Acc, T) -> R + 'a { 1 ( 0.00%) move |acc, elt| g(acc, f(elt)) . } . . #[stable(feature = "rust1", since = "1.0.0")] . impl Iterator for Map . where . F: FnMut(I::Item) -> B, . { . type Item = B; . . #[inline] 147 ( 0.00%) fn next(&mut self) -> Option { 48 ( 0.00%) self.iter.next().map(&mut self.f) 222 ( 0.00%) => ???:::next (3x) 54 ( 0.00%) } . . #[inline] . fn size_hint(&self) -> (usize, Option) { . self.iter.size_hint() . } . 3,932,230 ( 0.02%) fn try_fold(&mut self, init: Acc, g: G) -> R . where . Self: Sized, . G: FnMut(Acc, Self::Item) -> R, . R: Try, . { . self.iter.try_fold(init, map_try_fold(&mut self.f, g)) 3,145,784 ( 0.02%) } . 69 ( 0.00%) fn fold(self, init: Acc, g: G) -> Acc . where . G: FnMut(Acc, Self::Item) -> Acc, . { 2 ( 0.00%) self.iter.fold(init, map_fold(self.f, g)) 64 ( 0.00%) } . . #[inline] . unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> B . where . Self: TrustedRandomAccessNoCoerce, . { . // SAFETY: the caller must uphold the contract for . // `Iterator::__iterator_get_unchecked`. -- line 137 ---------------------------------------- 196,622 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/from_str_radix_10.rs -------------------------------------------------------------------------------- Ir -- line 38 ---------------------------------------- . pub FROM_STR_RADIX_10, . style, . "from_str_radix with radix 10" . } . . declare_lint_pass!(FromStrRadix10 => [FROM_STR_RADIX_10]); . . impl<'tcx> LateLintPass<'tcx> for FromStrRadix10 { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, exp: &Expr<'tcx>) { 786,448 ( 0.00%) if let ExprKind::Call(maybe_path, [src, radix]) = &exp.kind . && let ExprKind::Path(QPath::TypeRelative(ty, pathseg)) = &maybe_path.kind . . // check if the second argument is a primitive `10` . && is_integer_literal(radix, 10) . . // check if the second part of the path indeed calls the associated . // function `from_str_radix` . && pathseg.ident.name == sym::from_str_radix -- line 55 ---------------------------------------- -- line 79 ---------------------------------------- . FROM_STR_RADIX_10, . exp.span, . "this call to `from_str_radix` can be replaced with a call to `str::parse`", . "try", . format!("{sugg}.parse::<{}>()", prim_ty.name_str()), . Applicability::MaybeIncorrect, . ); . } 3,145,784 ( 0.02%) } . } . . /// Checks if a Ty is `String` or `&str` . fn is_ty_stringish(cx: &LateContext<'_>, ty: Ty<'_>) -> bool { . ty.is_lang_item(cx, LangItem::String) || ty.peel_refs().is_str() . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/useless_vec.rs -------------------------------------------------------------------------------- Ir -- line 43 ---------------------------------------- . /// work, we get a false positive warning on the `$v.push(3)` which really requires `$v` to . /// be a vector. . span_to_state: BTreeMap, . allow_in_test: bool, . } . . impl UselessVec { . pub fn new(conf: &'static Conf) -> Self { 5 ( 0.00%) Self { . too_large_for_stack: conf.too_large_for_stack, . msrv: conf.msrv.into(), . span_to_state: BTreeMap::new(), 2 ( 0.00%) allow_in_test: conf.allow_useless_vec_in_tests, . } . } . } . . declare_clippy_lint! { . /// ### What it does . /// Checks for usage of `vec![..]` when using `[..]` would . /// be possible. -- line 63 ---------------------------------------- -- line 166 ---------------------------------------- . VecToArray::Impossible . } . }, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for UselessVec { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,572,892 ( 0.01%) if let Some(vec_args) = higher::VecArgs::hir(cx, expr.peel_borrows()) 6,684,959 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . // The `vec![]` or `&vec![]` invocation span. . && let vec_span = expr.span.parent_callsite().unwrap_or(expr.span) . && !vec_span.from_expansion() . { . if self.allow_in_test && is_in_test(cx.tcx, expr.hir_id) { . return; . } . -- line 183 ---------------------------------------- -- line 232 ---------------------------------------- . }); . } . }, . VecToArray::Impossible => { . self.span_to_state.insert(vec_span, VecState::NoChange); . }, . } . } 3,145,784 ( 0.02%) } . 8 ( 0.00%) fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { 10 ( 0.00%) for (span, state) in mem::take(&mut self.span_to_state) { . if let VecState::Change { . suggest_ty, . vec_snippet, . expr_hir_id, . } = state . { . span_lint_hir_and_then(cx, USELESS_VEC, expr_hir_id, span, "useless use of `vec!`", |diag| { . let help_msg = format!("you can use {} directly", suggest_ty.desc()); -- line 251 ---------------------------------------- -- line 255 ---------------------------------------- . Applicability::Unspecified . } else { . Applicability::MachineApplicable . }; . diag.span_suggestion(span, help_msg, vec_snippet, applicability); . }); . } . } 8 ( 0.00%) } . } . . #[derive(Copy, Clone)] . pub(crate) enum SuggestedType { . /// Suggest using a slice `&[..]` / `&mut [..]` . SliceRef(Mutability), . /// Suggest using an array: `[..]` . Array, -- line 271 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/format_args.rs -------------------------------------------------------------------------------- Ir -- line 321 ---------------------------------------- . ty_msrv_map: FxHashMap, Option>, . has_derived_debug: FxHashMap, bool>, . has_pointer_format: FxHashMap, bool>, . } . . impl<'tcx> FormatArgs<'tcx> { . pub fn new(tcx: TyCtxt<'tcx>, conf: &'static Conf, format_args: FormatArgsStorage) -> Self { . let ty_msrv_map = make_ty_msrv_map(tcx); 13 ( 0.00%) Self { . format_args, . msrv: conf.msrv.into(), 1 ( 0.00%) ignore_mixed: conf.allow_mixed_uninlined_format_args, . ty_msrv_map, . has_derived_debug: FxHashMap::default(), . has_pointer_format: FxHashMap::default(), . } . } . } . . impl<'tcx> LateLintPass<'tcx> for FormatArgs<'tcx> { 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 6 ( 0.00%) if let Some(macro_call) = root_macro_call_first_node(cx, expr) 6 ( 0.00%) && is_format_macro(cx, macro_call.def_id) 115 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::is_format_macro (1x) 8 ( 0.00%) && let Some(format_args) = self.format_args.get(cx, expr, macro_call.expn) 2,711 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:::get (1x) . { . let mut linter = FormatArgsExpr { . cx, . expr, . macro_call: ¯o_call, . format_args, . ignore_mixed: self.ignore_mixed, . msrv: &self.msrv, -- line 352 ---------------------------------------- -- line 357 ---------------------------------------- . . linter.check_trailing_comma(); . linter.check_templates(); . . if self.msrv.meets(cx, msrvs::FORMAT_ARGS_CAPTURE) { . linter.check_uninlined_args(); . } . } 3,145,784 ( 0.02%) } . } . . struct FormatArgsExpr<'a, 'tcx> { . cx: &'a LateContext<'tcx>, . expr: &'tcx Expr<'tcx>, . macro_call: &'a MacroCall, . format_args: &'a rustc_ast::FormatArgs, . ignore_mixed: bool, -- line 373 ---------------------------------------- -- line 866 ---------------------------------------- . } . } . } . . fn make_ty_msrv_map(tcx: TyCtxt<'_>) -> FxHashMap, Option> { . [(sym::OsStr, Some(msrvs::OS_STR_DISPLAY)), (sym::Path, None)] . .into_iter() . .filter_map(|(name, feature)| { 6 ( 0.00%) tcx.get_diagnostic_item(name).map(|def_id| { 624,852 ( 0.00%) => ???:::get_diagnostic_item (2x) . let ty = Ty::new_adt(tcx, tcx.adt_def(def_id), List::empty()); . (ty, feature) . }) . }) . .collect() . } . . fn count_needed_derefs<'tcx, I>(mut ty: Ty<'tcx>, mut iter: I) -> (usize, Ty<'tcx>) -- line 882 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs -------------------------------------------------------------------------------- Ir -- line 361 ---------------------------------------- . /// let mut map = HashMap::with_hasher(s); . /// map.insert(1, 2); . /// ``` . #[inline] . #[must_use] . #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] . #[rustc_const_stable(feature = "const_collections_with_hasher", since = "1.85.0")] . pub const fn with_hasher(hash_builder: S) -> HashMap { 1,572,976 ( 0.01%) HashMap { base: base::HashMap::with_hasher(hash_builder) } . } . . /// Creates an empty `HashMap` with at least the specified capacity, using . /// `hasher` to hash the keys. . /// . /// The hash map will be able to hold at least `capacity` elements without . /// reallocating. This method is allowed to allocate for more elements than . /// `capacity`. If `capacity` is zero, the hash map will not allocate. -- line 377 ---------------------------------------- -- line 1326 ---------------------------------------- . /// assert_eq!(map.insert(37, "c"), Some("b")); . /// assert_eq!(map[&37], "c"); . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_confusables("push", "append", "put")] . #[cfg_attr(not(test), rustc_diagnostic_item = "hashmap_insert")] . pub fn insert(&mut self, k: K, v: V) -> Option { 2 ( 0.00%) self.base.insert(k, v) 570 ( 0.00%) => /rust/deps/hashbrown-0.17.1/src/map.rs:, rustc_hash::FxBuildHasher>>::insert (1x) . } . . /// Tries to insert a key-value pair into the map, and returns . /// a mutable reference to the value in the entry. . /// . /// If the map already had this key present, nothing is updated, and . /// an error containing the occupied entry, key, and the value is returned. . /// -- line 1342 ---------------------------------------- -- line 1431 ---------------------------------------- . where . K: Clone, . V: Clone, . S: Clone, . A: Allocator + Clone, . { . #[inline] . fn clone(&self) -> Self { 14 ( 0.00%) Self { base: self.base.clone() } . } . . #[inline] . fn clone_from(&mut self, source: &Self) { . self.base.clone_from(&source.base); . } . } . -- line 1447 ---------------------------------------- -- line 3006 ---------------------------------------- . where . K: Eq + Hash, . S: BuildHasher + Default, . { . /// Constructs a `HashMap` from an iterator of key-value pairs. . /// . /// If the iterator produces any pairs with equal keys, . /// all but one of the corresponding values will be dropped. 33 ( 0.00%) fn from_iter>(iter: T) -> HashMap { . let mut map = HashMap::with_hasher(Default::default()); 51 ( 0.00%) map.extend(iter); 154 ( 0.00%) => ???:0x0000000000173dc0 (2x) 38 ( 0.00%) map 34 ( 0.00%) } . } . . /// Inserts all new key-values from the iterator and replaces values with existing . /// keys with new values returned from the iterator. . #[stable(feature = "rust1", since = "1.0.0")] . impl Extend<(K, V)> for HashMap . where . K: Eq + Hash, . S: BuildHasher, . A: Allocator, . { . #[inline] . fn extend>(&mut self, iter: T) { 4 ( 0.00%) self.base.extend(iter) 4,307 ( 0.00%) => /rust/deps/hashbrown-0.17.1/src/map.rs: as core::iter::traits::collect::Extend<(clippy_config::types::SourceItemOrderingModuleItemKind, alloc::string::String)>>::extend::<[(clippy_config::types::SourceItemOrderingModuleItemKind, alloc::string::String); 16]> (1x) 3,718 ( 0.00%) => /rust/deps/hashbrown-0.17.1/src/map.rs: as core::iter::traits::collect::Extend<(clippy_config::types::SourceItemOrderingModuleItemKind, usize)>>::extend::<[(clippy_config::types::SourceItemOrderingModuleItemKind, usize); 16]> (1x) . } . . #[inline] . fn extend_one(&mut self, (k, v): (K, V)) { . self.base.insert(k, v); . } . . #[inline] -- line 3040 ---------------------------------------- -- line 3066 ---------------------------------------- . Extend::<(K, V)>::extend_reserve(self, additional) . } . } . . #[inline] . fn map_entry<'a, K: 'a, V: 'a, A: Allocator>( . raw: base::RustcEntry<'a, K, V, A>, . ) -> Entry<'a, K, V, A> { 38 ( 0.00%) match raw { . base::RustcEntry::Occupied(base) => Entry::Occupied(OccupiedEntry { base }), . base::RustcEntry::Vacant(base) => Entry::Vacant(VacantEntry { base }), . } . } . . #[inline] . pub(super) fn map_try_reserve_error(err: hashbrown::TryReserveError) -> TryReserveError { . match err { -- line 3082 ---------------------------------------- 28 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/attrs.rs -------------------------------------------------------------------------------- Ir -- line 8 ---------------------------------------- . use rustc_lexer::TokenKind; . use rustc_lint::LateContext; . use rustc_middle::ty::{AdtDef, TyCtxt}; . use rustc_session::Session; . use rustc_span::{Span, Symbol}; . use std::str::FromStr as _; . . /// Validates a single clippy attribute and emits errors for unknown or deprecated ones. 9 ( 0.00%) pub fn check_clippy_attr(sess: &Session, attr: &A) { 1 ( 0.00%) if let [clippy, segment2] = &*attr.path() . && *clippy == sym::clippy . { . let path_span = attr . .path_span() . .expect("Clippy attributes are unparsed and have a span"); . . match *segment2 { . sym::cyclomatic_complexity => { -- line 25 ---------------------------------------- -- line 40 ---------------------------------------- . | sym::msrv . | sym::has_significant_drop . | sym::format_args => {}, . _ => { . sess.dcx().span_err(path_span, "usage of unknown attribute"); . }, . } . } 7 ( 0.00%) } . . /// Given `attrs`, extract all the instances of a built-in Clippy attribute called `name` . pub fn get_builtin_attr<'a, A: AttributeExt + 'a>(attrs: &'a [A], name: Symbol) -> impl Iterator { . attrs.iter().filter(move |attr| { . if let [clippy, segment2] = &*attr.path() . && *clippy == sym::clippy . { . if *segment2 == sym::cyclomatic_complexity { -- line 56 ---------------------------------------- -- line 99 ---------------------------------------- . variant_def.is_field_list_non_exhaustive() || find_attr!(tcx, variant_def.def_id, NonExhaustive(..)) . }) . || adt . .all_fields() . .any(|field_def| find_attr!(tcx, field_def.did, NonExhaustive(..))) . } . . /// Checks whether the given span contains a `#[cfg(..)]` attribute 2 ( 0.00%) pub fn span_contains_cfg(cx: &LateContext<'_>, s: Span) -> bool { . s.check_text(cx, |src| { . // PERF: A `#[cfg]` needs a literal `#`, so skip the lexer when the source has none. 2 ( 0.00%) if !src.contains('#') { . return false; . } . . let mut iter = tokenize_with_text(src); . . // Search for the token sequence [`#`, `[`, `cfg`] . while iter.any(|(t, ..)| matches!(t, TokenKind::Pound)) { . let mut iter = iter.by_ref().skip_while(|(t, ..)| { -- line 118 ---------------------------------------- -- line 124 ---------------------------------------- . if matches!(iter.next(), Some((TokenKind::OpenBracket, ..))) . && matches!(iter.next(), Some((TokenKind::Ident, "cfg", _))) . { . return true; . } . } . false . }) 6 ( 0.00%) } . . /// Currently used to keep track of the current value of `#[clippy::cognitive_complexity(N)]` . pub struct LimitStack { . default: u64, . stack: Vec, . } . . impl Drop for LimitStack { -- line 140 ---------------------------------------- -- line 149 ---------------------------------------- . /// Initialize the stack starting with a default value, which usually comes from configuration . pub fn new(limit: u64) -> Self { . Self { . default: limit, . stack: vec![], . } . } . pub fn limit(&self) -> u64 { 1 ( 0.00%) self.stack.last().copied().unwrap_or(self.default) . } . pub fn push_attrs(&mut self, sess: &Session, attrs: &[impl AttributeExt], name: Symbol) { . let stack = &mut self.stack; 1,572,916 ( 0.01%) parse_attrs(sess, attrs, name, |val| stack.push(val)); 7,864,594 ( 0.04%) => site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::parse_attrs::<::push_attrs::{closure#0}, rustc_hir::hir::Attribute> (393,229x) . } . pub fn pop_attrs(&mut self, sess: &Session, attrs: &[impl AttributeExt], name: Symbol) { . let stack = &mut self.stack; 1,572,916 ( 0.01%) parse_attrs(sess, attrs, name, |val| { 7,864,596 ( 0.04%) => site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::parse_attrs::<::pop_attrs::{closure#0}, rustc_hir::hir::Attribute> (393,229x) . let popped = stack.pop(); . debug_assert_eq!(popped, Some(val)); . }); . } . } . 7,864,580 ( 0.04%) fn parse_attrs(sess: &Session, attrs: &[impl AttributeExt], name: Symbol, mut f: F) { . for attr in get_builtin_attr(attrs, name) { . let Some(value) = attr.value_str() else { . sess.dcx().span_err(attr.span(), "bad clippy attribute"); . continue; . }; . let Ok(value) = u64::from_str(value.as_str()) else { . sess.dcx().span_err(attr.span(), "not a number"); . continue; . }; . f(value); . } 6,291,664 ( 0.03%) } 393,231 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/replace_box.rs -------------------------------------------------------------------------------- Ir -- line 37 ---------------------------------------- . #[clippy::version = "1.92.0"] . pub REPLACE_BOX, . perf, . "assigning a newly created box to `Box` is inefficient" . } . . impl_lint_pass!(ReplaceBox => [REPLACE_BOX]); . 5 ( 0.00%) #[derive(Default)] . pub struct ReplaceBox { . consumed_locals: FxHashSet, . loaded_bodies: SmallVec<[BodyId; 2]>, . } . . impl ReplaceBox { . fn get_consumed_locals(&mut self, cx: &LateContext<'_>) -> &FxHashSet { . if let Some(body_id) = cx.enclosing_body -- line 53 ---------------------------------------- -- line 66 ---------------------------------------- . } . . &self.consumed_locals . } . } . . impl LateLintPass<'_> for ReplaceBox { . fn check_body_post(&mut self, _: &LateContext<'_>, body: &Body<'_>) { 6 ( 0.00%) if self.loaded_bodies.first().is_some_and(|&x| x == body.id()) { . self.consumed_locals.clear(); . self.loaded_bodies.clear(); . } . } . 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Assign(lhs, rhs, _) = &expr.kind . && !lhs.span.from_expansion() . && !rhs.span.from_expansion() . && let lhs_ty = cx.typeck_results().expr_ty(lhs) . && let Some(inner_ty) = lhs_ty.boxed_ty() . // No diagnostic for late-initialized locals . && lhs.res_local_id().is_none_or(|local| local_is_initialized(cx, local)) . // No diagnostic if this is a local that has been moved, or the field . // of a local that has been moved, or several chained field accesses of a local -- line 89 ---------------------------------------- -- line 132 ---------------------------------------- . expr.span, . "replace existing content with inner value instead", . suggestion, . app, . ); . }); . } . } 3,145,784 ( 0.02%) } . } . . fn is_default_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { . matches!(expr.kind, ExprKind::Call(func, _args) if is_default_equivalent_call(cx, func, Some(expr))) . } . . fn get_box_new_payload<'tcx>(cx: &LateContext<'_>, expr: &Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> { . if let ExprKind::Call(box_new, [arg]) = expr.kind -- line 148 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs -------------------------------------------------------------------------------- Ir -- line 879 ---------------------------------------- . Self: Sized, . F: FnMut(Self::Item), . { . #[inline] . fn call(mut f: impl FnMut(T)) -> impl FnMut((), T) { . move |(), item| f(item) . } . 73 ( 0.00%) self.fold((), call(f)); 236,985 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:, alloc::vec::Vec, ::new::{closure#0}>, as core::iter::traits::collect::Extend>::extend, alloc::vec::Vec, ::new::{closure#0}>>::{closure#0}> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<(rustc_span::def_id::DefId, ()), as core::iter::traits::collect::Extend<(rustc_span::def_id::DefId, ())>>::extend, alloc::vec::Vec, ::new::{closure#0}>, as core::iter::traits::collect::Extend>::extend, alloc::vec::Vec, ::new::{closure#0}>>::{closure#0}>>::{closure#0}>::{closure#0}> (1x) . } . . /// Creates an iterator which uses a closure to determine if an element . /// should be yielded. . /// . /// Given an element the closure must return `true` or `false`. The returned . /// iterator will yield only the elements for which the closure returns . /// `true`. -- line 895 ---------------------------------------- -- line 2078 ---------------------------------------- . // accidentally noticed that some rustc iterators had malformed `size_hint`s, . // so this will help catch such things in debug-assertions-std runners, . // even if users won't actually ever see it. . if cfg!(debug_assertions) { . let hint = self.size_hint(); . assert!(hint.1.is_none_or(|high| high >= hint.0), "Malformed size_hint {hint:?}"); . } . 4 ( 0.00%) FromIterator::from_iter(self) 47 ( 0.00%) => /rust/deps/indexmap-2.14.0/src/map.rs: as core::iter::traits::collect::FromIterator<(rustc_hir_id::HirId, usize)>>::from_iter::>, clippy_lints::ptr::ptr_arg::check_ptr_arg_usage::{closure#1}>> (1x) . } . . /// Fallibly transforms an iterator into a collection, short circuiting if . /// a failure is encountered. . /// . /// `try_collect()` is a variation of [`collect()`][`collect`] that allows fallible . /// conversions during collection. Its main use case is simplifying conversions from . /// iterators yielding [`Option`][`Option`] into `Option>`, or similarly for other [`Try`] -- line 2094 ---------------------------------------- -- line 2474 ---------------------------------------- . /// } else { . /// ControlFlow::Break(prev) . /// } . /// }); . /// assert_eq!(triangular, ControlFlow::Continue(435)); . /// ``` . #[inline] . #[stable(feature = "iterator_try_fold", since = "1.27.0")] 120 ( 0.00%) fn try_fold(&mut self, init: B, mut f: F) -> R . where . Self: Sized, . F: [const] FnMut(B, Self::Item) -> R + [const] Destruct, . R: [const] Try, . { . let mut accum = init; 10,354,954 ( 0.05%) while let Some(x) = self.next() { 105,775,642 ( 0.52%) => ???:::next (1,179,654x) 12,125,887 ( 0.06%) accum = f(accum, x)?; . } . try { accum } 81 ( 0.00%) } . . /// An iterator method that applies a fallible function to each item in the . /// iterator, stopping at the first error and returning that error. . /// . /// This can also be thought of as the fallible form of [`for_each()`] . /// or as the stateless version of [`try_fold()`]. . /// . /// [`for_each()`]: Iterator::for_each -- line 2501 ---------------------------------------- -- line 2658 ---------------------------------------- . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . fn fold(mut self, init: B, mut f: F) -> B . where . Self: Sized + [const] Destruct, . F: [const] FnMut(B, Self::Item) -> B + [const] Destruct, . { . let mut accum = init; 150 ( 0.00%) while let Some(x) = self.next() { 60 ( 0.00%) accum = f(accum, x); . } 5,898,450 ( 0.03%) accum . } . . /// Reduces the elements to a single one, by repeatedly applying a reducing . /// operation. . /// . /// If the iterator is empty, returns [`None`]; otherwise, returns the . /// result of the reduction. . /// -- line 2677 ---------------------------------------- -- line 2986 ---------------------------------------- . #[rustc_non_const_trait_method] . fn find_map(&mut self, f: F) -> Option . where . Self: Sized, . F: FnMut(Self::Item) -> Option, . { . #[inline] . fn check(mut f: impl FnMut(T) -> Option) -> impl FnMut((), T) -> ControlFlow { 18 ( 0.00%) move |(), x| match f(x) { . Some(x) => ControlFlow::Break(x), . None => ControlFlow::Continue(()), . } . } . 10 ( 0.00%) self.try_fold((), check(f)).break_value() 2,093 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs: as core::iter::traits::iterator::Iterator>::try_fold::<(), core::iter::traits::iterator::Iterator::find_map::check<(rustc_span::hygiene::ExpnId, rustc_span::hygiene::ExpnData), clippy_utils::macros::MacroCall, &mut clippy_utils::macros::macro_backtrace::{closure#0}>::{closure#0}, core::ops::control_flow::ControlFlow> (10x) . } . . /// Applies function to the elements of iterator and returns . /// the first true result or the first error. . /// . /// The return type of this method depends on the return type of the closure. . /// If you return `Result` from the closure, you'll get a `Result, E>`. . /// If you return `Option` from the closure, you'll get an `Option>`. -- line 3008 ---------------------------------------- 21,888,737 ( 0.11%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/single_range_in_vec_init.rs -------------------------------------------------------------------------------- Ir -- line 65 ---------------------------------------- . } else { . write!(f, "an array") . } . } . } . . impl LateLintPass<'_> for SingleRangeInVecInit { . #[expect(clippy::too_many_lines)] 3,539,007 ( 0.02%) fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { . // inner_expr: `vec![0..200]` or `[0..200]` . // ^^^^^^ ^^^^^^^ . // span: `vec![0..200]` or `[0..200]` . // ^^^^^^^^^^^^ ^^^^^^^^ . // suggested_type: What to print, "an array" or "a `Vec`" 786,448 ( 0.00%) let (inner_expr, span, suggested_type) = if let ExprKind::Array([inner_expr]) = expr.kind . && !expr.span.from_expansion() . { . (inner_expr, expr.span, SuggestedType::Array) 3 ( 0.00%) } else if let Some(macro_call) = root_macro_call_first_node(cx, expr) 5 ( 0.00%) && let Some(VecArgs::Vec([expr])) = VecArgs::hir(cx, expr) 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (1x) . { . (expr, macro_call.span, SuggestedType::Vec) . } else { . return; . }; . . let Some(range) = Range::hir(cx, inner_expr) else { . return; -- line 92 ---------------------------------------- -- line 188 ---------------------------------------- . format!("if you wanted {suggested_type} of len {end_snippet}, try"), . format!("{start_snippet}; {end_snippet}"), . applicability, . ); . } . } . }, . ); 3,145,784 ( 0.02%) } . } 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/borrow_as_ptr.rs -------------------------------------------------------------------------------- Ir -- line 54 ---------------------------------------- . . span_lint_and_sugg(cx, BORROW_AS_PTR, span, "borrow as raw pointer", "try", suggestion, app); . return true; . } . false . } . . /// Check for an implicit cast from reference to raw pointer outside an explicit `as`. 1,572,892 ( 0.01%) pub(super) fn check_implicit_cast<'cx>(cx: &LateContext<'cx>, expr: &Expr<'cx>) { 786,452 ( 0.00%) if !expr.span.from_expansion() . && let ExprKind::AddrOf(BorrowKind::Ref, _, pointee) = expr.kind . && !matches!(get_parent_expr(cx, expr).map(|e| e.kind), Some(ExprKind::Cast(..))) . && let [deref, borrow] = cx.typeck_results().expr_adjustments(expr) . && matches!(deref.kind, Adjust::Deref(..)) . && let Adjust::Borrow(AutoBorrow::RawPtr(mutability)) = borrow.kind . // Do not suggest taking a raw pointer to a temporary value . && !is_expr_temporary_value(cx, pointee) . && !is_from_proc_macro(cx, expr) -- line 71 ---------------------------------------- -- line 74 ---------------------------------------- . diag.span_suggestion_verbose( . expr.span.until(pointee.span), . "use a raw pointer instead", . format!("&raw {} ", mutability.ptr_str()), . Applicability::MachineApplicable, . ); . }); . } 1,966,115 ( 0.01%) } 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unused_unit.rs -------------------------------------------------------------------------------- Ir -- line 46 ---------------------------------------- . &mut self, . cx: &LateContext<'tcx>, . kind: FnKind<'tcx>, . decl: &'tcx FnDecl<'tcx>, . body: &'tcx Body<'tcx>, . span: Span, . _def_id: LocalDefId, . ) { 2 ( 0.00%) if let FnRetTy::Return(hir_ty) = decl.output . && is_unit_ty(hir_ty) . && !hir_ty.span.from_expansion() . && get_def(span) == get_def(hir_ty.span) . { . // The explicit `-> ()` in the closure signature might be necessary for multiple reasons: . // - Implicit types in closure signatures are forbidden when `for<...>` is present . // - If the closure body ends with a function call, and that function's return type is generic, the . // `-> ()` could be required for it to be inferred -- line 62 ---------------------------------------- -- line 75 ---------------------------------------- . && let Some(expr) = block.expr . && is_never_expr(cx, expr).is_some() . { . return; . } . . lint_unneeded_unit_return(cx, hir_ty.span, span); . } 1 ( 0.00%) } . . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,966,115 ( 0.01%) if let ExprKind::Ret(Some(expr)) | ExprKind::Break(_, Some(expr)) = expr.kind . && is_unit_expr(expr) . && !expr.span.from_expansion() . { . span_lint_and_sugg( . cx, . UNUSED_UNIT, . expr.span, . "unneeded `()`", . "remove the `()`", . String::new(), . Applicability::MachineApplicable, . ); . } 393,223 ( 0.00%) } . . fn check_poly_trait_ref(&mut self, cx: &LateContext<'tcx>, poly: &'tcx PolyTraitRef<'tcx>) { . if let [segment] = &poly.trait_ref.path.segments . && matches!(segment.ident.name, sym::Fn | sym::FnMut | sym::FnOnce) . && let Some(args) = segment.args . && args.parenthesized == GenericArgsParentheses::ParenSugar . && let [constraint] = &args.constraints . && constraint.ident.name == sym::Output -- line 108 ---------------------------------------- -- line 115 ---------------------------------------- . lint_unneeded_unit_return(cx, hir_ty.span, poly.span); . } . } . } . . impl EarlyLintPass for UnusedUnit { . /// Check for unit expressions in blocks. This is left in the early pass because some macros . /// expand its inputs as-is, making it invisible to the late pass. See #4076. 8 ( 0.00%) fn check_block(&mut self, cx: &EarlyContext<'_>, block: &Block) { . if let Some(stmt) = block.stmts.last() 4 ( 0.00%) && let StmtKind::Expr(expr) = &stmt.kind 3 ( 0.00%) && let rustc_ast::ExprKind::Tup(inner) = &expr.kind . && inner.is_empty() . && let ctxt = block.span.ctxt() . && stmt.span.ctxt() == ctxt . && expr.span.ctxt() == ctxt . && expr.attrs.is_empty() . { . let sp = expr.span; . span_lint_and_sugg( -- line 134 ---------------------------------------- -- line 136 ---------------------------------------- . UNUSED_UNIT, . sp, . "unneeded unit expression", . "remove the final `()`", . String::new(), . Applicability::MachineApplicable, . ); . } 10 ( 0.00%) } . } . . fn is_unit_ty(ty: &Ty<'_>) -> bool { . matches!(ty.kind, TyKind::Tup([])) . } . . // get the def site . #[must_use] -- line 152 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/eta_reduction.rs -------------------------------------------------------------------------------- Ir -- line 67 ---------------------------------------- . . declare_lint_pass!(EtaReduction => [ . REDUNDANT_CLOSURE, . REDUNDANT_CLOSURE_FOR_METHOD_CALLS, . ]); . . impl<'tcx> LateLintPass<'tcx> for EtaReduction { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { 1,572,891 ( 0.01%) if let ExprKind::MethodCall(_method, receiver, args, _) = expr.kind { . for arg in args { . check_closure(cx, Some(receiver), arg); . } . } 3 ( 0.00%) if let ExprKind::Call(func, args) = expr.kind { 3 ( 0.00%) check_closure(cx, None, func); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/eta_reduction.rs:clippy_lints::eta_reduction::check_closure (1x) . for arg in args { 3 ( 0.00%) check_closure(cx, None, arg); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/eta_reduction.rs:clippy_lints::eta_reduction::check_closure (1x) . } . } . } . } . . #[expect(clippy::too_many_lines)] 16 ( 0.00%) fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx>>, expr: &Expr<'tcx>) { 4 ( 0.00%) let body = if let ExprKind::Closure(c) = expr.kind . && c.fn_decl.inputs.iter().all(|ty| matches!(ty.kind, TyKind::Infer(()))) . && matches!(c.fn_decl.output, FnRetTy::DefaultReturn(_)) . && !expr.span.from_expansion() . { . cx.tcx.hir_body(c.body) . } else { . return; . }; -- line 99 ---------------------------------------- -- line 289 ---------------------------------------- . app, . ); . }, . ); . } . }, . _ => (), . } 16 ( 0.00%) } . . fn check_inputs( . typeck: &TypeckResults<'_>, . params: &[Param<'_>], . self_arg: Option<&Expr<'_>>, . args: &[Expr<'_>], . ) -> bool { . params.len() == self_arg.map_or(0, |_| 1) + args.len() -- line 305 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/strlen_on_c_strings.rs -------------------------------------------------------------------------------- Ir -- line 45 ---------------------------------------- . . impl StrlenOnCStrings { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for StrlenOnCStrings { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,452 ( 0.00%) if !expr.span.from_expansion() . && let ExprKind::Call(func, [recv]) = expr.kind . && let ExprKind::Path(path) = &func.kind . && let Some(did) = cx.qpath_res(path, func.hir_id).opt_def_id() . && match_libc_symbol(cx, did, sym::strlen) . && let ExprKind::MethodCall(path, self_arg, [], _) = recv.kind . && !recv.span.from_expansion() . && path.ident.name == sym::as_ptr . && let typeck = cx.typeck_results() -- line 62 ---------------------------------------- -- line 100 ---------------------------------------- . } else { . format!("{val_name}.to_bytes().len()") . }; . . diag.span_suggestion(span, "use", suggestion, app); . }, . ); . } 3,145,784 ( 0.02%) } . } 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/format_impl.rs -------------------------------------------------------------------------------- Ir -- line 103 ---------------------------------------- . pub struct FormatImpl { . format_args: FormatArgsStorage, . // Whether we are inside Display or Debug trait impl - None for neither . format_trait_impl: Option, . } . . impl FormatImpl { . pub fn new(format_args: FormatArgsStorage) -> Self { 2 ( 0.00%) Self { . format_args, . format_trait_impl: None, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for FormatImpl { . fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &ImplItem<'_>) { -- line 119 ---------------------------------------- -- line 122 ---------------------------------------- . . fn check_impl_item_post(&mut self, cx: &LateContext<'_>, impl_item: &ImplItem<'_>) { . // Assume no nested Impl of Debug and Display within each other . if is_format_trait_impl(cx, impl_item).is_some() { . self.format_trait_impl = None; . } . } . 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if let Some(format_trait_impl) = self.format_trait_impl { . let linter = FormatImplExpr { . cx, . format_args: &self.format_args, . expr, . format_trait_impl, . }; . linter.check_to_string_in_display(); . linter.check_self_in_format_args(); . linter.check_print_in_format_impl(); . } 3,145,784 ( 0.02%) } . } . . struct FormatImplExpr<'a, 'tcx> { . cx: &'a LateContext<'tcx>, . format_args: &'a FormatArgsStorage, . expr: &'tcx Expr<'tcx>, . format_trait_impl: FormatTraitNames, . } -- line 150 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs -------------------------------------------------------------------------------- Ir -- line 584 ---------------------------------------- . use crate::num::NonZero; . use crate::ops::{self, ControlFlow, Deref, DerefMut, Residual, Try}; . use crate::panicking::{panic, panic_display}; . use crate::pin::Pin; . use crate::{cmp, convert, hint, mem, slice}; . . /// The `Option` type. See [the module level documentation](self) for more. . #[doc(search_unbox)] 16 ( 0.00%) #[derive(Copy, Debug, Hash)] . #[derive_const(Eq)] . #[rustc_diagnostic_item = "Option"] . #[lang = "Option"] . #[stable(feature = "rust1", since = "1.0.0")] . #[allow(clippy::derived_hash_with_manual_eq)] // PartialEq is manually implemented equivalently . pub enum Option { . /// No value. . #[lang = "None"] -- line 600 ---------------------------------------- -- line 626 ---------------------------------------- . /// let x: Option = None; . /// assert_eq!(x.is_some(), false); . /// ``` . #[must_use = "if you intended to assert that this has a value, consider `.unwrap()` instead"] . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_option_basics", since = "1.48.0")] . pub const fn is_some(&self) -> bool { 2,748,275 ( 0.01%) matches!(*self, Some(_)) . } . . /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate. . /// . /// # Examples . /// . /// ``` . /// let x: Option = Some(2); -- line 642 ---------------------------------------- -- line 652 ---------------------------------------- . /// assert_eq!(x.as_ref().is_some_and(|x| x.len() > 1), true); . /// println!("still alive {:?}", x); . /// ``` . #[must_use] . #[inline] . #[stable(feature = "is_some_and", since = "1.70.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn is_some_and(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool { 786,460 ( 0.00%) match self { . None => false, 14 ( 0.00%) Some(x) => f(x), . } . } . . /// Returns `true` if the option is a [`None`] value. . /// . /// # Examples . /// . /// ``` -- line 670 ---------------------------------------- -- line 675 ---------------------------------------- . /// assert_eq!(x.is_none(), true); . /// ``` . #[must_use = "if you intended to assert that this doesn't have a value, consider \ . wrapping this in an `assert!()` instead"] . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_option_basics", since = "1.48.0")] . pub const fn is_none(&self) -> bool { 1 ( 0.00%) !self.is_some() . } . . /// Returns `true` if the option is a [`None`] or the value inside of it matches a predicate. . /// . /// # Examples . /// . /// ``` . /// let x: Option = Some(2); -- line 691 ---------------------------------------- -- line 701 ---------------------------------------- . /// assert_eq!(x.as_ref().is_none_or(|x| x.len() > 1), true); . /// println!("still alive {:?}", x); . /// ``` . #[must_use] . #[inline] . #[stable(feature = "is_none_or", since = "1.82.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn is_none_or(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool { 1,573,037 ( 0.01%) match self { . None => true, . Some(x) => f(x), . } . } . . ///////////////////////////////////////////////////////////////////////// . // Adapter for working with references . ///////////////////////////////////////////////////////////////////////// -- line 717 ---------------------------------------- -- line 735 ---------------------------------------- . /// // then consume *that* with `map`, leaving `text` on the stack. . /// let text_length: Option = text.as_ref().map(|s| s.len()); . /// println!("still can print text: {text:?}"); . /// ``` . #[inline] . #[rustc_const_stable(feature = "const_option_basics", since = "1.48.0")] . #[stable(feature = "rust1", since = "1.0.0")] . pub const fn as_ref(&self) -> Option<&T> { 1,959,711 ( 0.01%) match *self { . Some(ref x) => Some(x), . None => None, . } . } . . /// Converts from `&mut Option` to `Option<&mut T>`. . /// . /// # Examples -- line 751 ---------------------------------------- -- line 757 ---------------------------------------- . /// None => {}, . /// } . /// assert_eq!(x, Some(42)); . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_option", since = "1.83.0")] . pub const fn as_mut(&mut self) -> Option<&mut T> { 662 ( 0.00%) match *self { . Some(ref mut x) => Some(x), . None => None, . } . } . . /// Converts from [Pin]<[&]Option\> to Option<[Pin]<[&]T>>. . /// . /// [&]: reference "shared reference" -- line 773 ---------------------------------------- -- line 802 ---------------------------------------- . None => None, . } . } . } . . #[inline] . const fn len(&self) -> usize { . // Using the intrinsic avoids emitting a branch to get the 0 or 1. 15 ( 0.00%) let discriminant: isize = crate::intrinsics::discriminant_value(self); . discriminant as usize . } . . /// Returns a slice of the contained value, if any. If this is `None`, an . /// empty slice is returned. This can be useful to have a single type of . /// iterator over an `Option` or slice. . /// . /// Note: Should you have an `Option<&T>` and wish to get a slice of `T`, -- line 818 ---------------------------------------- -- line 959 ---------------------------------------- . /// Styles"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs. . #[inline] . #[track_caller] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "option_expect"] . #[rustc_allow_const_fn_unstable(const_precise_live_drops)] . #[rustc_const_stable(feature = "const_option", since = "1.83.0")] . pub const fn expect(self, msg: &str) -> T { 2,883,656 ( 0.01%) match self { 131,074 ( 0.00%) Some(val) => val, . None => expect_failed(msg), . } . } . . /// Returns the contained [`Some`] value, consuming the `self` value. . /// . /// Because this function may panic, its use is generally discouraged. . /// Panics are meant for unrecoverable errors, and -- line 976 ---------------------------------------- -- line 1004 ---------------------------------------- . /// ``` . #[inline(always)] . #[track_caller] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "option_unwrap"] . #[rustc_allow_const_fn_unstable(const_precise_live_drops)] . #[rustc_const_stable(feature = "const_option", since = "1.83.0")] . pub const fn unwrap(self) -> T { 446 ( 0.00%) match self { 75 ( 0.00%) Some(val) => val, . None => unwrap_failed(), . } . } . . /// Returns the contained [`Some`] value or a provided default. . /// . /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing . /// the result of a function call, it is recommended to use [`unwrap_or_else`], -- line 1021 ---------------------------------------- -- line 1032 ---------------------------------------- . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_allow_const_fn_unstable(const_precise_live_drops)] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn unwrap_or(self, default: T) -> T . where . T: [const] Destruct, . { 24 ( 0.00%) match self { 2 ( 0.00%) Some(x) => x, . None => default, . } . } . . /// Returns the contained [`Some`] value or computes it from a closure. . /// . /// # Examples . /// -- line 1049 ---------------------------------------- -- line 1055 ---------------------------------------- . #[inline] . #[track_caller] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn unwrap_or_else(self, f: F) -> T . where . F: [const] FnOnce() -> T + [const] Destruct, . { 35 ( 0.00%) match self { . Some(x) => x, . None => f(), . } . } . . /// Returns the contained [`Some`] value or a default. . /// . /// Consumes the `self` argument then, if [`Some`], returns the contained -- line 1071 ---------------------------------------- -- line 1087 ---------------------------------------- . /// [`FromStr`]: crate::str::FromStr . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn unwrap_or_default(self) -> T . where . T: [const] Default, . { 29 ( 0.00%) match self { 12 ( 0.00%) Some(x) => x, . None => T::default(), . } . } . . /// Returns the contained [`Some`] value, consuming the `self` value, . /// without checking that the value is not [`None`]. . /// . /// # Safety -- line 1104 ---------------------------------------- -- line 1154 ---------------------------------------- . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn map(self, f: F) -> Option . where . F: [const] FnOnce(T) -> U + [const] Destruct, . { 1,691,104 ( 0.01%) match self { 413,432 ( 0.00%) Some(x) => Some(f(x)), . None => None, . } 1 ( 0.00%) } . . /// Calls a function with a reference to the contained value if [`Some`]. . /// . /// Returns the original option. . /// . /// # Examples . /// . /// ``` -- line 1174 ---------------------------------------- -- line 1219 ---------------------------------------- . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use = "if you don't need the returned value, use `if let` instead"] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn map_or(self, default: U, f: F) -> U . where . F: [const] FnOnce(T) -> U + [const] Destruct, . U: [const] Destruct, . { 15,072,620 ( 0.07%) match self { . Some(t) => f(t), . None => default, . } 1,306,428 ( 0.01%) } . . /// Computes a default function result (if none), or . /// applies a different function to the contained value (if any). . /// . /// # Basic examples . /// . /// ``` . /// let k = 21; -- line 1239 ---------------------------------------- -- line 1266 ---------------------------------------- . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn map_or_else(self, default: D, f: F) -> U . where . D: [const] FnOnce() -> U + [const] Destruct, . F: [const] FnOnce(T) -> U + [const] Destruct, . { 6 ( 0.00%) match self { . Some(t) => f(t), . None => default(), . } . } . . /// Maps an `Option` to a `U` by applying function `f` to the contained . /// value if the option is [`Some`], otherwise if [`None`], returns the . /// [default value] for the type `U`. -- line 1282 ---------------------------------------- -- line 1533 ---------------------------------------- . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_confusables("flat_map", "flatmap")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn and_then(self, f: F) -> Option . where . F: [const] FnOnce(T) -> Option + [const] Destruct, . { 653,222 ( 0.00%) match self { 3,266,088 ( 0.02%) Some(x) => f(x), . None => None, . } . } . . /// Returns [`None`] if the option is [`None`], otherwise calls `predicate` . /// with the wrapped value and returns: . /// . /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped -- line 1550 ---------------------------------------- -- line 1571 ---------------------------------------- . #[inline] . #[stable(feature = "option_filter", since = "1.27.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn filter

(self, predicate: P) -> Self . where . P: [const] FnOnce(&T) -> bool + [const] Destruct, . T: [const] Destruct, . { 1,179,674 ( 0.01%) if let Some(x) = self { 10 ( 0.00%) if predicate(&x) { . return Some(x); . } . } 393,223 ( 0.00%) None . } . . /// Returns the option if it contains a value, otherwise returns `optb`. . /// . /// Arguments passed to `or` are eagerly evaluated; if you are passing the . /// result of a function call, it is recommended to use [`or_else`], which is . /// lazily evaluated. . /// -- line 1592 ---------------------------------------- -- line 1642 ---------------------------------------- . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn or_else(self, f: F) -> Option . where . F: [const] FnOnce() -> Option + [const] Destruct, . //FIXME(const_hack): this `T: [const] Destruct` is unnecessary, but even precise live drops can't tell . // no value of type `T` gets dropped here . T: [const] Destruct, . { 5 ( 0.00%) match self { . x @ Some(_) => x, . None => f(), . } . } . . /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`]. . /// . /// # Examples -- line 1658 ---------------------------------------- -- line 1714 ---------------------------------------- . #[must_use = "if you intended to set a value, consider assignment instead"] . #[inline] . #[stable(feature = "option_insert", since = "1.53.0")] . #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] . pub const fn insert(&mut self, value: T) -> &mut T . where . T: [const] Destruct, . { 16 ( 0.00%) *self = Some(value); . . // SAFETY: the code above just filled the option . unsafe { self.as_mut().unwrap_unchecked() } . } . . /// Inserts `value` into the option if it is [`None`], then . /// returns a mutable reference to the contained value. . /// -- line 1730 ---------------------------------------- -- line 2130 ---------------------------------------- . #[rustc_const_stable(feature = "const_option", since = "1.83.0")] . pub const fn copied(self) -> Option . where . T: Copy, . { . // FIXME(const-hack): this implementation, which sidesteps using `Option::map` since it's not const . // ready yet, should be reverted when possible to avoid code repetition . match self { 69 ( 0.00%) Some(&v) => Some(v), . None => None, . } . } . . /// Maps an `Option<&T>` to an `Option` by cloning the contents of the . /// option. . /// . /// # Examples -- line 2146 ---------------------------------------- -- line 2266 ---------------------------------------- . const impl Clone for Option . where . // FIXME(const_hack): the T: [const] Destruct should be inferred from the Self: [const] Destruct in clone_from. . // See https://github.com/rust-lang/rust/issues/144207 . T: [const] Clone + [const] Destruct, . { . #[inline] . fn clone(&self) -> Self { 266 ( 0.00%) match self { . Some(x) => Some(x.clone()), . None => None, . } . } . . #[inline] . fn clone_from(&mut self, source: &Self) { . match (self, source) { -- line 2282 ---------------------------------------- -- line 2431 ---------------------------------------- . impl crate::marker::StructuralPartialEq for Option {} . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . const impl PartialEq for Option { . #[inline] . fn eq(&self, other: &Self) -> bool { . // Spelling out the cases explicitly optimizes better than . // `_ => false` 6,291,718 ( 0.03%) match (self, other) { . (Some(l), Some(r)) => *l == *r, . (Some(_), None) => false, . (None, Some(_)) => false, . (None, None) => true, . } . } . } . -- line 2447 ---------------------------------------- -- line 2861 ---------------------------------------- . . #[inline] . fn from_output(output: Self::Output) -> Self { . Some(output) . } . . #[inline] . fn branch(self) -> ControlFlow { 1,572,986 ( 0.01%) match self { 4 ( 0.00%) Some(v) => ControlFlow::Continue(v), . None => ControlFlow::Break(None), . } . } . } . . #[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")] . #[rustc_const_unstable(feature = "const_try", issue = "74935")] . // Note: manually specifying the residual type instead of using the default to work around . // https://github.com/rust-lang/rust/issues/99940 . const impl ops::FromResidual> for Option { . #[inline] . fn from_residual(residual: Option) -> Self { . match residual { 10 ( 0.00%) None => None, . } . } . } . . #[diagnostic::do_not_recommend] . #[unstable(feature = "try_trait_v2_yeet", issue = "96374")] . #[rustc_const_unstable(feature = "const_try", issue = "74935")] . const impl ops::FromResidual> for Option { -- line 2892 ---------------------------------------- 3,665,305 ( 0.02%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unused_rounding.rs -------------------------------------------------------------------------------- Ir -- line 29 ---------------------------------------- . pub UNUSED_ROUNDING, . nursery, . "Uselessly rounding a whole number floating-point literal" . } . . declare_lint_pass!(UnusedRounding => [UNUSED_ROUNDING]); . . fn is_useless_rounding(cx: &EarlyContext<'_>, expr: &Expr) -> Option<(Symbol, String)> { 786,442 ( 0.00%) if let ExprKind::MethodCall(MethodCall { . seg: name_ident, . receiver, . .. . }) = &expr.kind 1 ( 0.00%) && let method_name = name_ident.ident.name 6 ( 0.00%) && matches!(method_name, sym::ceil | sym::floor | sym::round) . && let ExprKind::Lit(token_lit) = &receiver.kind . && token_lit.is_semantic_float() . && let Ok(f) = token_lit.symbol.as_str().replace('_', "").parse::() . && f.fract() == 0.0 . { . Some((method_name, snippet(cx, receiver.span, "..").into())) . } else { . None . } . } . . impl EarlyLintPass for UnusedRounding { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 1 ( 0.00%) if let Some((method_name, float)) = is_useless_rounding(cx, expr) { . span_lint_and_sugg( . cx, . UNUSED_ROUNDING, . expr.span, . format!("used the `{method_name}` method with a whole number float"), . format!("remove the `{method_name}` method call"), . float, . Applicability::MachineApplicable, . ); . } 3,145,768 ( 0.02%) } . } 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/entry.rs -------------------------------------------------------------------------------- Ir -- line 58 ---------------------------------------- . perf, . "use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`" . } . . declare_lint_pass!(HashMapPass => [MAP_ENTRY]); . . impl<'tcx> LateLintPass<'tcx> for HashMapPass { . #[expect(clippy::too_many_lines)] 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . . let Some(higher::If { . cond: cond_expr, . then: then_expr, . r#else: else_expr, . }) = higher::If::hir(expr) -- line 75 ---------------------------------------- -- line 205 ---------------------------------------- . lint_msg, . None, . format!( . "consider using the `Entry` API: https://doc.rust-lang.org/std/collections/struct.{}.html#entry-api", . map_ty.name() . ), . ); . } 3,145,784 ( 0.02%) } . } . . #[derive(Clone, Copy)] . enum MapType { . Hash, . BTree, . } . impl MapType { -- line 221 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/cloned_ref_to_slice_refs.rs -------------------------------------------------------------------------------- Ir -- line 58 ---------------------------------------- . } . impl ClonedRefToSliceRefs { . pub fn new(conf: &Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for ClonedRefToSliceRefs { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'tcx>) { . // `&[foo.clone()]` expressions 786,446 ( 0.00%) if let ExprKind::AddrOf(_, mutability, arr) = &expr.kind . // mutable references would have a different meaning . && mutability.is_not() . . // check for single item arrays . && let ExprKind::Array([item]) = &arr.kind . . // check for clones . && let ExprKind::MethodCall(path, recv, _, _) = item.kind -- line 76 ---------------------------------------- -- line 101 ---------------------------------------- . "unnecessary use of `{}` to create a slice from a reference", . path.ident.name . ), . "try", . format!("{builtin_crate}::slice::from_ref({adjustment}{sugg})"), . applicability, . ); . } 3,145,784 ( 0.02%) } . } . . /// Checks if a method call is a needless clone or equivalent. If so, returns the necessary . /// adjustments to use the method receiver directly without cloning. . /// For example, in the code below: . /// ```rust,no_run . /// use std::path::PathBuf; . /// -- line 117 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/matches/mod.rs -------------------------------------------------------------------------------- Ir -- line 1048 ---------------------------------------- . msrv: conf.msrv.into(), . infallible_destructuring_match_linted: false, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for Matches { . #[expect(clippy::too_many_lines)] 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . let from_expansion = expr.span.from_expansion(); . 1,179,669 ( 0.01%) if let ExprKind::Match(ex, arms, source) = expr.kind { . if is_direct_expn_of(expr.span, sym::matches).is_some() . && let [arm, _] = arms . { . redundant_pattern_match::check_match(cx, expr, ex, arms); . redundant_pattern_match::check_matches_true(cx, expr, arm, ex); . } . if expr.span.in_external_macro(cx.tcx.sess.source_map()) { . return; -- line 1067 ---------------------------------------- -- line 1141 ---------------------------------------- . if self.infallible_destructuring_match_linted { . self.infallible_destructuring_match_linted = false; . } else { . match_single_binding::check(cx, ex, arms, expr); . } . } . match_ref_pats::check(cx, ex, arms.iter().map(|el| el.pat), expr); . } 2,359,338 ( 0.01%) } else if let Some(if_let) = higher::IfLet::hir(cx, expr) { 1,966,118 ( 0.01%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . if expr.span.in_external_macro(cx.tcx.sess.source_map()) { . return; . } . collapsible_match::check_if_let( . cx, . if_let.let_span.ctxt(), . if_let.let_pat, . if_let.if_then, -- line 1157 ---------------------------------------- -- line 1206 ---------------------------------------- . if_let.let_pat, . if_let.let_expr, . if_let.if_else.is_some(), . if_let.let_span, . ); . needless_match::check_if_let(cx, expr, &if_let); . } . } else { 1,966,115 ( 0.01%) if expr.span.in_external_macro(cx.tcx.sess.source_map()) { . return; . } . if let Some(while_let) = higher::WhileLet::hir(expr) { . significant_drop_in_scrutinee::check_while_let(cx, expr, while_let.let_expr, while_let.if_then); . } . if !from_expansion { . redundant_pattern_match::check(cx, expr); . } . } 3,145,784 ( 0.02%) } . . fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'_>) { . self.infallible_destructuring_match_linted |= . local.els.is_none() && infallible_destructuring_match::check(cx, local); . } . . fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) { . rest_pat_in_fully_bound_struct::check(cx, pat); -- line 1232 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/collapsible_if.rs -------------------------------------------------------------------------------- Ir -- line 256 ---------------------------------------- . . // There are other attributes, which are significant tokens -- check failed . _ => false, . } . } . } . . impl LateLintPass<'_> for CollapsibleIf { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::If(cond, then, else_) = &expr.kind 2 ( 0.00%) && !expr.span.from_expansion() . { . if let Some(else_) = else_ . // Short circuit if both `if` branches contain only a single `if {..} else {}`, as . // collapsing such blocks can lead to less readable code (#4971) . && !(single_inner_if_else(then) && single_inner_if_else(else_)) . && let ExprKind::Block(else_, None) = else_.kind . { . self.check_collapsible_else_if(cx, then.span, else_); . } else if else_.is_none() . && self.eligible_condition(cx, cond) . && let ExprKind::Block(then, None) = then.kind . { . self.check_collapsible_if_if(cx, expr, cond, then); . } . } 3,145,784 ( 0.02%) } . } . . /// Returns true if `expr` is a block that contains only one `if {..} else {}` statement . fn single_inner_if_else(expr: &Expr<'_>) -> bool { . if let ExprKind::Block(block, None) = expr.kind . && let Some(inner_expr) = expr_block(block) . && let ExprKind::If(_, _, else_) = inner_expr.kind . && else_.is_some() -- line 290 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/init_numbered_fields.rs -------------------------------------------------------------------------------- Ir -- line 37 ---------------------------------------- . pub INIT_NUMBERED_FIELDS, . style, . "numbered fields in tuple struct initializer" . } . . declare_lint_pass!(NumberedFields => [INIT_NUMBERED_FIELDS]); . . impl<'tcx> LateLintPass<'tcx> for NumberedFields { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Struct(path, fields @ [field, ..], StructTailExpr::None) = e.kind . // If the first character of any field is a digit it has to be a tuple. . && field.ident.as_str().as_bytes().first().is_some_and(u8::is_ascii_digit) . // Type aliases can't be used as functions. . && !matches!( . cx.qpath_res(path, e.hir_id), . Res::Def(DefKind::TyAlias | DefKind::AssocTy, _) . ) . // This is the only syntax macros can use that works for all struct types. -- line 54 ---------------------------------------- -- line 89 ---------------------------------------- . .intersperse(Cow::Borrowed(", ")) . .collect::() . ), . app, . ); . }, . ); . } 2,752,561 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/int_plus_one.rs -------------------------------------------------------------------------------- Ir -- line 48 ---------------------------------------- . enum LeOrGe { . Le, . Ge, . } . . impl TryFrom for LeOrGe { . type Error = (); . fn try_from(value: BinOpKind) -> Result { 3 ( 0.00%) match value { . BinOpKind::Le => Ok(Self::Le), . BinOpKind::Ge => Ok(Self::Ge), . _ => Err(()), . } . } . } . . impl IntPlusOne { -- line 64 ---------------------------------------- -- line 151 ---------------------------------------- . let rec = sugg::make_binop(new_binop, &new_lhs, &new_rhs); . diag.span_suggestion(expr.span, "change it to", rec, app); . }, . ); . } . } . . impl EarlyLintPass for IntPlusOne { 2,359,326 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if let ExprKind::Binary(binop, lhs, rhs) = &expr.kind 2 ( 0.00%) && let Ok(le_or_ge) = LeOrGe::try_from(binop.node) . && let Some((new_lhs, new_rhs)) = Self::check_binop(le_or_ge, lhs, rhs) . { . Self::emit_warning(cx, expr, new_lhs, le_or_ge, new_rhs); . } 2,752,547 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/methods/mod.rs -------------------------------------------------------------------------------- Ir -- line 5094 ---------------------------------------- . allowed_dotfiles: FxHashSet<&'static str>, . format_args: FormatArgsStorage, . allow_unwrap_types: Vec, . unwrap_allowed_ids: FxHashSet, . unwrap_allowed_aliases: Vec, . } . . impl Methods { 10 ( 0.00%) pub fn new(conf: &'static Conf, format_args: FormatArgsStorage) -> Self { . let mut allowed_dotfiles: FxHashSet<_> = conf.allowed_dotfiles.iter().map(|s| &**s).collect(); . allowed_dotfiles.extend(DEFAULT_ALLOWED_DOTFILES); . 21 ( 0.00%) Self { 1 ( 0.00%) avoid_breaking_exported_api: conf.avoid_breaking_exported_api, 1 ( 0.00%) msrv: conf.msrv.into(), . allow_expect_in_tests: conf.allow_expect_in_tests, . allow_unwrap_in_tests: conf.allow_unwrap_in_tests, 1 ( 0.00%) allow_expect_in_consts: conf.allow_expect_in_consts, 1 ( 0.00%) allow_unwrap_in_consts: conf.allow_unwrap_in_consts, 6 ( 0.00%) allowed_dotfiles, 1 ( 0.00%) format_args, 3 ( 0.00%) allow_unwrap_types: conf.allow_unwrap_types.clone(), 33 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs: as core::clone::Clone>::clone (1x) . unwrap_allowed_ids: FxHashSet::default(), . unwrap_allowed_aliases: Vec::new(), . } 9 ( 0.00%) } . } . . /// Extracts a method call name, args, and `Span` of the method name. . /// This ensures that neither the receiver nor any of the arguments . /// come from expansion. 8 ( 0.00%) pub fn method_call<'tcx>(recv: &'tcx Expr<'tcx>) -> Option<(Symbol, &'tcx Expr<'tcx>, &'tcx [Expr<'tcx>], Span, Span)> { 9 ( 0.00%) if let ExprKind::MethodCall(path, receiver, args, call_span) = recv.kind . && !args.iter().any(|e| e.range_span().unwrap_or(e.span).from_expansion()) 4 ( 0.00%) && !receiver.range_span().unwrap_or(receiver.span).from_expansion() 22 ( 0.00%) => ???:::range_span (1x) . { 2 ( 0.00%) Some((path.ident.name, receiver, args, path.ident.span, call_span)) . } else { 1 ( 0.00%) None . } 8 ( 0.00%) } . . impl<'tcx> LateLintPass<'tcx> for Methods { 8 ( 0.00%) fn check_crate(&mut self, cx: &LateContext<'tcx>) { . for s in &self.allow_unwrap_types { . let def_ids = clippy_utils::paths::lookup_path_str(cx.tcx, clippy_utils::paths::PathNS::Type, s); . for def_id in def_ids { . if cx.tcx.def_kind(def_id) == rustc_hir::def::DefKind::TyAlias { . self.unwrap_allowed_aliases.push(def_id); . } else { . self.unwrap_allowed_ids.insert(def_id); . } . } . } 8 ( 0.00%) } . 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . 2,752,524 ( 0.01%) match expr.kind { . ExprKind::Call(func, args) => { . unnecessary_fallible_conversions::check_function(cx, expr, func); . manual_c_str_literals::check(cx, expr, func, args, self.msrv); . useless_nonzero_new_unchecked::check(cx, expr, func, args, self.msrv); . io_other_error::check(cx, expr, func, args, self.msrv); . swap_with_temporary::check(cx, expr, func, args); . ip_constant::check(cx, expr, func, args); . clone_on_copy::check_function(cx, expr); -- line 5163 ---------------------------------------- -- line 5170 ---------------------------------------- . self.allow_expect_in_tests, . self.allow_unwrap_in_consts, . self.allow_expect_in_consts, . &self.unwrap_allowed_ids, . &self.unwrap_allowed_aliases, . ); . }, . ExprKind::MethodCall(..) => { 9 ( 0.00%) self.check_methods(cx, expr); 422 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/methods/mod.rs:::check_methods (1x) . }, 5 ( 0.00%) ExprKind::Binary(op, lhs, rhs) if op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne => { 4 ( 0.00%) let mut info = BinaryExprInfo { . expr, . chain: lhs, . other: rhs, . eq: op.node == hir::BinOpKind::Eq, . }; . lint_binary_expr_with_method_call(cx, &mut info); . }, . ExprKind::Binary(op, lhs, rhs) if op.node == hir::BinOpKind::Or => { . manual_is_variant_and::check_or(cx, expr, lhs, rhs, self.msrv); . }, . _ => (), . } 3,145,776 ( 0.02%) } . . fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) { . if impl_item.span.in_external_macro(cx.sess().source_map()) { . return; . } . . if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind { . let parent = cx.tcx.hir_get_parent_item(impl_item.hir_id()).def_id; -- line 5202 ---------------------------------------- -- line 5259 ---------------------------------------- . . new_ret_no_self::check_trait_item(cx, item); . } . } . } . . impl Methods { . #[expect(clippy::too_many_lines)] 7 ( 0.00%) fn check_methods<'tcx>(&self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // Handle method calls whose receiver and arguments may not come from expansion . if let Some((name, recv, args, span, call_span)) = method_call(expr) { . match (name, args) { 2 ( 0.00%) (sym::add | sym::sub | sym::wrapping_add | sym::wrapping_sub, [_arg]) => { . zst_offset::check(cx, expr, recv); . }, . (sym::all, [arg]) => { . needless_character_iteration::check(cx, expr, recv, arg, true); . match method_call(recv) { . Some((sym::cloned, recv2, [], _, _)) => { . iter_overeager_cloned::check( . cx, -- line 5279 ---------------------------------------- -- line 5331 ---------------------------------------- . manual_contains::check(cx, expr, iter_recv, arg); . }, . _ => {}, . } . }, . (sym::arg, [arg]) => { . suspicious_command_arg_space::check(cx, recv, arg, span); . }, 12 ( 0.00%) (sym::as_deref | sym::as_deref_mut, []) => { . needless_option_as_deref::check(cx, expr, recv, name); . }, . (sym::as_bytes, []) => { . if let Some((sym::as_str, recv, [], as_str_span, _)) = method_call(recv) { . redundant_as_str::check(cx, expr, recv, as_str_span, span); . } . sliced_string_as_bytes::check(cx, expr, recv); . }, -- line 5347 ---------------------------------------- -- line 5581 ---------------------------------------- . recv2, . iter_overeager_cloned::Op::LaterCloned, . false, . ); . } . double_ended_iterator_last::check(cx, expr, recv, call_span); . }, . (sym::len, []) => { 4 ( 0.00%) if let Some((prev_method @ (sym::as_bytes | sym::bytes), prev_recv, [], _, _)) = method_call(recv) { 20 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/methods/mod.rs:clippy_lints::methods::method_call (1x) . needless_as_bytes::check(cx, prev_method, sym::len, prev_recv, expr.span); . } . }, . (sym::lock, []) => { . mut_mutex_lock::check(cx, expr, recv, span); . }, . (name @ (sym::map | sym::map_err), [m_arg]) => { . if name == sym::map { -- line 5597 ---------------------------------------- -- line 5911 ---------------------------------------- . range_zip_with_len::check(cx, expr, iter_recv, arg); . } . }, . _ => {}, . } . } . // Handle method calls whose receiver and arguments may come from expansion . if let ExprKind::MethodCall(path, recv, args, call_span) = expr.kind { 1 ( 0.00%) let method_span = path.ident.span; . . // Those methods do their own method name checking as they deal with multiple methods. 15 ( 0.00%) or_fun_call::check(cx, expr, method_span, path.ident.name, recv, args, self.msrv); 13 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/methods/or_fun_call.rs:clippy_lints::methods::or_fun_call::check (1x) 9 ( 0.00%) unnecessary_to_owned::check(cx, expr, path.ident.name, recv, args, self.msrv); 247 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/methods/unnecessary_to_owned.rs:clippy_lints::methods::unnecessary_to_owned::check (1x) . 1 ( 0.00%) match (path.ident.name, args) { 10 ( 0.00%) (sym::clone, []) => { . clone_on_ref_ptr::check(cx, expr, recv); . clone_on_copy::check(cx, expr, recv); . }, . (sym::expect, [arg]) => { . unwrap_expect_used::check( . cx, . expr, . recv, -- line 5934 ---------------------------------------- -- line 5994 ---------------------------------------- . &self.unwrap_allowed_ids, . &self.unwrap_allowed_aliases, . unwrap_expect_used::Variant::Unwrap, . ); . }, . _ => {}, . } . } 8 ( 0.00%) } . } . . fn check_is_some_is_none<'tcx>( . cx: &LateContext<'tcx>, . expr: &'tcx Expr<'tcx>, . recv: &'tcx Expr<'tcx>, . call_span: Span, . is_some: bool, -- line 6010 ---------------------------------------- -- line 6035 ---------------------------------------- . other: &'a Expr<'a>, . eq: bool, . } . . /// Checks for the `CHARS_NEXT_CMP` and `CHARS_LAST_CMP` lints. . fn lint_binary_expr_with_method_call(cx: &LateContext<'_>, info: &mut BinaryExprInfo<'_>) { . macro_rules! lint_with_both_lhs_and_rhs { . ($func:expr, $cx:expr, $info:ident) => { 8 ( 0.00%) if !$func($cx, $info) { . ::std::mem::swap(&mut $info.chain, &mut $info.other); 9 ( 0.00%) if $func($cx, $info) { 373 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/methods/chars_last_cmp_with_unwrap.rs:clippy_lints::methods::chars_last_cmp_with_unwrap::check (1x) . return; . } . } . }; . } . . lint_with_both_lhs_and_rhs!(chars_next_cmp::check, cx, info); . lint_with_both_lhs_and_rhs!(chars_last_cmp::check, cx, info); -- line 6053 ---------------------------------------- 26 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/loops/while_let_on_iterator.rs -------------------------------------------------------------------------------- Ir -- line 11 ---------------------------------------- . use rustc_hir::intravisit::{Visitor, walk_expr}; . use rustc_hir::{Closure, Expr, ExprKind, HirId, LetStmt, Mutability, UnOp}; . use rustc_lint::LateContext; . use rustc_middle::hir::nested_filter::OnlyBodies; . use rustc_middle::ty::adjustment::{Adjust, DerefAdjustKind}; . use rustc_span::Symbol; . use rustc_span::symbol::sym; . 2,752,526 ( 0.01%) pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . if let Some(higher::WhileLet { if_then, let_pat, let_expr, label, .. }) = higher::WhileLet::hir(expr) . // check for `Some(..)` pattern . && let Some(some_pat) = as_some_pattern(cx, let_pat) . // check for call to `Iterator::next` . && let ExprKind::MethodCall(method_name, iter_expr, [], _) = let_expr.kind . && method_name.ident.name == sym::next . && cx.ty_based_def(let_expr).opt_parent(cx).is_diag_item(cx, sym::Iterator) . && let Some(iter_expr_struct) = try_parse_iter_expr(cx, iter_expr) -- line 27 ---------------------------------------- -- line 61 ---------------------------------------- . WHILE_LET_ON_ITERATOR, . expr.span.with_hi(let_expr.span.hi()), . "this loop could be written as a `for` loop", . "try", . format!("{loop_label}for {loop_var} in {iterator_by_ref}"), . applicability, . ); . } 3,145,744 ( 0.02%) } . . #[derive(Debug)] . struct IterExpr { . /// The fields used, in order of child to parent. . fields: Vec, . /// The path being used. . path: Res, . /// Whether or not the iterator can be moved. -- line 77 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/precedence.rs -------------------------------------------------------------------------------- Ir -- line 42 ---------------------------------------- . pub PRECEDENCE_BITS, . restriction, . "operations mixing bit shifting with bit combining/masking" . } . . declare_lint_pass!(Precedence => [PRECEDENCE, PRECEDENCE_BITS]); . . impl EarlyLintPass for Precedence { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { 786,442 ( 0.00%) if expr.span.from_expansion() { . return; . } . 1,966,084 ( 0.01%) if let ExprKind::Binary(Spanned { node: op, .. }, ref left, ref right) = expr.kind { . let span_sugg = |lint: &'static Lint, expr: &Expr, sugg, appl| { . span_lint_and_sugg( . cx, . lint, . expr.span, . "operator precedence might not be obvious", . "consider parenthesizing your expression", . sugg, -- line 63 ---------------------------------------- -- line 106 ---------------------------------------- . op.as_str(), . snippet_with_applicability(cx, right.span, "..", &mut applicability) . ); . span_sugg(lint_for(&[op, side_op]), expr, sugg, applicability); . }, . _ => (), . } . } else if let ExprKind::MethodCall(method_call) = &expr.kind 4 ( 0.00%) && let ExprKind::Closure(closure) = &method_call.receiver.kind . { . span_lint_and_then(cx, PRECEDENCE, expr.span, "precedence might not be obvious", |diag| { . diag.multipart_suggestion( . "consider parenthesizing the closure", . vec![ . (closure.fn_decl_span.shrink_to_lo(), String::from("(")), . (closure.body.span.shrink_to_hi(), String::from(")")), . ], . Applicability::MachineApplicable, . ); . }); . } 3,145,768 ( 0.02%) } . } . . fn get_bin_opt(expr: &Expr) -> Option { . match expr.kind { . ExprKind::Binary(Spanned { node: op, .. }, _, _) => Some(op), . _ => None, . } . } . . #[must_use] . fn is_bit_op(op: BinOpKind) -> bool { 3 ( 0.00%) matches!(op, BitXor | BitAnd | BitOr | Shl | Shr) . } . . fn lint_for(ops: &[BinOpKind]) -> &'static Lint { . if ops.iter().all(|op| is_bit_op(*op)) { . PRECEDENCE_BITS . } else { . PRECEDENCE . } -- line 147 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/redundant_closure_call.rs -------------------------------------------------------------------------------- Ir -- line 158 ---------------------------------------- . { . expr = parent; . depth += 1; . } . (expr, depth) . } . . impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { 2,359,328 ( 0.01%) if expr.span.in_external_macro(cx.sess().source_map()) { . return; . } . . if let ExprKind::Call(recv, _) = expr.kind . // don't lint if the receiver is a call, too. . // we do this in order to prevent linting multiple times; consider: . // `(|| || 1)()()` . // ^^ we only want to lint for this call (but we walk up the calls to consider both calls). -- line 175 ---------------------------------------- -- line 229 ---------------------------------------- . .maybe_paren(); . } . . diag.span_suggestion(full_expr.span, "try doing something like", hint, applicability); . } . }, . ); . } 3,145,784 ( 0.02%) } . 14 ( 0.00%) fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx hir::Block<'_>) { . fn count_closure_usage<'tcx>( . cx: &LateContext<'tcx>, . block: &'tcx hir::Block<'_>, . path: &'tcx hir::Path<'tcx>, . ) -> usize { . struct ClosureUsageCount<'a, 'tcx> { . cx: &'a LateContext<'tcx>, . path: &'tcx hir::Path<'tcx>, -- line 247 ---------------------------------------- -- line 265 ---------------------------------------- . self.cx.tcx . } . } . let mut closure_usage_count = ClosureUsageCount { cx, path, count: 0 }; . closure_usage_count.visit_block(block); . closure_usage_count.count . } . 2 ( 0.00%) for w in block.stmts.windows(2) { . if let hir::StmtKind::Let(local) = w[0].kind . && let Some(t) = local.init . && let ExprKind::Closure { .. } = t.kind . && let hir::PatKind::Binding(_, _, ident, _) = local.pat.kind . && let hir::StmtKind::Semi(second) = w[1].kind . && let ExprKind::Assign(_, call, _) = second.kind . && let ExprKind::Call(closure, _) = call.kind . && let ExprKind::Path(hir::QPath::Resolved(_, path)) = closure.kind -- line 281 ---------------------------------------- -- line 286 ---------------------------------------- . cx, . REDUNDANT_CLOSURE_CALL, . second.hir_id, . second.span, . "closure called just once immediately after it was declared", . ); . } . } 16 ( 0.00%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/flatten.rs -------------------------------------------------------------------------------- Ir -- line 15 ---------------------------------------- . #[must_use = "iterators are lazy and do nothing unless consumed"] . #[stable(feature = "rust1", since = "1.0.0")] . pub struct FlatMap { . inner: FlattenCompat, ::IntoIter>, . } . . impl U> FlatMap { . pub(in crate::iter) fn new(iter: I, f: F) -> FlatMap { 3,145,792 ( 0.02%) FlatMap { inner: FlattenCompat::new(iter.map(f)) } . } . . pub(crate) fn into_parts(self) -> (Option, Option, Option) { . ( . self.inner.frontiter, . self.inner.iter.into_inner().map(Map::into_inner), . self.inner.backiter, . ) -- line 31 ---------------------------------------- -- line 242 ---------------------------------------- . self.inner.try_fold(init, fold) . } . . #[inline] . fn fold(self, init: Acc, fold: Fold) -> Acc . where . Fold: FnMut(Acc, Self::Item) -> Acc, . { 13 ( 0.00%) self.inner.fold(init, fold) . } . . #[inline] . fn advance_by(&mut self, n: usize) -> Result<(), NonZero> { . self.inner.advance_by(n) . } . . #[inline] -- line 258 ---------------------------------------- -- line 383 ---------------------------------------- . fn iter_fold(self, mut acc: Acc, mut fold: Fold) -> Acc . where . Fold: FnMut(Acc, U) -> Acc, . { . #[inline] . fn flatten( . fold: &mut impl FnMut(Acc, T::IntoIter) -> Acc, . ) -> impl FnMut(Acc, T) -> Acc + '_ { 6 ( 0.00%) move |acc, iter| fold(acc, iter.into_iter()) . } . 23 ( 0.00%) if let Some(iter) = self.frontiter { . acc = fold(acc, iter); . } . 15 ( 0.00%) acc = self.iter.fold(acc, flatten(&mut fold)); . 21 ( 0.00%) if let Some(iter) = self.backiter { . acc = fold(acc, iter); . } . . acc . } . . /// Folds over the inner iterators as long as the given function returns successfully, . /// always storing the most recent inner iterator in `self.frontiter`. -- line 408 ---------------------------------------- -- line 415 ---------------------------------------- . Fold: FnMut(Acc, &mut U) -> R, . R: Try, . { . #[inline] . fn flatten<'a, T: IntoIterator, Acc, R: Try>( . frontiter: &'a mut Option, . fold: &'a mut impl FnMut(Acc, &mut T::IntoIter) -> R, . ) -> impl FnMut(Acc, T) -> R + 'a { 1 ( 0.00%) move |acc, iter| fold(acc, frontiter.insert(iter.into_iter())) 340 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/take_while.rs: as core::iter::traits::iterator::Iterator>::try_fold::flatten::, clippy_utils::macros::macro_backtrace::{closure#0}>, clippy_utils::macros::first_node_macro_backtrace::{closure#0}::{closure#0}>, (), core::ops::control_flow::ControlFlow, core::iter::traits::iterator::Iterator::find::check::{closure#0}>::{closure#0} (1x) . } . . if let Some(iter) = &mut self.frontiter { . acc = fold(acc, iter)?; . } 1,179,669 ( 0.01%) self.frontiter = None; . . acc = self.iter.try_fold(acc, flatten(&mut self.frontiter, &mut fold))?; 393,224 ( 0.00%) self.frontiter = None; . 786,448 ( 0.00%) if let Some(iter) = &mut self.backiter { . acc = fold(acc, iter)?; . } . self.backiter = None; . . try { acc } . } . } . -- line 442 ---------------------------------------- -- line 518 ---------------------------------------- . type Item = U::Item; . . #[inline] . default fn next(&mut self) -> Option { . loop { . if let elt @ Some(_) = and_then_or_clear(&mut self.frontiter, Iterator::next) { . return elt; . } 12 ( 0.00%) match self.iter.next() { . None => return and_then_or_clear(&mut self.backiter, Iterator::next), . Some(inner) => self.frontiter = Some(inner.into_iter()), . } . } . } . . #[inline] . default fn size_hint(&self) -> (usize, Option) { -- line 534 ---------------------------------------- -- line 558 ---------------------------------------- . Self: Sized, . Fold: FnMut(Acc, Self::Item) -> R, . R: Try, . { . #[inline] . fn flatten>( . mut fold: impl FnMut(Acc, U::Item) -> R, . ) -> impl FnMut(Acc, &mut U) -> R { 1 ( 0.00%) move |acc, iter| iter.try_fold(acc, &mut fold) . } . . self.iter_try_fold(init, flatten(fold)) . } . . #[inline] . default fn fold(self, init: Acc, fold: Fold) -> Acc . where -- line 574 ---------------------------------------- 786,480 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/explicit_write.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . . impl ExplicitWrite { . pub fn new(format_args: FormatArgsStorage) -> Self { . Self { format_args } . } . } . . impl<'tcx> LateLintPass<'tcx> for ExplicitWrite { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // match call to unwrap 786,449 ( 0.00%) if let ExprKind::MethodCall(unwrap_fun, write_call, [], _) = expr.kind 1 ( 0.00%) && unwrap_fun.ident.name == sym::unwrap . // match call to write_fmt . && let ExprKind::MethodCall(write_fun, write_recv, [write_arg], _) = *look_in_block(cx, &write_call.kind) . && let ExprKind::Call(write_recv_path, []) = write_recv.kind . && write_fun.ident.name == sym::write_fmt . && let Some(def_id) = write_recv_path.basic_res().opt_def_id() . { . // match calls to std::io::stdout() / std::io::stderr () . let (dest_name, prefix) = match cx.tcx.get_diagnostic_name(def_id) { -- line 66 ---------------------------------------- -- line 105 ---------------------------------------- . EXPLICIT_WRITE, . expr.span, . format!("use of `{used}.unwrap()`"), . "try", . format!("{prefix}{sugg_mac}!({inputs_snippet})"), . applicability, . ); . } 3,145,784 ( 0.02%) } . } . . /// If `kind` is a block that looks like `{ let result = $expr; result }` then . /// returns $expr. Otherwise returns `kind`. . fn look_in_block<'tcx, 'hir>(cx: &LateContext<'tcx>, kind: &'tcx ExprKind<'hir>) -> &'tcx ExprKind<'hir> { . if let ExprKind::Block(block, _label @ None) = kind . && let Block { . stmts: [Stmt { kind: StmtKind::Let(local), .. }], -- line 121 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/macros.rs -------------------------------------------------------------------------------- Ir -- line 33 ---------------------------------------- . sym::std_panic_macro, . sym::todo_macro, . sym::unimplemented_macro, . sym::write_macro, . sym::writeln_macro, . ]; . . /// Returns true if a given Macro `DefId` is a format macro (e.g. `println!`) 7 ( 0.00%) pub fn is_format_macro(cx: &LateContext<'_>, macro_def_id: DefId) -> bool { 9 ( 0.00%) if let Some(name) = cx.tcx.get_diagnostic_name(macro_def_id) { 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . FORMAT_MACRO_DIAG_ITEMS.contains(&name) . } else { . // Allow users to tag any macro as being format!-like . // TODO: consider deleting FORMAT_MACRO_DIAG_ITEMS and using just this method . get_unique_builtin_attr( . cx.sess(), . #[allow(deprecated)] . cx.tcx.get_all_attrs(macro_def_id), . sym::format_args, . ) . .is_some() . } 6 ( 0.00%) } . . /// A macro call, like `vec![1, 2, 3]`. . /// . /// Use `tcx.item_name(macro_call.def_id)` to get the macro name. . /// Even better is to check if it is a diagnostic item. . /// . /// This structure is similar to `ExpnData` but it precludes desugaring expansions. . #[derive(Debug)] -- line 63 ---------------------------------------- -- line 77 ---------------------------------------- . span_is_local(self.span) . } . } . . /// Returns an iterator of expansions that created the given span . pub fn expn_backtrace(mut span: Span) -> impl Iterator { . std::iter::from_fn(move || { . let ctxt = span.ctxt(); 31 ( 0.00%) if ctxt == SyntaxContext::root() { . return None; . } 55 ( 0.00%) let expn = ctxt.outer_expn(); 60 ( 0.00%) let data = expn.expn_data(); 41 ( 0.00%) span = data.call_site; 302 ( 0.00%) Some((expn, data)) . }) . } . . /// Checks whether the span is from the root expansion or a locally defined macro 5 ( 0.00%) pub fn span_is_local(span: Span) -> bool { . !span.from_expansion() || expn_is_local(span.ctxt().outer_expn()) 3 ( 0.00%) } . . /// Checks whether the expansion is the root expansion or a locally defined macro . pub fn expn_is_local(expn: ExpnId) -> bool { . if expn == ExpnId::root() { . return true; . } . let data = expn.expn_data(); . let backtrace = expn_backtrace(data.call_site); -- line 106 ---------------------------------------- -- line 108 ---------------------------------------- . .chain(backtrace) . .find_map(|(_, data)| data.macro_def_id) . .is_none_or(DefId::is_local) . } . . /// Returns an iterator of macro expansions that created the given span. . /// Note that desugaring expansions are skipped. . pub fn macro_backtrace(span: Span) -> impl Iterator { 140 ( 0.00%) expn_backtrace(span).filter_map(|(expn, data)| match data { . ExpnData { 34 ( 0.00%) kind: ExpnKind::Macro(kind, _), 42 ( 0.00%) macro_def_id: Some(def_id), 80 ( 0.00%) call_site: span, . .. . } => Some(MacroCall { . def_id, . kind, . expn, . span, . }), . _ => None, -- line 128 ---------------------------------------- -- line 129 ---------------------------------------- . }) . } . . /// If the macro backtrace of `span` has a macro call at the root expansion . /// (i.e. not a nested macro call), returns `Some` with the `MacroCall` . /// . /// If you only want to check whether the root macro has a specific name, . /// consider using [`matching_root_macro_call`] instead. 4,325,530 ( 0.02%) pub fn root_macro_call(span: Span) -> Option { . macro_backtrace(span).last() 3,145,840 ( 0.02%) } . . /// A combination of [`root_macro_call`] and . /// [`is_diagnostic_item`](rustc_middle::ty::TyCtxt::is_diagnostic_item) that returns a `MacroCall` . /// at the root expansion if only it matches the given name. 3,539,007 ( 0.02%) pub fn matching_root_macro_call(cx: &LateContext<'_>, span: Span, name: Symbol) -> Option { 786,471 ( 0.00%) root_macro_call(span).filter(|mc| cx.tcx.is_diagnostic_item(name, mc.def_id)) 17,302,843 ( 0.09%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::root_macro_call (393,223x) 410 ( 0.00%) => ???:::is_diagnostic_item (5x) 2,752,561 ( 0.01%) } . . /// Like [`root_macro_call`], but only returns `Some` if `node` is the "first node" . /// produced by the macro call, as in [`first_node_in_macro`]. . pub fn root_macro_call_first_node(cx: &LateContext<'_>, node: &impl HirNode) -> Option { 7,078,036 ( 0.03%) if first_node_in_macro(cx, node) != Some(ExpnId::root()) { 12,976,410 ( 0.06%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::first_node_in_macro:: (393,223x) . return None; . } 21 ( 0.00%) root_macro_call(node.span()) 250 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::root_macro_call (1x) . } . . /// Like [`macro_backtrace`], but only returns macro calls where `node` is the "first node" of the . /// macro call, as in [`first_node_in_macro`]. . pub fn first_node_macro_backtrace(cx: &LateContext<'_>, node: &impl HirNode) -> impl Iterator { 786,446 ( 0.00%) let span = node.span(); 786,446 ( 0.00%) first_node_in_macro(cx, node) 12,976,410 ( 0.06%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::first_node_in_macro:: (393,223x) . .into_iter() . .flat_map(move |expn| macro_backtrace(span).take_while(move |macro_call| macro_call.expn != expn)) . } . . /// If `node` is the "first node" in a macro expansion, returns `Some` with the `ExpnId` of the . /// macro call site (i.e. the parent of the macro expansion). . /// . /// This generally means that `node` is the outermost node of an entire macro expansion, but there -- line 169 ---------------------------------------- -- line 174 ---------------------------------------- . /// just check the context of that span directly (e.g. `parent.span.from_expansion()`). . /// . /// If a macro call is in statement position, it expands to one or more statements. . /// In that case, each statement *and* their immediate descendants will all yield `Some` . /// with the `ExpnId` of the containing block. . /// . /// A node may be the "first node" of multiple macro calls in a macro backtrace. . /// The expansion of the outermost macro call site is returned in such cases. 28,312,101 ( 0.14%) pub fn first_node_in_macro(cx: &LateContext<'_>, node: &impl HirNode) -> Option { . // A node that is not from an expansion can never be the first node in a macro. This is the . // common case, so return before touching the cache. 15,728,945 ( 0.08%) if !node.span().from_expansion() { . return None; . } . . // The macro lints each query this for the node currently being visited, and the combined late . // pass runs all their `check_*` callbacks on that node back to back, so the redundant queries . // are consecutive. A single-slot memo of the last node collapses them to one backtrace walk in . // O(1) memory. The result is a pure function of the `HirId` (the HIR is frozen during lint . // passes), so returning the stored value on a key match is always correct. . let hir_id = node.hir_id(); 90 ( 0.00%) if let Some((cached_id, cached)) = LAST_FIRST_NODE_IN_MACRO.get() . && cached_id == hir_id . { . return cached; . } 5 ( 0.00%) let result = first_node_in_macro_uncached(cx, node); . LAST_FIRST_NODE_IN_MACRO.set(Some((hir_id, result))); . result 28,312,101 ( 0.14%) } . . thread_local! { . static LAST_FIRST_NODE_IN_MACRO: Cell)>> = const { Cell::new(None) }; . } . . fn first_node_in_macro_uncached(cx: &LateContext<'_>, node: &impl HirNode) -> Option { . // get the macro expansion or return `None` if not found . // `macro_backtrace` importantly ignores desugaring expansions . let expn = macro_backtrace(node.span()).next()?.expn; . . // get the parent node, possibly skipping over a statement . // if the parent is not found, it is sensible to return `Some(root)` . let mut parent_iter = cx.tcx.hir_parent_iter(node.hir_id()); 10 ( 0.00%) let (parent_id, _) = match parent_iter.next() { . None => return Some(ExpnId::root()), . Some((_, Node::Stmt(_))) => match parent_iter.next() { . None => return Some(ExpnId::root()), . Some(next) => next, . }, . Some(next) => next, . }; . . // get the macro expansion of the parent node 20 ( 0.00%) let parent_span = cx.tcx.hir_span(parent_id); 718 ( 0.00%) => ???:::hir_span (5x) . let Some(parent_macro_call) = macro_backtrace(parent_span).next() else { . // the parent node is not in a macro . return Some(ExpnId::root()); . }; . . if parent_macro_call.expn.is_descendant_of(expn) { . // `node` is input to a macro call . return None; -- line 235 ---------------------------------------- -- line 282 ---------------------------------------- . Display(&'a Expr<'a>), . /// Anything else - `panic!("error {}: {}", a, b)`, `panic!("on edition 2021+")`. . /// . /// See [`FormatArgsStorage::get`] to examine the contents of the formatting. . Format(&'a Expr<'a>), . } . . impl<'a> PanicCall<'a> { 6 ( 0.00%) pub fn parse(expr: &'a Expr<'a>) -> Option { 4 ( 0.00%) let ExprKind::Call(callee, args) = &expr.kind else { . return None; . }; 5 ( 0.00%) let ExprKind::Path(QPath::Resolved(_, path)) = &callee.kind else { . return None; . }; 4 ( 0.00%) let name = path.segments.last().unwrap().ident.name; . 4 ( 0.00%) let [arg, rest @ ..] = args else { . return None; . }; . let result = match name { 6 ( 0.00%) sym::panic | sym::begin_panic | sym::panic_str_2015 => { 2 ( 0.00%) if arg.span.eq_ctxt(expr.span) || arg.span.is_dummy() { . Self::DefaultMessage . } else { . Self::Str2015(arg) . } . }, . sym::panic_display => { . let ExprKind::AddrOf(_, _, e) = &arg.kind else { . return None; -- line 312 ---------------------------------------- -- line 327 ---------------------------------------- . match msg_arg.kind { . ExprKind::Call(_, [fmt_arg]) => Self::Format(fmt_arg), . _ => Self::DefaultMessage, . } . }, . _ => return None, . }; . Some(result) 8 ( 0.00%) } . . pub fn is_default_message(&self) -> bool { . matches!(self, Self::DefaultMessage) . } . } . . /// Finds the arguments of an `assert!` or `debug_assert!` macro call within the macro expansion 12 ( 0.00%) pub fn find_assert_args<'a>( . cx: &LateContext<'_>, . expr: &'a Expr<'a>, . expn: ExpnId, . ) -> Option<(&'a Expr<'a>, PanicCall<'a>)> { . find_assert_args_inner(cx, expr, expn).map(|([e], p)| (e, p)) 9 ( 0.00%) } . . /// Finds the arguments of an `assert_eq!` or `debug_assert_eq!` macro call within the macro . /// expansion . pub fn find_assert_eq_args<'a>( . cx: &LateContext<'_>, . expr: &'a Expr<'a>, . expn: ExpnId, . ) -> Option<(&'a Expr<'a>, &'a Expr<'a>, PanicCall<'a>)> { -- line 357 ---------------------------------------- -- line 358 ---------------------------------------- . find_assert_args_inner(cx, expr, expn).map(|([a, b], p)| (a, b, p)) . } . . fn find_assert_args_inner<'a, const N: usize>( . cx: &LateContext<'_>, . expr: &'a Expr<'a>, . expn: ExpnId, . ) -> Option<([&'a Expr<'a>; N], PanicCall<'a>)> { 4 ( 0.00%) let macro_id = expn.expn_data().macro_def_id?; 4 ( 0.00%) let (expr, expn) = match cx.tcx.item_name(macro_id).as_str().strip_prefix("debug_") { . None => (expr, expn), . Some(inner_name) => find_assert_within_debug_assert(cx, expr, expn, Symbol::intern(inner_name))?, . }; . let mut args = ArrayVec::new(); 7 ( 0.00%) let panic_expn = for_each_expr_without_closures(expr, |e| { 767 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/visitors.rs:clippy_utils::visitors::for_each_expr_without_closures::::{closure#0}> (1x) 10 ( 0.00%) if args.is_full() { 9 ( 0.00%) match PanicCall::parse(e) { 66 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:::parse (1x) . Some(expn) => ControlFlow::Break(expn), . None => ControlFlow::Continue(Descend::Yes), . } 24 ( 0.00%) } else if is_assert_arg(cx, e, expn) { 231 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::is_assert_arg (1x) . args.push(e); . ControlFlow::Continue(Descend::No) . } else { . ControlFlow::Continue(Descend::Yes) . } . }); 1 ( 0.00%) let args = args.into_inner().ok()?; . Some((args, panic_expn?)) . } . . fn find_assert_within_debug_assert<'a>( . cx: &LateContext<'_>, . expr: &'a Expr<'a>, . expn: ExpnId, . assert_name: Symbol, -- line 393 ---------------------------------------- -- line 402 ---------------------------------------- . } else if e_expn.expn_data().macro_def_id.map(|id| cx.tcx.item_name(id)) == Some(assert_name) { . ControlFlow::Break((e, e_expn)) . } else { . ControlFlow::Continue(Descend::No) . } . }) . } . 27 ( 0.00%) fn is_assert_arg(cx: &LateContext<'_>, expr: &Expr<'_>, assert_expn: ExpnId) -> bool { 6 ( 0.00%) if !expr.span.from_expansion() { . return true; . } 6 ( 0.00%) let result = macro_backtrace(expr.span).try_for_each(|macro_call| { . if macro_call.expn == assert_expn { . ControlFlow::Break(false) . } else { . match cx.tcx.item_name(macro_call.def_id) { . // `cfg!(debug_assertions)` in `debug_assert!` . sym::cfg => ControlFlow::Continue(()), . // assert!(other_macro!(..)) . _ => ControlFlow::Break(true), . } . } . }); . match result { . ControlFlow::Break(is_assert_arg) => is_assert_arg, . ControlFlow::Continue(()) => true, . } 27 ( 0.00%) } . . /// Stores AST [`FormatArgs`] nodes for use in late lint passes, as they are in a desugared form in . /// the HIR 1 ( 0.00%) #[derive(Default, Clone)] . pub struct FormatArgsStorage(Arc>>); . . impl FormatArgsStorage { . /// Returns an AST [`FormatArgs`] node if a `format_args` expansion is found as a descendant of . /// `expn_id` . /// . /// See also [`find_format_arg_expr`] 7 ( 0.00%) pub fn get(&self, cx: &LateContext<'_>, start: &Expr<'_>, expn_id: ExpnId) -> Option<&FormatArgs> { . let format_args_expr = for_each_expr_without_closures(start, |expr| { 7 ( 0.00%) let ctxt = expr.span.ctxt(); 53 ( 0.00%) if ctxt.outer_expn().is_descendant_of(expn_id) { . if macro_backtrace(expr.span) 5 ( 0.00%) .map(|macro_call| cx.tcx.item_name(macro_call.def_id)) . .any(|name| matches!(name, sym::const_format_args | sym::format_args | sym::format_args_nl)) . { . ControlFlow::Break(expr) . } else { . ControlFlow::Continue(Descend::Yes) . } . } else { . ControlFlow::Continue(Descend::No) . } . })?; . . debug_assert!(self.0.get().is_some(), "`FormatArgsStorage` not yet populated"); . . self.0.get()?.get(&format_args_expr.span.with_parent(None)) 4 ( 0.00%) } . . /// Should only be called by `FormatArgsCollector` 2 ( 0.00%) pub fn set(&self, format_args: FxHashMap) { . self.0 . .set(format_args) . .expect("`FormatArgsStorage::set` should only be called once"); 3 ( 0.00%) } . } . . /// Attempt to find the [`rustc_hir::Expr`] that corresponds to the [`FormatArgument`]'s value . pub fn find_format_arg_expr<'hir>(start: &'hir Expr<'hir>, target: &FormatArgument) -> Option<&'hir Expr<'hir>> { . let SpanData { . lo, . hi, . ctxt, -- line 477 ---------------------------------------- 307 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/literal_representation.rs -------------------------------------------------------------------------------- Ir -- line 161 ---------------------------------------- . LargeDigitGroups, . DecimalRepresentation, . MistypedLiteralSuffix, . UnusualByteGroupings, . } . . impl WarningType { . fn lint_and_text(&self) -> (&'static Lint, &'static str, &'static str) { 413,210 ( 0.00%) match self { . Self::MistypedLiteralSuffix => ( . MISTYPED_LITERAL_SUFFIXES, . "mistyped literal suffix", . "did you mean to write", . ), . Self::UnreadableLiteral => (UNREADABLE_LITERAL, "long literal lacking separators", "consider"), . Self::LargeDigitGroups => (LARGE_DIGIT_GROUPS, "digit groups should be smaller", "consider"), . Self::InconsistentDigitGrouping => ( -- line 177 ---------------------------------------- -- line 187 ---------------------------------------- . Self::UnusualByteGroupings => ( . UNUSUAL_BYTE_GROUPINGS, . "digits of hex, binary or octal literal not in groups of equal size", . "consider", . ), . } . } . 51 ( 0.00%) fn display(&self, num_lit: &NumericLiteral<'_>, cx: &EarlyContext<'_>, span: Span) { 236,188 ( 0.00%) let (lint, message, try_msg) = self.lint_and_text(); . #[expect(clippy::collapsible_span_lint_calls, reason = "rust-clippy#7797")] 590,487 ( 0.00%) span_lint_and_then(cx, lint, span, message, |diag| { 11,575 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/diagnostics.rs:clippy_utils::diagnostics::span_lint_and_then::::display::{closure#0}> (17x) . diag.span_suggestion(span, try_msg, num_lit.format(), Applicability::MaybeIncorrect); . }); 34 ( 0.00%) } . } . . pub struct LiteralDigitGrouping { . lint_fraction_readability: bool, . } . . impl EarlyLintPass for LiteralDigitGrouping { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { . // `NumericLiteral::from_lit_kind` only accepts integer and float literals. 1,048,585 ( 0.01%) if let ExprKind::Lit(lit) = expr.kind 786,429 ( 0.00%) && matches!(lit.kind, token::LitKind::Integer | token::LitKind::Float) 1,048,568 ( 0.01%) && !expr.span.in_external_macro(cx.sess().source_map()) . { . self.check_lit(cx, lit, expr.span); . } 3,145,768 ( 0.02%) } . } . . // Length of each UUID hyphenated group in hex digits. . const UUID_GROUP_LENS: [usize; 5] = [8, 4, 4, 4, 12]; . . impl LiteralDigitGrouping { . pub fn new(conf: &'static Conf) -> Self { . Self { 2 ( 0.00%) lint_fraction_readability: conf.unreadable_literal_lint_fractions, . } . } . . fn check_lit(&self, cx: &EarlyContext<'_>, lit: token::Lit, span: Span) { 1,834,994 ( 0.01%) if let Some(src) = span.get_text(cx) 2,097,136 ( 0.01%) && let Ok(lit_kind) = LitKind::from_token_lit(lit) 34,677,134 ( 0.17%) => ???:::from_token_lit (262,142x) 5,504,982 ( 0.03%) && let Some(mut num_lit) = NumericLiteral::from_lit_kind(&src, &lit_kind) 61,734,274 ( 0.30%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::from_lit_kind (262,142x) 6,553,550 ( 0.03%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::deref (262,142x) . { . if !Self::check_for_mistyped_suffix(cx, span, &mut num_lit) { . return; . } . . if Self::is_literal_uuid_formatted(&num_lit) { . return; . } . 786,426 ( 0.00%) let result = (|| { 2 ( 0.00%) let integral_group_size = Self::get_group_size(num_lit.integer.split('_'), num_lit.radix, true)?; 805,941 ( 0.00%) if let Some(fraction) = num_lit.fraction { . let fractional_group_size = 589,815 ( 0.00%) Self::get_group_size(fraction.rsplit('_'), num_lit.radix, self.lint_fraction_readability)?; . . let consistent = Self::parts_consistent( . integral_group_size, . fractional_group_size, . num_lit.integer.len(), . fraction.len(), . ); . if !consistent { -- line 255 ---------------------------------------- -- line 272 ---------------------------------------- . warning_type.display(&num_lit, cx, span); . } . } . } . } . . // Returns `false` if the check fails . fn check_for_mistyped_suffix(cx: &EarlyContext<'_>, span: Span, num_lit: &mut NumericLiteral<'_>) -> bool { 262,142 ( 0.00%) if num_lit.suffix.is_some() { . return true; . } . 786,426 ( 0.00%) let (part, mistyped_suffixes, is_float) = if let Some((_, exponent)) = &mut num_lit.exponent { . (exponent, &["32", "64"][..], true) 262,142 ( 0.00%) } else if num_lit.fraction.is_some() { . return true; . } else { . (&mut num_lit.integer, &["8", "16", "32", "64"][..], false) . }; . 131,074 ( 0.00%) let mut split = part.rsplit('_'); 131,074 ( 0.00%) let last_group = split.next().expect("At least one group"); 65,537 ( 0.00%) if split.next().is_some() && mistyped_suffixes.contains(&last_group) { . let main_part = &part[..part.len() - last_group.len()]; . let missing_char; . if is_float { . missing_char = 'f'; . } else { . let radix = match num_lit.radix { . Radix::Binary => 2, . Radix::Octal => 8, -- line 302 ---------------------------------------- -- line 336 ---------------------------------------- . } . } . . /// Checks whether the numeric literal matches the formatting of a UUID. . /// . /// Returns `true` if the radix is hexadecimal, and the groups match the . /// UUID format of 8-4-4-4-12. . fn is_literal_uuid_formatted(num_lit: &NumericLiteral<'_>) -> bool { 4 ( 0.00%) if num_lit.radix != Radix::Hexadecimal { . return false; . } . . // UUIDs should not have a fraction . if num_lit.fraction.is_some() { . return false; . } . 4 ( 0.00%) let group_sizes: Vec = num_lit.integer.split('_').map(str::len).collect(); 4 ( 0.00%) if UUID_GROUP_LENS.len() == group_sizes.len() { . iter::zip(&UUID_GROUP_LENS, &group_sizes).all(|(&a, &b)| a == b) . } else { . false . } . } . . /// Given the sizes of the digit groups of both integral and fractional . /// parts, and the length -- line 362 ---------------------------------------- -- line 363 ---------------------------------------- . /// of both parts, determine if the digits have been grouped consistently. . #[must_use] . fn parts_consistent( . int_group_size: Option, . frac_group_size: Option, . int_size: usize, . frac_size: usize, . ) -> bool { 589,815 ( 0.00%) match (int_group_size, frac_group_size) { . // No groups on either side of decimal point - trivially consistent. . (None, None) => true, . // Integral part has grouped digits, fractional part does not. . (Some(int_group_size), None) => frac_size <= int_group_size, . // Fractional part has grouped digits, integral part does not. . (None, Some(frac_group_size)) => int_size <= frac_group_size, . // Both parts have grouped digits. Groups should be the same size. . (Some(int_group_size), Some(frac_group_size)) => int_group_size == frac_group_size, -- line 379 ---------------------------------------- -- line 386 ---------------------------------------- . groups: impl Iterator, . radix: Radix, . lint_unreadable: bool, . ) -> Result, WarningType> { . let mut groups = groups.map(str::len); . . let first = groups.next().expect("At least one group"); . 917,494 ( 0.00%) if (radix == Radix::Binary || radix == Radix::Octal || radix == Radix::Hexadecimal) . && let Some(second_size) = groups.next() . && (!groups.all(|i| i == second_size) || first > second_size) . { . return Err(WarningType::UnusualByteGroupings); . } . . if let Some(second) = groups.next() { . if !groups.all(|x| x == second) || first > second { . Err(WarningType::InconsistentDigitGrouping) . } else if second > 4 { . Err(WarningType::LargeDigitGroups) . } else { . Ok(Some(second)) . } 917,494 ( 0.00%) } else if first > 5 && lint_unreadable { . Err(WarningType::UnreadableLiteral) . } else { . Ok(None) . } . } . } . . pub struct DecimalLiteralRepresentation { . threshold: u64, . } . . impl EarlyLintPass for DecimalLiteralRepresentation { 2,752,547 ( 0.01%) fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { . // Only integer tokens can produce `LitKind::Int`. 786,442 ( 0.00%) if let ExprKind::Lit(lit) = expr.kind . && lit.kind == token::LitKind::Integer 196,611 ( 0.00%) && !expr.span.in_external_macro(cx.sess().source_map()) . { 327,685 ( 0.00%) self.check_lit(cx, lit, expr.span); . } 3,145,768 ( 0.02%) } . } . . impl DecimalLiteralRepresentation { . pub fn new(conf: &'static Conf) -> Self { . Self { 2 ( 0.00%) threshold: conf.literal_representation_threshold, . } . } . fn check_lit(&self, cx: &EarlyContext<'_>, lit: token::Lit, span: Span) { . // Lint integral literals. 458,759 ( 0.00%) if let Ok(lit_kind) = LitKind::from_token_lit(lit) 17,113,754 ( 0.08%) => ???:::from_token_lit (65,537x) 262,148 ( 0.00%) && let LitKind::Int(val, _) = lit_kind 65,537 ( 0.00%) && val >= u128::from(self.threshold) 644,650 ( 0.00%) && let Some(src) = span.get_text(cx) 25,592,605 ( 0.13%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/source.rs:::get_text::<&rustc_lint::context::EarlyContext> (64,465x) 386,790 ( 0.00%) && let Some(num_lit) = NumericLiteral::from_lit_kind(&src, &lit_kind) 9,863,149 ( 0.05%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::from_lit_kind (64,465x) 1,611,625 ( 0.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::deref (64,465x) . && num_lit.radix == Radix::Decimal . { 193,389 ( 0.00%) let hex = format!("{val:#X}"); 322,315 ( 0.00%) let num_lit = NumericLiteral::new(&hex, num_lit.suffix, false); 4,576,873 ( 0.02%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/numeric_literal.rs:::new (64,463x) 128,926 ( 0.00%) let _: Result<(), ()> = Self::do_lint(num_lit.integer).map_err(|warning_type| { 34 ( 0.00%) warning_type.display(&num_lit, cx, span); 11,932 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/literal_representation.rs:::display (17x) . }); . } . } . . fn do_lint(digits: &str) -> Result<(), WarningType> { 128,926 ( 0.00%) if digits.len() == 1 { . // Lint for 1 digit literals, if someone really sets the threshold that low . if digits == "1" . || digits == "2" . || digits == "4" . || digits == "8" . || digits == "3" . || digits == "7" . || digits == "F" . { . return Err(WarningType::DecimalRepresentation); . } 128,926 ( 0.00%) } else if digits.len() < 4 { . // Lint for Literals with a hex-representation of 2 or 3 digits . let f = &digits[0..1]; // first digit . let s = &digits[1..]; // suffix . . // Powers of 2 . if ((f.eq("1") || f.eq("2") || f.eq("4") || f.eq("8")) && s.chars().all(|c| c == '0')) . // Powers of 2 minus 1 . || ((f.eq("1") || f.eq("3") || f.eq("7") || f.eq("F")) && s.chars().all(|c| c == 'F')) -- line 477 ---------------------------------------- -- line 480 ---------------------------------------- . } . } else { . // Lint for Literals with a hex-representation of 4 digits or more . let f = &digits[0..1]; // first digit . let m = &digits[1..digits.len() - 1]; // middle digits, except last . let s = &digits[1..]; // suffix . . // Powers of 2 with a margin of +15/-16 212,296 ( 0.00%) if ((f.eq("1") || f.eq("2") || f.eq("4") || f.eq("8")) && m.chars().all(|c| c == '0')) 50,839 ( 0.00%) || ((f.eq("1") || f.eq("3") || f.eq("7") || f.eq("F")) && m.chars().all(|c| c == 'F')) . // Lint for representations with only 0s and Fs, while allowing 7 as the first . // digit 55,380 ( 0.00%) || ((f.eq("7") || f.eq("F")) && s.chars().all(|c| c == '0' || c == 'F')) . { . return Err(WarningType::DecimalRepresentation); . } . } . . Ok(()) . } . } -- line 500 ---------------------------------------- 4,703,884 ( 0.02%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_checked_ops.rs -------------------------------------------------------------------------------- Ir -- line 41 ---------------------------------------- . . #[derive(Copy, Clone)] . enum NonZeroBranch { . Then, . Else, . } . . impl LateLintPass<'_> for ManualCheckedOps { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::If(cond, then, r#else) = expr.kind 2 ( 0.00%) && !expr.span.from_expansion() . && let Some((divisor, branch)) = divisor_from_condition(cond) . // This lint is intended for unsigned integers only. . // . // For signed integers, the most direct refactor to `checked_div` is often not . // semantically equivalent to the original guard. For example, `rhs > 0` deliberately . // excludes negative divisors, while `checked_div` would return `Some` for `rhs = -2`. . // Also, `checked_div` can return `None` for `MIN / -1`, which requires additional . // handling beyond the zero check. -- line 59 ---------------------------------------- -- line 118 ---------------------------------------- . diag.span_label(*first, "division performed here"); . if !rest.is_empty() { . diag.span_labels(rest.to_vec(), "... and here"); . } . } . diag.help("consider using `checked_div`"); . }); . } 3,145,784 ( 0.02%) } . } . . #[derive(Copy, Clone, Eq, PartialEq)] . enum UseKind { . Division, . Other, . } . -- line 134 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/zombie_processes.rs -------------------------------------------------------------------------------- Ir -- line 53 ---------------------------------------- . pub ZOMBIE_PROCESSES, . suspicious, . "not waiting on a spawned child process" . } . . declare_lint_pass!(ZombieProcesses => [ZOMBIE_PROCESSES]); . . impl<'tcx> LateLintPass<'tcx> for ZombieProcesses { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,572,892 ( 0.01%) if let ExprKind::Call(..) | ExprKind::MethodCall(..) = expr.kind 4 ( 0.00%) && let child_ty = cx.typeck_results().expr_ty(expr) 80 ( 0.00%) => ???:::expr_ty (2x) . && child_ty.is_diag_item(cx, sym::Child) . { . match cx.tcx.parent_hir_node(expr.hir_id) { . Node::LetStmt(local) . if let PatKind::Binding(_, local_id, ..) = local.pat.kind . && let Some(enclosing_block) = get_enclosing_block(cx, expr.hir_id) => . { . let mut vis = WaitFinder { -- line 71 ---------------------------------------- -- line 110 ---------------------------------------- . .. . }) => { . // Immediately dropped. E.g. `std::process::Command::new("echo").spawn().unwrap();` . check(cx, expr, Cause::NeverWait, true); . }, . _ => {}, . } . } 3,145,784 ( 0.02%) } . } . . struct MaybeWait(Span); . . /// A visitor responsible for finding a `wait()` call on a local variable. . /// . /// Note that this visitor does NOT explicitly look for `wait()` calls directly, but rather does the . /// inverse -- checking if all uses of the local are either: -- line 126 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/size_of_ref.rs -------------------------------------------------------------------------------- Ir -- line 51 ---------------------------------------- . pub SIZE_OF_REF, . suspicious, . "Argument to `size_of_val()` is a double-reference, which is almost certainly unintended" . } . . declare_lint_pass!(SizeOfRef => [SIZE_OF_REF]); . . impl LateLintPass<'_> for SizeOfRef { 1,572,892 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::Call(path, [arg]) = expr.kind 4 ( 0.00%) && path.basic_res().is_diag_item(cx, sym::mem_size_of_val) . && let arg_ty = cx.typeck_results().expr_ty(arg) . && peel_and_count_ty_refs(arg_ty).1 > 1 . { . span_lint_and_help( . cx, . SIZE_OF_REF, . expr.span, . "argument to `size_of_val()` is a reference to a reference", . None, . "dereference the argument to `size_of_val()` to get the size of the value instead of the size of the reference-type", . ); . } 1,966,115 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/bool_comparison.rs -------------------------------------------------------------------------------- Ir -- line 31 ---------------------------------------- . pub BOOL_COMPARISON, . complexity, . "comparing a variable to a boolean, e.g., `if x == true` or `if x != true`" . } . . declare_lint_pass!(BoolComparison => [BOOL_COMPARISON]); . . impl<'tcx> LateLintPass<'tcx> for BoolComparison { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,452 ( 0.00%) if e.span.from_expansion() { . return; . } . 3 ( 0.00%) if let ExprKind::Binary(Spanned { node, .. }, left_side, right_side) = e.kind 6 ( 0.00%) && is_expn_of(left_side.span, sym::cfg).is_none() 34 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_expn_of (1x) 6 ( 0.00%) && is_expn_of(right_side.span, sym::cfg).is_none() 34 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_expn_of (1x) 5 ( 0.00%) && cx.typeck_results().expr_ty(left_side).is_bool() 40 ( 0.00%) => ???:::expr_ty (1x) . && cx.typeck_results().expr_ty(right_side).is_bool() . { . let ignore_case = None::<(fn(_) -> _, &str)>; . let ignore_no_literal = None::<(fn(_, _) -> _, &str)>; . match node { . BinOpKind::Eq => { . let true_case = Some((|h| h, "equality checks against true are unnecessary")); . let false_case = Some(( -- line 55 ---------------------------------------- -- line 94 ---------------------------------------- . Some(( . |l: Sugg<'tcx>, r: Sugg<'tcx>| l.bit_and(&(!r)), . "order comparisons between booleans can be simplified", . )), . ), . _ => (), . } . } 3,145,784 ( 0.02%) } . } . . fn check_comparison<'a, 'tcx>( . cx: &LateContext<'tcx>, . e: &'tcx Expr<'_>, . left_true: Option<(impl FnOnce(Sugg<'a>) -> Sugg<'a>, &'static str)>, . left_false: Option<(impl FnOnce(Sugg<'a>) -> Sugg<'a>, &'static str)>, . right_true: Option<(impl FnOnce(Sugg<'a>) -> Sugg<'a>, &'static str)>, -- line 110 ---------------------------------------- 786,436 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_ast/src/ast.rs -------------------------------------------------------------------------------- Ir -- line 974 ---------------------------------------- . /// where `T = typeof($expr)`. . Raw, . /// A pinned borrow, `&pin const $expr` or `&pin mut $expr`. . /// The resulting type is either `Pin<&'a T>` or `Pin<&'a mut T>` . /// where `T = typeof($expr)` and `'a` is some lifetime. . Pin, . } . 17 ( 0.00%) #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, StableHash, Walkable)] . pub enum BinOpKind { . /// The `+` operator (addition) . Add, . /// The `-` operator (subtraction) . Sub, . /// The `*` operator (multiplication) . Mul, . /// The `/` operator (division) -- line 990 ---------------------------------------- -- line 1070 ---------------------------------------- . Add | Sub | Mul | Div | Rem | And | Or | BitXor | BitAnd | BitOr | Shl | Shr => { . Fixity::Left . } . } . } . . pub fn is_comparison(self) -> bool { . use BinOpKind::*; 6 ( 0.00%) match self { . Eq | Ne | Lt | Le | Gt | Ge => true, . Add | Sub | Mul | Div | Rem | And | Or | BitXor | BitAnd | BitOr | Shl | Shr => false, . } . } . . /// Returns `true` if the binary operator takes its arguments by value. . pub fn is_by_value(self) -> bool { . !self.is_comparison() -- line 1086 ---------------------------------------- -- line 1156 ---------------------------------------- . } . } . . pub type AssignOp = Spanned; . . /// Unary operator. . /// . /// Note that `&data` is not an operator, it's an `AddrOf` expression. 1 ( 0.00%) #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, StableHash, Walkable)] . pub enum UnOp { . /// The `*` operator for dereferencing . Deref, . /// The `!` operator for logical inversion . Not, . /// The `-` operator for negation . Neg, . } -- line 1172 ---------------------------------------- -- line 2292 ---------------------------------------- . . /// Returns `true` if this literal is byte literal string. . pub fn is_bytestr(&self) -> bool { . matches!(self, LitKind::ByteStr(..)) . } . . /// Returns `true` if this is a numeric literal. . pub fn is_numeric(&self) -> bool { 1,306,428 ( 0.01%) matches!(self, LitKind::Int(..) | LitKind::Float(..)) . } . . /// Returns `true` if this literal has no suffix. . /// Note: this will return true for literals with prefixes such as raw strings and byte strings. . pub fn is_unsuffixed(&self) -> bool { . !self.is_suffixed() . } . -- line 2308 ---------------------------------------- -- line 4197 ---------------------------------------- . Delegation(Box), . /// A list or glob delegation item (`reuse prefix::{a, b, c}`, `reuse prefix::*`). . /// Treated similarly to a macro call and expanded early. . DelegationMac(Box), . } . . impl ItemKind { . pub fn ident(&self) -> Option { 22 ( 0.00%) match *self { 1 ( 0.00%) ItemKind::ExternCrate(_, ident) 2 ( 0.00%) | ItemKind::Static(StaticItem { ident, .. }) . | ItemKind::Const(ConstItem { ident, .. }) 2 ( 0.00%) | ItemKind::Fn(Fn { ident, .. }) . | ItemKind::Mod(_, ident, _) . | ItemKind::TyAlias(TyAlias { ident, .. }) . | ItemKind::Enum(ident, ..) . | ItemKind::Struct(ident, ..) . | ItemKind::Union(ident, ..) . | ItemKind::Trait(Trait { ident, .. }) . | ItemKind::TraitAlias(TraitAlias { ident, .. }) . | ItemKind::MacroDef(ident, _) -- line 4217 ---------------------------------------- 12 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/zero_repeat_side_effects.rs -------------------------------------------------------------------------------- Ir -- line 40 ---------------------------------------- . pub ZERO_REPEAT_SIDE_EFFECTS, . suspicious, . "usage of zero-sized initializations of arrays or vecs causing side effects" . } . . declare_lint_pass!(ZeroRepeatSideEffects => [ZERO_REPEAT_SIDE_EFFECTS]); . . impl LateLintPass<'_> for ZeroRepeatSideEffects { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 1,572,892 ( 0.01%) if let Some(args) = VecArgs::hir(cx, expr) 6,684,959 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . && let VecArgs::Repeat(inner_expr, len) = args . && let ExprKind::Lit(l) = len.kind . && let LitKind::Int(Pu128(0), _) = l.node . { . inner_check(cx, expr, inner_expr, true); . } . // Lint only if the length is a literal zero, and not a path to any constants. . // NOTE(@y21): When reading `[f(); LEN]`, I intuitively expect that the function is called and it . // doesn't seem as confusing as `[f(); 0]`. It would also have false positives when eg. . // the const item depends on `#[cfg]s` and has different values in different compilation . // sessions). 786,446 ( 0.00%) else if let ExprKind::Repeat(inner_expr, const_arg) = expr.kind . && let ConstArgKind::Anon(anon_const) = const_arg.kind . && let length_expr = cx.tcx.hir_body(anon_const.body).value . && !length_expr.span.from_expansion() . && let ExprKind::Lit(literal) = length_expr.kind . && let LitKind::Int(Pu128(0), _) = literal.node . { . inner_check(cx, expr, inner_expr, false); . } 1,966,115 ( 0.01%) } . } . . fn inner_check(cx: &LateContext<'_>, expr: &'_ Expr<'_>, inner_expr: &'_ Expr<'_>, is_vec: bool) { . // check if expr is a call or has a call inside it . if inner_expr.can_have_side_effects() { . let parent_hir_node = cx.tcx.parent_hir_node(expr.hir_id); . let inner_expr_ty = cx.typeck_results().expr_ty(inner_expr); . let return_type = cx.typeck_results().expr_ty(expr); -- line 78 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/bool_assert_comparison.rs -------------------------------------------------------------------------------- Ir -- line 68 ---------------------------------------- . .tcx . .normalize_erasing_regions(cx.typing_env(), Unnormalized::new_wip(proj)); . . nty.is_bool() . }) . } . . impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison { 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 6 ( 0.00%) let Some(macro_call) = root_macro_call_first_node(cx, expr) else { . return; . }; 15 ( 0.00%) let eq_macro = match cx.tcx.get_diagnostic_name(macro_call.def_id) { 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::assert_eq_macro | sym::debug_assert_eq_macro) => true, . Some(sym::assert_ne_macro | sym::debug_assert_ne_macro) => false, . _ => return, . }; . let Some((a, b, _)) = find_assert_eq_args(cx, expr, macro_call.expn) else { . return; . }; . -- line 88 ---------------------------------------- -- line 148 ---------------------------------------- . . diag.multipart_suggestion( . format!("replace it with `{non_eq_mac}!(..)`"), . suggestions, . applicability, . ); . }, . ); 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unnested_or_patterns.rs -------------------------------------------------------------------------------- Ir -- line 63 ---------------------------------------- . impl EarlyLintPass for UnnestedOrPatterns { . fn check_arm(&mut self, cx: &EarlyContext<'_>, a: &ast::Arm) { . if self.msrv.meets(msrvs::OR_PATTERNS) { . lint_unnested_or_patterns(cx, &a.pat); . } . } . . fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) { 1,966,105 ( 0.01%) if self.msrv.meets(msrvs::OR_PATTERNS) 3,145,768 ( 0.02%) => /rust/deps/smallvec-1.15.1/src/lib.rs:::meets (393,221x) . && let ast::ExprKind::Let(pat, _, _, _) = &e.kind . { . lint_unnested_or_patterns(cx, pat); . } . } . . fn check_param(&mut self, cx: &EarlyContext<'_>, p: &ast::Param) { . if self.msrv.meets(msrvs::OR_PATTERNS) { -- line 79 ---------------------------------------- 1,179,663 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_span/src/span_encoding.rs -------------------------------------------------------------------------------- Ir -- line 72 ---------------------------------------- . /// the form of the code. No crates in `rustc-perf` need more than 15 bits . /// for `ctxt_or_parent_or_marker`, but larger crates might need more than 16 . /// bits. The number of bits needed for `parent` hasn't been measured, . /// because `parent` isn't currently used by default. . /// . /// In order to reliably use parented spans in incremental compilation, . /// accesses to `lo` and `hi` must introduce a dependency to the parent definition's span. . /// This is performed using the callback `SPAN_TRACK` to access the query engine. 89 ( 0.00%) #[derive(Clone, Copy, Eq, PartialEq, Hash)] . #[rustc_pass_by_value] . pub struct Span { . lo_or_index: u32, . len_with_tag_or_marker: u16, . ctxt_or_parent_or_marker: u16, . } . . // Convenience structures for all span formats. -- line 88 ---------------------------------------- -- line 109 ---------------------------------------- . #[derive(Clone, Copy)] . struct Interned { . index: u32, . } . . impl InlineCtxt { . #[inline] . fn data(self) -> SpanData { 326,610 ( 0.00%) let len = self.len as u32; . debug_assert!(len <= MAX_LEN); 326,610 ( 0.00%) SpanData { . lo: BytePos(self.lo), . hi: BytePos(self.lo.debug_strict_add(len)), . ctxt: SyntaxContext::from_u16(self.ctxt), . parent: None, . } . } . #[inline] . fn span(lo: u32, len: u16, ctxt: u16) -> Span { -- line 127 ---------------------------------------- -- line 133 ---------------------------------------- . (span.lo_or_index, span.len_with_tag_or_marker, span.ctxt_or_parent_or_marker); . InlineCtxt { lo, len, ctxt } . } . } . . impl InlineParent { . #[inline] . fn data(self) -> SpanData { 10 ( 0.00%) let len = (self.len_with_tag & !PARENT_TAG) as u32; . debug_assert!(len <= MAX_LEN); 29 ( 0.00%) SpanData { . lo: BytePos(self.lo), . hi: BytePos(self.lo.debug_strict_add(len)), . ctxt: SyntaxContext::root(), . parent: Some(LocalDefId { local_def_index: DefIndex::from_u16(self.parent) }), . } . } . #[inline] . fn span(lo: u32, len: u16, parent: u16) -> Span { . let (lo_or_index, len_with_tag_or_marker, ctxt_or_parent_or_marker) = 1 ( 0.00%) (lo, PARENT_TAG | len, parent); . Span { lo_or_index, len_with_tag_or_marker, ctxt_or_parent_or_marker } . } . #[inline] . fn from_span(span: Span) -> InlineParent { . let (lo, len_with_tag, parent) = . (span.lo_or_index, span.len_with_tag_or_marker, span.ctxt_or_parent_or_marker); . InlineParent { lo, len_with_tag, parent } . } . } . . impl PartiallyInterned { . #[inline] . fn data(self) -> SpanData { 29 ( 0.00%) SpanData { . ctxt: SyntaxContext::from_u16(self.ctxt), 16 ( 0.00%) ..with_span_interner(|interner| interner.spans[self.index as usize]) . } . } . #[inline] . fn span(index: u32, ctxt: u16) -> Span { . let (lo_or_index, len_with_tag_or_marker, ctxt_or_parent_or_marker) = . (index, BASE_LEN_INTERNED_MARKER, ctxt); . Span { lo_or_index, len_with_tag_or_marker, ctxt_or_parent_or_marker } . } -- line 177 ---------------------------------------- -- line 204 ---------------------------------------- . macro_rules! match_span_kind { . ( . $span:expr, . InlineCtxt($span1:ident) => $arm1:expr, . InlineParent($span2:ident) => $arm2:expr, . PartiallyInterned($span3:ident) => $arm3:expr, . Interned($span4:ident) => $arm4:expr, . ) => { 40,093,930 ( 0.20%) if $span.len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER { 76,243,300 ( 0.38%) if $span.len_with_tag_or_marker & PARENT_TAG == 0 { . // Inline-context format. . let $span1 = InlineCtxt::from_span($span); . $arm1 . } else { . // Inline-parent format. . let $span2 = InlineParent::from_span($span); . $arm2 . } 3,146,447 ( 0.02%) } else if $span.ctxt_or_parent_or_marker != CTXT_INTERNED_MARKER { . // Partially-interned format. . let $span3 = PartiallyInterned::from_span($span); . $arm3 . } else { . // Interned format. . let $span4 = Interned::from_span($span); . $arm4 . } -- line 230 ---------------------------------------- -- line 246 ---------------------------------------- . impl Span { . #[inline] . pub fn new( . mut lo: BytePos, . mut hi: BytePos, . ctxt: SyntaxContext, . parent: Option, . ) -> Self { 5 ( 0.00%) if lo > hi { . std::mem::swap(&mut lo, &mut hi); . } . . // Small len and ctxt may enable one of fully inline formats (or may not). . let (len, ctxt32) = (hi.0 - lo.0, ctxt.as_u32()); 18 ( 0.00%) if len <= MAX_LEN && ctxt32 <= MAX_CTXT { 13 ( 0.00%) match parent { . None => return InlineCtxt::span(lo.0, len as u16, ctxt32 as u16), . Some(parent) => { . let parent32 = parent.local_def_index.as_u32(); 16 ( 0.00%) if ctxt32 == 0 && parent32 <= MAX_CTXT { . return InlineParent::span(lo.0, len as u16, parent32 as u16); . } . } . } . } . . // Otherwise small ctxt may enable the partially inline format. . let index = |ctxt| { -- line 273 ---------------------------------------- -- line 274 ---------------------------------------- . with_span_interner(|interner| interner.intern(&SpanData { lo, hi, ctxt, parent })) . }; . if ctxt32 <= MAX_CTXT { . // Interned ctxt should never be read, so it can use any value. . PartiallyInterned::span(index(SyntaxContext::from_u32(u32::MAX)), ctxt32 as u16) . } else { . Interned::span(index(ctxt)) . } 32 ( 0.00%) } . . #[inline] . pub fn data(self) -> SpanData { . let data = self.data_untracked(); 22 ( 0.00%) if let Some(parent) = data.parent { 14 ( 0.00%) (*SPAN_TRACK)(parent); 84 ( 0.00%) => ???:rustc_interface::callbacks::track_span_parent (4x) . } . data . } . . /// Internal function to translate between an encoded span and the expanded representation. . /// This function must not be used outside the incremental engine. . #[inline] . pub fn data_untracked(self) -> SpanData { . match_span_kind! { . self, . InlineCtxt(span) => span.data(), . InlineParent(span) => span.data(), 16 ( 0.00%) PartiallyInterned(span) => span.data(), . Interned(span) => span.data(), . } . } . . /// Returns `true` if this span comes from any kind of macro, desugaring or inlining. . #[inline] . pub fn from_expansion(self) -> bool { . let ctxt = match_span_kind! { -- line 309 ---------------------------------------- -- line 321 ---------------------------------------- . Interned(_span) => SyntaxContext::from_u16(CTXT_INTERNED_MARKER), . }; . !ctxt.is_root() . } . . /// Returns `true` if this is a dummy span with any hygienic context. . #[inline] . pub fn is_dummy(self) -> bool { 2 ( 0.00%) if self.len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER { . // Inline-context or inline-parent format. . let lo = self.lo_or_index; . let len = (self.len_with_tag_or_marker & !PARENT_TAG) as u32; . debug_assert!(len <= MAX_LEN); 3 ( 0.00%) lo == 0 && len == 0 . } else { . // Fully-interned or partially-interned format. . let index = self.lo_or_index; . let data = with_span_interner(|interner| interner.spans[index as usize]); . data.lo == BytePos(0) && data.hi == BytePos(0) . } . } . -- line 342 ---------------------------------------- -- line 383 ---------------------------------------- . #[inline] . pub fn ctxt(self) -> SyntaxContext { . self.inline_ctxt() . .unwrap_or_else(|index| with_span_interner(|interner| interner.spans[index].ctxt)) . } . . #[inline] . pub fn eq_ctxt(self, other: Span) -> bool { 6 ( 0.00%) match (self.inline_ctxt(), other.inline_ctxt()) { . (Ok(ctxt1), Ok(ctxt2)) => ctxt1 == ctxt2, . // If `inline_ctxt` returns `Ok` the context is <= MAX_CTXT. . // If it returns `Err` the span is fully interned and the context is > MAX_CTXT. . // As these do not overlap an `Ok` and `Err` result cannot have an equal context. . (Ok(_), Err(_)) | (Err(_), Ok(_)) => false, . (Err(index1), Err(index2)) => with_span_interner(|interner| { . interner.spans[index1].ctxt == interner.spans[index2].ctxt . }), -- line 399 ---------------------------------------- 28,166,664 ( 0.14%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unnecessary_owned_empty_strings.rs -------------------------------------------------------------------------------- Ir -- line 31 ---------------------------------------- . "detects cases of references to owned empty strings being passed as an argument to a function expecting `&str`" . } . . declare_lint_pass!(UnnecessaryOwnedEmptyStrings => [ . UNNECESSARY_OWNED_EMPTY_STRINGS, . ]); . . impl<'tcx> LateLintPass<'tcx> for UnnecessaryOwnedEmptyStrings { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,446 ( 0.00%) if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner_expr) = expr.kind . && let ExprKind::Call(fun, args) = inner_expr.kind . && let ExprKind::Path(ref qpath) = fun.kind . && let Some(fun_def_id) = cx.qpath_res(qpath, fun.hir_id).opt_def_id() . && let ty::Ref(_, inner_str, _) = cx.typeck_results().expr_ty_adjusted(expr).kind() . && inner_str.is_str() . { . let fun_name = cx.tcx.get_diagnostic_name(fun_def_id); . if fun_name == Some(sym::string_new) { -- line 48 ---------------------------------------- -- line 69 ---------------------------------------- . expr.span, . "usage of `&String::from(\"\")` for a function expecting a `&str` argument", . "try", . "\"\"".to_owned(), . Applicability::MachineApplicable, . ); . } . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/non_octal_unix_permissions.rs -------------------------------------------------------------------------------- Ir -- line 34 ---------------------------------------- . pub NON_OCTAL_UNIX_PERMISSIONS, . correctness, . "use of non-octal value to set unix file permissions, which will be translated into octal" . } . . declare_lint_pass!(NonOctalUnixPermissions => [NON_OCTAL_UNIX_PERMISSIONS]); . . impl<'tcx> LateLintPass<'tcx> for NonOctalUnixPermissions { 1,572,892 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 1,966,113 ( 0.01%) match &expr.kind { 2 ( 0.00%) ExprKind::MethodCall(path, func, [param], _) => { . if let Some(adt) = cx.typeck_results().expr_ty(func).peel_refs().ty_adt_def() . && matches!( . (cx.tcx.get_diagnostic_name(adt.did()), path.ident.name), . (Some(sym::FsOpenOptions | sym::DirBuilder), sym::mode) . | (Some(sym::FsPermissions), sym::set_mode) . ) . && let ExprKind::Lit(_) = param.kind . && param.span.eq_ctxt(expr.span) . && param . .span . .check_text(cx, |src| !matches!(src.as_bytes(), [b'0', b'o' | b'b', ..])) . { . show_error(cx, param); . } . }, 2 ( 0.00%) ExprKind::Call(func, [param]) => { 4 ( 0.00%) if let ExprKind::Path(ref path) = func.kind 4 ( 0.00%) && let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id() 23 ( 0.00%) => ???:::qpath_res (1x) 5 ( 0.00%) && cx.tcx.is_diagnostic_item(sym::permissions_from_mode, def_id) 82 ( 0.00%) => ???:::is_diagnostic_item (1x) . && let ExprKind::Lit(_) = param.kind . && param.span.eq_ctxt(expr.span) . && param . .span . .check_text(cx, |src| !matches!(src.as_bytes(), [b'0', b'o' | b'b', ..])) . { . show_error(cx, param); . } . }, . _ => {}, . } 1,966,115 ( 0.01%) } . } . . fn show_error(cx: &LateContext<'_>, param: &Expr<'_>) { . let mut applicability = Applicability::MachineApplicable; . span_lint_and_sugg( . cx, . NON_OCTAL_UNIX_PERMISSIONS, . param.span, -- line 83 ---------------------------------------- 3 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/write/mod.rs -------------------------------------------------------------------------------- Ir -- line 251 ---------------------------------------- . format_args: FormatArgsStorage, . // The outermost `impl Debug` we're currently in. While we're in one, `USE_DEBUG` is deactivated . outermost_debug_impl: Option, . allow_print_in_tests: bool, . } . . impl Write { . pub fn new(conf: &'static Conf, format_args: FormatArgsStorage) -> Self { 3 ( 0.00%) Self { . format_args, . outermost_debug_impl: None, . allow_print_in_tests: conf.allow_print_in_tests, . } . } . . fn in_debug_impl(&self) -> bool { . self.outermost_debug_impl.is_some() . } . } . . impl<'tcx> LateLintPass<'tcx> for Write { . fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { . // Only check for `impl Debug`s if we're not already in one 8 ( 0.00%) if self.outermost_debug_impl.is_none() && is_debug_impl(cx, item) { . self.outermost_debug_impl = Some(item.owner_id); . } . } . . fn check_item_post(&mut self, _cx: &LateContext<'_>, item: &Item<'_>) { . // Only clear `self.outermost_debug_impl` if we're escaping the _outermost_ debug impl . if self.outermost_debug_impl == Some(item.owner_id) { . self.outermost_debug_impl = None; . } . } . 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 6 ( 0.00%) let Some(macro_call) = root_macro_call_first_node(cx, expr) else { . return; . }; 7 ( 0.00%) let Some(diag_name) = cx.tcx.get_diagnostic_name(macro_call.def_id) else { 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . return; . }; 2 ( 0.00%) let Some(name) = diag_name.as_str().strip_suffix("_macro") else { . return; . }; . . let is_build_script = cx . .sess() . .opts . .crate_name . .as_ref() . .is_some_and(|crate_name| crate_name == "build_script_build"); . 2 ( 0.00%) let allowed_in_tests = self.allow_print_in_tests && is_in_test(cx.tcx, expr.hir_id); . match diag_name { 10 ( 0.00%) sym::print_macro | sym::println_macro if !allowed_in_tests => { . if !is_build_script { . span_lint(cx, PRINT_STDOUT, macro_call.span, format!("use of `{name}!`")); . } . }, . sym::eprint_macro | sym::eprintln_macro if !allowed_in_tests => { . span_lint(cx, PRINT_STDERR, macro_call.span, format!("use of `{name}!`")); . }, . sym::write_macro | sym::writeln_macro => {}, -- line 314 ---------------------------------------- -- line 332 ---------------------------------------- . } . . literal::check(cx, format_args, name); . . if !self.in_debug_impl() { . use_debug::check(cx, format_args); . } . } 3,145,784 ( 0.02%) } . } . . fn is_debug_impl(cx: &LateContext<'_>, item: &Item<'_>) -> bool { 24 ( 0.00%) if let ItemKind::Impl(Impl { . of_trait: Some(of_trait), . .. . }) = &item.kind . && let Some(trait_id) = of_trait.trait_ref.trait_def_id() . { . cx.tcx.is_diagnostic_item(sym::Debug, trait_id) . } else { . false -- line 352 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/diagnostics.rs -------------------------------------------------------------------------------- Ir -- line 11 ---------------------------------------- . use rustc_errors::{Applicability, Diag, DiagCtxtHandle, DiagMessage, Diagnostic, Level, MultiSpan}; . #[cfg(debug_assertions)] . use rustc_errors::{EmissionGuarantee, SubstitutionPart, Suggestions}; . use rustc_hir::HirId; . use rustc_lint::{LateContext, Lint, LintContext}; . use rustc_span::Span; . use std::env; . 255 ( 0.00%) fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) { 102 ( 0.00%) if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() 204 ( 0.00%) && let Some(lint) = lint.name_lower().strip_prefix("clippy::") 6,681 ( 0.00%) => ???:::name_lower (51x) . { 306 ( 0.00%) diag.help(format!( . "for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{lint}", . match option_env!("CFG_RELEASE_CHANNEL") { . // Clippy version is 0.1.xx . // . // Always use .0 because we do not generate separate lint doc pages for rust patch releases . Some("stable") => concat!("rust-1.", env!("CARGO_PKG_VERSION_PATCH"), ".0"), . Some("beta") => "beta", 153 ( 0.00%) _ => "main", . } . )); . } 204 ( 0.00%) } . . /// Makes sure that a diagnostic is well formed. . /// . /// rustc debug asserts a few properties about spans, . /// but the clippy repo uses a distributed rustc build with debug assertions disabled, . /// so this has historically led to problems during subtree syncs where those debug assertions . /// only started triggered there. . /// -- line 43 ---------------------------------------- -- line 145 ---------------------------------------- . pub fn span_lint_and_help( . cx: &T, . lint: &'static Lint, . span: impl Into, . msg: impl Into, . help_span: Option, . help: impl Into, . ) { 561 ( 0.00%) span_lint_and_then(cx, lint, span, msg, |diag| { 9,783,761 ( 0.05%) => site/frontend/rust-clippy/clippy_utils/src/diagnostics.rs:clippy_utils::diagnostics::span_lint_and_then::::{closure#0}> (51x) 102 ( 0.00%) if let Some(help_span) = help_span { . diag.span_help(help_span, help.into()); . } else { . diag.help(help.into()); . } . }); . } . . /// Like [`span_lint`] but with a `note` section instead of a `help` message. -- line 162 ---------------------------------------- -- line 228 ---------------------------------------- . /// `LintPass::check_*` function, consider using [`span_lint_hir_and_then`] instead. . /// This is needed for `#[allow]` and `#[expect]` attributes to work on the node . /// highlighted in the displayed warning. . /// . /// If you're unsure which function you should use, you can test if the `#[expect]` attribute works . /// where you would expect it to. . /// If it doesn't, you likely need to use [`span_lint_hir_and_then`] instead. . #[track_caller] 827,372 ( 0.00%) pub fn span_lint_and_then(cx: &C, lint: &'static Lint, sp: S, msg: M, f: F) . where . C: LintContext, . S: Into, . M: Into, . F: FnOnce(&mut Diag<'_, ()>), . { . struct ClippyDiag)>(F); . . impl<'a, F: FnOnce(&mut Diag<'_, ()>)> Diagnostic<'a, ()> for ClippyDiag { 663 ( 0.00%) fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { . let mut lint = Diag::new(dcx, level, ""); . (self.0)(&mut lint); 204 ( 0.00%) lint 459 ( 0.00%) } . } . . let sp = sp.into(); . #[expect(clippy::disallowed_methods)] 59,200 ( 0.00%) cx.emit_span_lint( 9,761,732 ( 0.05%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lint/src/context.rs:::emit_span_lint::::{closure#0}>::{closure#0}>> (51x) . lint, . sp.clone(), 1,182,725 ( 0.01%) ClippyDiag(|diag: &mut Diag<'_, ()>| { 153 ( 0.00%) diag.primary_message(msg); 153 ( 0.00%) diag.span(sp); 2,193 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_errors/src/diagnostic.rs:>::span:: (51x) 153 ( 0.00%) f(diag); 204 ( 0.00%) docs_link(diag, lint); 167,609 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/diagnostics.rs:clippy_utils::diagnostics::docs_link (51x) . . #[cfg(debug_assertions)] . validate_diag(diag); . }), . ); 472,784 ( 0.00%) } . . /// Like [`span_lint`], but emits the lint at the node identified by the given `HirId`. . /// . /// This is in contrast to [`span_lint`], which always emits the lint at the node that was last . /// passed to the `LintPass::check_*` function. . /// . /// The `HirId` is used for checking lint level attributes and to fulfill lint expectations defined . /// via the `#[expect]` attribute. -- line 276 ---------------------------------------- 162 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs -------------------------------------------------------------------------------- Ir -- line 167 ---------------------------------------- . /// assert!(!s.is_empty()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_str_is_empty", since = "1.39.0")] . #[rustc_no_implicit_autorefs] . #[must_use] . #[inline] . pub const fn is_empty(&self) -> bool { 393,239 ( 0.00%) self.len() == 0 . } . . /// Converts a slice of bytes to a string slice. . /// . /// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice . /// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between . /// the two. Not all byte slices are valid string slices, however: [`&str`] requires . /// that it is valid UTF-8. `from_utf8()` checks to ensure that the bytes are valid -- line 183 ---------------------------------------- -- line 371 ---------------------------------------- . #[stable(feature = "is_char_boundary", since = "1.9.0")] . #[rustc_const_stable(feature = "const_is_char_boundary", since = "1.86.0")] . #[inline] . pub const fn is_char_boundary(&self, index: usize) -> bool { . // 0 is always ok. . // Test for 0 explicitly so that it can optimize out the check . // easily and skip reading string data for that case. . // Note that optimizing `self.get(..index)` relies on this. 393,232 ( 0.00%) if index == 0 { . return true; . } . 915,419 ( 0.00%) if index >= self.len() { . // For `true` we have two options: . // . // - index == self.len() . // Empty strings are valid, so return true . // - index > self.len() . // In this case return false . // . // The check is placed exactly here, because it improves generated -- line 391 ---------------------------------------- -- line 934 ---------------------------------------- . /// assert_eq!(None, s.split_at_checked(16)); // Beyond the string length . /// ``` . #[inline] . #[must_use] . #[stable(feature = "split_at_checked", since = "1.80.0")] . #[rustc_const_stable(feature = "const_str_split_at", since = "1.86.0")] . pub const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)> { . // is_char_boundary checks that the index is in [0, .len()] 64,495 ( 0.00%) if self.is_char_boundary(mid) { . // SAFETY: just checked that `mid` is on a char boundary. . Some(unsafe { self.split_at_unchecked(mid) }) . } else { . None . } . } . . /// Divides one mutable string slice into two at an index. -- line 950 ---------------------------------------- -- line 997 ---------------------------------------- . #[inline] . const unsafe fn split_at_unchecked(&self, mid: usize) -> (&str, &str) { . let len = self.len(); . let ptr = self.as_ptr(); . // SAFETY: caller guarantees `mid` is on a char boundary. . unsafe { . ( . from_utf8_unchecked(slice::from_raw_parts(ptr, mid)), 64,483 ( 0.00%) from_utf8_unchecked(slice::from_raw_parts(ptr.add(mid), len - mid)), . ) . } . } . . /// Divides one string slice into two at an index. . /// . /// # Safety . /// -- line 1013 ---------------------------------------- -- line 1489 ---------------------------------------- . /// let s = "Löwe 老虎 Léopard"; . /// let x: &[_] = &['1', '2']; . /// . /// assert_eq!(s.find(x), None); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . pub fn find(&self, pat: P) -> Option { 6 ( 0.00%) pat.into_searcher(self).next_match().map(|(i, _)| i) 513 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs:::next_match (2x) . } . . /// Returns the byte index for the first character of the last match of the pattern in . /// this string slice. . /// . /// Returns [`None`] if the pattern doesn't match. . /// . /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a -- line 1505 ---------------------------------------- -- line 1663 ---------------------------------------- . /// ``` . /// . /// Use [`split_whitespace`] for this behavior. . /// . /// [`split_whitespace`]: str::split_whitespace . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . pub fn split(&self, pat: P) -> Split<'_, P> { 1,744 ( 0.00%) Split(SplitInternal { . start: 0, . end: self.len(), . matcher: pat.into_searcher(self), . allow_trailing_empty: true, . finished: false, . }) . } . -- line 1679 ---------------------------------------- -- line 1762 ---------------------------------------- . /// assert_eq!(v, ["ghi", "def", "abc"]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . pub fn rsplit(&self, pat: P) -> RSplit<'_, P> . where . for<'a> P::Searcher<'a>: ReverseSearcher<'a>, . { 655,370 ( 0.00%) RSplit(self.split(pat).0) . } . . /// Returns an iterator over substrings of the given string slice, separated . /// by characters matched by a pattern. . /// . /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a . /// function or closure that determines if a character matches. . /// -- line 1778 ---------------------------------------- -- line 1978 ---------------------------------------- . /// assert_eq!("cfg".split_once('='), None); . /// assert_eq!("cfg=".split_once('='), Some(("cfg", ""))); . /// assert_eq!("cfg=foo".split_once('='), Some(("cfg", "foo"))); . /// assert_eq!("cfg=foo=bar".split_once('='), Some(("cfg", "foo=bar"))); . /// ``` . #[stable(feature = "str_split_once", since = "1.52.0")] . #[inline] . pub fn split_once(&self, delimiter: P) -> Option<(&'_ str, &'_ str)> { 99 ( 0.00%) let (start, end) = delimiter.into_searcher(self).next_match()?; 4,121 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/pattern.rs:::next_match (33x) . // SAFETY: `Searcher` is known to return valid indices. . unsafe { Some((self.get_unchecked(..start), self.get_unchecked(end..))) } . } . . /// Splits the string on the last occurrence of the specified delimiter and . /// returns prefix before delimiter and suffix after delimiter. . /// . /// # Examples -- line 1994 ---------------------------------------- -- line 2179 ---------------------------------------- . /// assert_eq!("Hello\tworld", s.trim()); . /// ``` . #[inline] . #[must_use = "this returns the trimmed string as a slice, \ . without modifying the original"] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "str_trim"] . pub fn trim(&self) -> &str { 786,525 ( 0.00%) self.trim_matches(char::is_whitespace) 6,291,664 ( 0.03%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:::trim_matches::<::is_whitespace> (393,229x) . } . . /// Returns a string slice with leading whitespace removed. . /// . /// 'Whitespace' is defined according to the terms of the Unicode Derived . /// Core Property `White_Space`, which includes newlines. . /// . /// # Text directionality -- line 2195 ---------------------------------------- -- line 2218 ---------------------------------------- . /// assert!(Some('ע') == s.trim_start().chars().next()); . /// ``` . #[inline] . #[must_use = "this returns the trimmed string as a new slice, \ . without modifying the original"] . #[stable(feature = "trim_direction", since = "1.30.0")] . #[rustc_diagnostic_item = "str_trim_start"] . pub fn trim_start(&self) -> &str { 326,608 ( 0.00%) self.trim_start_matches(char::is_whitespace) 29 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:::trim_start_matches::<::is_whitespace> (1x) . } . . /// Returns a string slice with trailing whitespace removed. . /// . /// 'Whitespace' is defined according to the terms of the Unicode Derived . /// Core Property `White_Space`, which includes newlines. . /// . /// # Text directionality -- line 2234 ---------------------------------------- -- line 2369 ---------------------------------------- . /// A more complex pattern, using a closure: . /// . /// ``` . /// assert_eq!("1foo1barXX".trim_matches(|c| c == '1' || c == 'X'), "foo1bar"); . /// ``` . #[must_use = "this returns the trimmed string as a new slice, \ . without modifying the original"] . #[stable(feature = "rust1", since = "1.0.0")] 1,179,786 ( 0.01%) pub fn trim_matches(&self, pat: P) -> &str . where . for<'a> P::Searcher<'a>: DoubleEndedSearcher<'a>, . { . let mut i = 0; . let mut j = 0; . let mut matcher = pat.into_searcher(self); . if let Some((a, b)) = matcher.next_reject() { . i = a; -- line 2385 ---------------------------------------- -- line 2386 ---------------------------------------- . j = b; // Remember earliest known match, correct it below if . // last match is different . } . if let Some((_, b)) = matcher.next_reject_back() { . j = b; . } . // SAFETY: `Searcher` is known to return valid indices. . unsafe { self.get_unchecked(i..j) } 1,179,786 ( 0.01%) } . . /// Returns a string slice with all prefixes that match a pattern . /// repeatedly removed. . /// . /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a . /// function or closure that determines if a character matches. . /// . /// [`char`]: prim@char -- line 2402 ---------------------------------------- -- line 2416 ---------------------------------------- . /// assert_eq!("123foo1bar123".trim_start_matches(char::is_numeric), "foo1bar123"); . /// . /// let x: &[_] = &['1', '2']; . /// assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12"); . /// ``` . #[must_use = "this returns the trimmed string as a new slice, \ . without modifying the original"] . #[stable(feature = "trim_direction", since = "1.30.0")] 653,216 ( 0.00%) pub fn trim_start_matches(&self, pat: P) -> &str { . let mut i = self.len(); . let mut matcher = pat.into_searcher(self); . if let Some((a, _)) = matcher.next_reject() { . i = a; . } . // SAFETY: `Searcher` is known to return valid indices. . unsafe { self.get_unchecked(i..self.len()) } 326,608 ( 0.00%) } . . /// Returns a string slice with the prefix removed. . /// . /// If the string starts with the pattern `prefix`, returns the substring after the prefix, . /// wrapped in `Some`. Unlike [`trim_start_matches`], this method removes the prefix exactly once. . /// . /// If the string does not start with `prefix`, returns `None`. . /// -- line 2440 ---------------------------------------- -- line 2774 ---------------------------------------- . /// ``` . /// let nope = "j".parse::(); . /// . /// assert!(nope.is_err()); . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . pub fn parse(&self) -> Result { 983,025 ( 0.00%) FromStr::from_str(self) 37,289,415 ( 0.18%) => ???:::from_str (196,605x) . } . . /// Checks if all characters in this string are within the ASCII range. . /// . /// An empty string returns `true`. . /// . /// # Examples . /// -- line 2790 ---------------------------------------- -- line 3316 ---------------------------------------- . unsafe { from_utf8_unchecked_mut(&mut []) } . } . } . . impl_fn_for_zst! { . /// A nameable, cloneable fn type . #[derive(Clone)] . struct LinesMap impl<'a> Fn = |line: &'a str| -> &'a str { 1 ( 0.00%) let Some(line) = line.strip_suffix('\n') else { return line }; . let Some(line) = line.strip_suffix('\r') else { return line }; . line . }; . . #[derive(Clone)] . struct CharEscapeDebugContinue impl Fn = |c: char| -> char::EscapeDebug { . c.escape_debug_ext(EscapeDebugExtArgs { . escape_grapheme_extender: false, -- line 3332 ---------------------------------------- 194,733 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/reserve_after_initialization.rs -------------------------------------------------------------------------------- Ir -- line 29 ---------------------------------------- . #[clippy::version = "1.74.0"] . pub RESERVE_AFTER_INITIALIZATION, . complexity, . "`reserve` called immediately after `Vec` creation" . } . . impl_lint_pass!(ReserveAfterInitialization => [RESERVE_AFTER_INITIALIZATION]); . 1 ( 0.00%) #[derive(Default)] . pub struct ReserveAfterInitialization { . searcher: Option, . } . . struct VecReserveSearcher { . local_id: HirId, . err_span: Span, . init_part: String, -- line 45 ---------------------------------------- -- line 62 ---------------------------------------- . s, . Applicability::HasPlaceholders, . ); . } . } . . impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization { . fn check_block(&mut self, _: &LateContext<'tcx>, _: &'tcx Block<'tcx>) { 2 ( 0.00%) self.searcher = None; . } . . fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) { . if let Some(init_expr) = local.init . && let PatKind::Binding(BindingMode::MUT, id, _, None) = local.pat.kind . && !local.span.in_external_macro(cx.sess().source_map()) . && let Some(init) = get_vec_init_kind(cx, init_expr) . && !matches!( -- line 78 ---------------------------------------- -- line 92 ---------------------------------------- . "..", . ) . .into_owned(), . space_hint: String::new(), . }); . } . } . 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if self.searcher.is_none() . && let ExprKind::Assign(left, right, _) = expr.kind . && let ExprKind::Path(QPath::Resolved(None, path)) = left.kind . && let Res::Local(id) = path.res . && !expr.span.in_external_macro(cx.sess().source_map()) . && let Some(init) = get_vec_init_kind(cx, right) . && !matches!( . init, . VecInitKind::WithExprCapacity(_) | VecInitKind::WithConstCapacity(_) -- line 109 ---------------------------------------- -- line 116 ---------------------------------------- . cx, . left.span.shrink_to_lo().to(right.span.source_callsite().shrink_to_lo()), . "..", . ) . .into_owned(), // see `assign_expression` test . space_hint: String::new(), . }); . } 3,145,784 ( 0.02%) } . 7 ( 0.00%) fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) { 2 ( 0.00%) if let Some(searcher) = self.searcher.take() { . if let StmtKind::Expr(expr) | StmtKind::Semi(expr) = stmt.kind . && let ExprKind::MethodCall(name, self_arg, [space_hint], _) = expr.kind . && self_arg.res_local_id() == Some(searcher.local_id) . && name.ident.name == sym::reserve . && !is_from_proc_macro(cx, expr) . { . self.searcher = Some(VecReserveSearcher { . err_span: searcher.err_span.to(stmt.span), . space_hint: snippet(cx, space_hint.span, "..").into_owned(), . ..searcher . }); . } else { . searcher.display_err(cx); . } . } 8 ( 0.00%) } . 8 ( 0.00%) fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx Block<'tcx>) { 4 ( 0.00%) if let Some(searcher) = self.searcher.take() { . searcher.display_err(cx); . } 8 ( 0.00%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/blocks_in_conditions.rs -------------------------------------------------------------------------------- Ir -- line 47 ---------------------------------------- . "useless or complex blocks that can be eliminated in conditions" . } . . declare_lint_pass!(BlocksInConditions => [BLOCKS_IN_CONDITIONS]); . . const BRACED_EXPR_MESSAGE: &str = "omit braces around single expression condition"; . . impl<'tcx> LateLintPass<'tcx> for BlocksInConditions { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . . let Some((cond, keyword, desc)) = higher::If::hir(expr) . .map(|hif| (hif.cond, "if", "an `if` condition")) . .or(if let ExprKind::Match(match_ex, _, MatchSource::Normal) = expr.kind { . Some((match_ex, "match", "a `match` scrutinee")) . } else { -- line 64 ---------------------------------------- -- line 129 ---------------------------------------- . "let res = {}; {keyword} res", . snippet_block_with_applicability(cx, block.span, "..", Some(expr.span), &mut applicability), . ), . applicability, . ); . } . } . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/regex.rs -------------------------------------------------------------------------------- Ir -- line 110 ---------------------------------------- . #[derive(Copy, Clone)] . enum RegexKind { . Unicode, . UnicodeSet, . Bytes, . BytesSet, . } . 7 ( 0.00%) #[derive(Default)] . pub struct Regex { . definitions: DefIdMap, . loop_stack: Vec<(OwnerId, Span)>, . } . . impl<'tcx> LateLintPass<'tcx> for Regex { 7 ( 0.00%) fn check_crate(&mut self, cx: &LateContext<'tcx>) { . let mut resolve = |path: &PathLookup, kind: RegexKind| { . for &id in path.get(cx) { . self.definitions.insert(id, kind); . } . }; . . resolve(&paths::REGEX_NEW, RegexKind::Unicode); . resolve(&paths::REGEX_BUILDER_NEW, RegexKind::Unicode); . resolve(&paths::REGEX_SET_NEW, RegexKind::UnicodeSet); . resolve(&paths::REGEX_BYTES_NEW, RegexKind::Bytes); . resolve(&paths::REGEX_BYTES_BUILDER_NEW, RegexKind::Bytes); . resolve(&paths::REGEX_BYTES_SET_NEW, RegexKind::BytesSet); 6 ( 0.00%) } . 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 3,145,785 ( 0.02%) if let ExprKind::Call(fun, [arg]) = expr.kind 1 ( 0.00%) && let Some(def_id) = fun.res(cx).opt_def_id() . && let Some(regex_kind) = self.definitions.get(&def_id) . { . if let Some(&(loop_item_id, loop_span)) = self.loop_stack.last() . && loop_item_id == fun.hir_id.owner . && (matches!(arg.kind, ExprKind::Lit(_)) || const_str(cx, arg).is_some()) . { . span_lint_and_help( . cx, -- line 150 ---------------------------------------- -- line 157 ---------------------------------------- . } . . match regex_kind { . RegexKind::Unicode => check_regex(cx, arg, true), . RegexKind::UnicodeSet => check_set(cx, arg, true), . RegexKind::Bytes => check_regex(cx, arg, false), . RegexKind::BytesSet => check_set(cx, arg, false), . } 786,446 ( 0.00%) } else if let ExprKind::Loop(block, _, _, span) = expr.kind { . self.loop_stack.push((block.hir_id.owner, span)); . } 3,145,784 ( 0.02%) } . . fn check_expr_post(&mut self, _: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 2,752,561 ( 0.01%) if matches!(expr.kind, ExprKind::Loop(..)) { . self.loop_stack.pop(); . } . } . } . . fn lint_syntax_error(cx: &LateContext<'_>, error: ®ex_syntax::Error, unescaped: &str, base: Span, offset: u8) { . let parts: Option<(_, _, &dyn Display)> = match &error { . regex_syntax::Error::Parse(e) => Some((e.span(), e.auxiliary_span(), e.kind())), -- line 179 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/mixed_read_write_in_expression.rs -------------------------------------------------------------------------------- Ir -- line 82 ---------------------------------------- . declare_lint_pass!(EvalOrderDependence => [ . DIVERGING_SUB_EXPRESSION, . MIXED_READ_WRITE_IN_EXPRESSION, . ]); . . impl<'tcx> LateLintPass<'tcx> for EvalOrderDependence { . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . // Find a write to a local variable. 1,572,892 ( 0.01%) let var = if let ExprKind::Assign(lhs, ..) | ExprKind::AssignOp(_, lhs, _) = expr.kind . && let Some(var) = lhs.res_local_id() . && expr.span.desugaring_kind().is_none() . { . var . } else { . return; . }; . let mut visitor = ReadVisitor { . cx, . var, . write_expr: expr, . last_expr: expr, . }; . check_for_unsequenced_reads(&mut visitor); 393,223 ( 0.00%) } . fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) { 4 ( 0.00%) match stmt.kind { . StmtKind::Let(local) => { . if let LetStmt { init: Some(e), .. } = local { . DivergenceVisitor { cx }.visit_expr(e); . } . }, 5 ( 0.00%) StmtKind::Expr(e) | StmtKind::Semi(e) => DivergenceVisitor { cx }.maybe_walk_expr(e), 15 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/mixed_read_write_in_expression.rs:::maybe_walk_expr (1x) . StmtKind::Item(..) => {}, . } . } . } . . struct DivergenceVisitor<'a, 'tcx> { . cx: &'a LateContext<'tcx>, . } . . impl<'tcx> DivergenceVisitor<'_, 'tcx> { 5 ( 0.00%) fn maybe_walk_expr(&mut self, e: &'tcx Expr<'_>) { 4 ( 0.00%) match e.kind { . ExprKind::Closure(..) | ExprKind::If(..) | ExprKind::Loop(..) => {}, . ExprKind::Match(e, arms, _) => { . self.visit_expr(e); . for arm in arms { . if let Some(if_expr) = arm.guard { . self.visit_expr(if_expr); . } . // make sure top level arm expressions aren't linted . self.maybe_walk_expr(arm.body); . } . }, . _ => walk_expr(self, e), . } 6 ( 0.00%) } . . fn report_diverging_sub_expr(&self, e: &Expr<'_>) { . if let Some(macro_call) = root_macro_call_first_node(self.cx, e) . && self.cx.tcx.is_diagnostic_item(sym::todo_macro, macro_call.def_id) . { . return; . } . span_lint(self.cx, DIVERGING_SUB_EXPRESSION, e.span, "sub-expression diverges"); -- line 147 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/disallowed_fields.rs -------------------------------------------------------------------------------- Ir -- line 59 ---------------------------------------- . impl_lint_pass!(DisallowedFields => [DISALLOWED_FIELDS]); . . pub struct DisallowedFields { . disallowed: DefIdMap<(&'static str, &'static DisallowedPath)>, . } . . impl DisallowedFields { . pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { 8 ( 0.00%) let (disallowed, _) = create_disallowed_map( 38 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_config/src/types.rs:clippy_config::types::create_disallowed_map::::new::{closure#0}> (1x) . tcx, . &conf.disallowed_fields, . PathNS::Field, . |def_kind| matches!(def_kind, DefKind::Field), . "field", . false, . ); 4 ( 0.00%) Self { disallowed } . } . } . . impl<'tcx> LateLintPass<'tcx> for DisallowedFields { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,966,111 ( 0.01%) let (id, span) = match &expr.kind { 22 ( 0.00%) ExprKind::Path(path) if let Res::Def(_, id) = cx.qpath_res(path, expr.hir_id) => (id, expr.span), 46 ( 0.00%) => ???:::qpath_res (2x) . ExprKind::Field(e, ident) => { . // Very round-about way to get the field `DefId` from the expr: first we get its . // parent `Ty`. Then we go through all its fields to find the one with the expected . // name and get the `DefId` from it. . if let Some(parent_ty) = cx.typeck_results().expr_ty_adjusted_opt(e) . && let Some(field_def_id) = get_field_def_id_by_name(parent_ty, ident.name) . { . (field_def_id, ident.span) -- line 90 ---------------------------------------- -- line 98 ---------------------------------------- . span_lint_and_then( . cx, . DISALLOWED_FIELDS, . span, . format!("use of a disallowed field `{path}`"), . disallowed_path.diag_amendment(span), . ); . } 2,359,338 ( 0.01%) } . . fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) { . let PatKind::Struct(struct_path, pat_fields, _) = pat.kind else { . return; . }; . match cx.typeck_results().qpath_res(&struct_path, pat.hir_id) { . Res::Def(DefKind::Struct, struct_def_id) => { . let adt_def = cx.tcx.adt_def(struct_def_id); -- line 114 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/functions/mod.rs -------------------------------------------------------------------------------- Ir -- line 493 ---------------------------------------- . RESULT_LARGE_ERR, . RESULT_UNIT_ERR, . TOO_MANY_ARGUMENTS, . TOO_MANY_LINES, . ]); . . impl EarlyLintPass for EarlyFunctions { . fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: visit::FnKind<'_>, _: Span, _: ast::NodeId) { 3 ( 0.00%) duplicate_underscore_argument::check(cx, fn_kind); 26 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/duplicate_underscore_argument.rs:clippy_lints::functions::duplicate_underscore_argument::check (1x) . } . } . . pub struct Functions { . too_many_arguments_threshold: u64, . too_many_lines_threshold: u64, . large_error_threshold: u64, . large_error_ignored: DefIdSet, -- line 509 ---------------------------------------- -- line 510 ---------------------------------------- . avoid_breaking_exported_api: bool, . /// A set of resolved `def_id` of traits that are configured to allow . /// function params renaming. . trait_ids: DefIdSet, . msrv: Msrv, . } . . impl Functions { 10 ( 0.00%) pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { 8 ( 0.00%) Self { 2 ( 0.00%) too_many_arguments_threshold: conf.too_many_arguments_threshold, . too_many_lines_threshold: conf.too_many_lines_threshold, 1 ( 0.00%) large_error_threshold: conf.large_error_threshold, . large_error_ignored: conf . .large_error_ignored . .iter() . .flat_map(|ignored_ty| lookup_path_str(tcx, PathNS::Type, ignored_ty)) . .collect(), 1 ( 0.00%) avoid_breaking_exported_api: conf.avoid_breaking_exported_api, . trait_ids: conf . .allow_renamed_params_for . .iter() . .flat_map(|p| lookup_path_str(tcx, PathNS::Type, p)) . .collect(), 2 ( 0.00%) msrv: conf.msrv.into(), . } 9 ( 0.00%) } . } . . impl<'tcx> LateLintPass<'tcx> for Functions { 12 ( 0.00%) fn check_fn( . &mut self, . cx: &LateContext<'tcx>, . kind: intravisit::FnKind<'tcx>, . decl: &'tcx hir::FnDecl<'_>, . body: &'tcx hir::Body<'_>, . span: Span, . def_id: LocalDefId, . ) { 1 ( 0.00%) let hir_id = cx.tcx.local_def_id_to_hir_id(def_id); 10 ( 0.00%) too_many_arguments::check_fn(cx, kind, decl, hir_id, def_id, self.too_many_arguments_threshold); 4 ( 0.00%) too_many_lines::check_fn(cx, kind, body, span, def_id, self.too_many_lines_threshold); . not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id); 13 ( 0.00%) misnamed_getters::check_fn(cx, kind, decl, body, span); 17 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/misnamed_getters.rs:clippy_lints::functions::misnamed_getters::check_fn (1x) 1 ( 0.00%) impl_trait_in_params::check_fn(cx, &kind, body, hir_id); 13 ( 0.00%) ref_option::check_fn( 1,063 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/ref_option.rs:clippy_lints::functions::ref_option::check_fn (1x) . cx, . kind, . decl, . span, . hir_id, . def_id, . body, 2 ( 0.00%) self.avoid_breaking_exported_api, . ); 7 ( 0.00%) } . . fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { 12 ( 0.00%) must_use::check_item(cx, item); 737 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/must_use.rs:clippy_lints::functions::must_use::check_item (4x) 12 ( 0.00%) result::check_item( 231 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/result.rs:clippy_lints::functions::result::check_item (4x) . cx, . item, 4 ( 0.00%) self.large_error_threshold, 4 ( 0.00%) &self.large_error_ignored, 4 ( 0.00%) self.msrv, . ); . } . . fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) { . must_use::check_impl_item(cx, item); . result::check_impl_item( . cx, . item, -- line 582 ---------------------------------------- -- line 599 ---------------------------------------- . &self.large_error_ignored, . self.msrv, . ); . impl_trait_in_params::check_trait_item(cx, item, self.avoid_breaking_exported_api); . ref_option::check_trait_item(cx, item, self.avoid_breaking_exported_api); . } . . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { 1,966,115 ( 0.01%) result::check_expr(cx, expr, self.large_error_threshold, &self.large_error_ignored); 6,684,791 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/functions/result.rs:clippy_lints::functions::result::check_expr (393,223x) . } . } 16 ( 0.00%) -------------------------------------------------------------------------------- The following files chosen for auto-annotation could not be found: -------------------------------------------------------------------------------- /rust/deps/smallvec-1.15.1/src/lib.rs /rust/deps/thin-vec-0.2.19/src/lib.rs /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/jemalloc.c /rustc/84b36a78a28a63f134171c670be1932ffa2485f8/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/build/tikv-jemalloc-sys/80122c672fbe49ef/out/build/src/tcache.c include/jemalloc/internal/arena_inlines_b.h include/jemalloc/internal/atomic.h include/jemalloc/internal/bit_util.h include/jemalloc/internal/bitmap.h include/jemalloc/internal/cache_bin.h include/jemalloc/internal/div.h include/jemalloc/internal/edata.h include/jemalloc/internal/emap.h include/jemalloc/internal/fb.h include/jemalloc/internal/jemalloc_internal_inlines_a.h include/jemalloc/internal/jemalloc_internal_inlines_c.h include/jemalloc/internal/ph.h include/jemalloc/internal/rtree.h include/jemalloc/internal/sz.h include/jemalloc/internal/tcache_inlines.h include/jemalloc/internal/thread_event.h include/jemalloc/internal/tsd.h include/jemalloc/internal/tsd_tls.h include/jemalloc/internal/util.h src/arena.c src/base.c src/eset.c src/extent.c src/hook.c -------------------------------------------------------------------------------- Ir -------------------------------------------------------------------------------- 4,226,028,916 (20.79%) events annotated

(&mut self, mut predicate: P) -> Option where . Self: Sized, . P: FnMut(Self::Item) -> bool, . { . let n = len!(self); . let mut i = 0; . while let Some(x) = self.next() { 152 ( 0.00%) if predicate(x) { . // SAFETY: we are guaranteed to be in bounds by the loop invariant: . // when `i >= n`, `self.next()` returns `None` and the loop breaks. . unsafe { assert_unchecked(i < n) }; . return Some(i); . } 110 ( 0.00%) i += 1; . } . None . } . . // We override the default implementation, which uses `try_fold`, . // because this simple implementation generates less LLVM IR and is . // faster to compile. Also, the `assume` avoids a bounds check. . #[inline] -- line 393 ---------------------------------------- 12,833,092 ( 0.06%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/repeat_vec_with_capacity.rs -------------------------------------------------------------------------------- Ir -- line 72 ---------------------------------------- . diag.note(note); . diag.span_suggestion_verbose(span, sugg_msg, sugg, Applicability::MaybeIncorrect); . }, . ); . } . . /// Checks `vec![Vec::with_capacity(x); n]` . fn check_vec_macro(cx: &LateContext<'_>, expr: &Expr<'_>) { 1,179,669 ( 0.01%) if let Some(VecArgs::Repeat(repeat_expr, len_expr)) = VecArgs::hir(cx, expr) 6,684,959 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) . && matching_root_macro_call(cx, expr.span, sym::vec_macro).is_some() . && fn_def_id(cx, repeat_expr).is_some_and(|did| cx.tcx.is_diagnostic_item(sym::vec_with_capacity, did)) . && !len_expr.span.from_expansion() . && let Some(Constant::Int(2..)) = ConstEvalCtxt::new(cx).eval(expr_or_init(cx, len_expr)) . { . emit_lint( . cx, . expr.span.source_callsite(), -- line 88 ---------------------------------------- -- line 95 ---------------------------------------- . snippet(cx, repeat_expr.span, "..") . ), . ); . } . } . . /// Checks `iter::repeat(Vec::with_capacity(x))` . fn check_repeat_fn(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: Msrv) { 786,446 ( 0.00%) if !expr.span.from_expansion() 1,179,662 ( 0.01%) && fn_def_id(cx, expr).is_some_and(|did| cx.tcx.is_diagnostic_item(sym::iter_repeat, did)) 13,762,737 ( 0.07%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::fn_def_id (393,218x) 100 ( 0.00%) => ???:::is_diagnostic_item (1x) . && let ExprKind::Call(_, [repeat_expr]) = expr.kind . && fn_def_id(cx, repeat_expr).is_some_and(|did| cx.tcx.is_diagnostic_item(sym::vec_with_capacity, did)) . && !repeat_expr.span.from_expansion() . && let Some(exec_context) = std_or_core(cx) . && msrv.meets(cx, msrvs::REPEAT_WITH) . { . emit_lint( . cx, -- line 112 ---------------------------------------- -- line 118 ---------------------------------------- . "{exec_context}::iter::repeat_with(|| {})", . snippet(cx, repeat_expr.span, "..") . ), . ); . } . } . . impl LateLintPass<'_> for RepeatVecWithCapacity { 4,325,453 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { . check_vec_macro(cx, expr); 393,223 ( 0.00%) check_repeat_fn(cx, expr, self.msrv); 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_lint/src/context.rs -------------------------------------------------------------------------------- Ir -- line 523 ---------------------------------------- . lint: &'static Lint, . span: Option, . decorate: impl for<'a> Diagnostic<'a, ()>, . ); . . /// Emit a lint at `span` from a lint struct (some type that implements `Diagnostic`, . /// typically generated by `#[derive(Diagnostic)]`). . #[track_caller] 590,929 ( 0.00%) fn emit_span_lint>( . &self, . lint: &'static Lint, . span: S, . decorator: impl for<'a> Diagnostic<'a, ()>, . ) { . self.opt_span_lint(lint, Some(span), decorator); 413,686 ( 0.00%) } . . /// This returns the lint level spec for the given lint at the current location. . fn get_lint_level_spec(&self, lint: &'static Lint) -> LevelSpec; . . /// This function can be used to manually fulfill an expectation. This can . /// be used for lints which contain several spans, and should be suppressed, . /// if either location was marked with an expectation. . /// -- line 546 ---------------------------------------- -- line 584 ---------------------------------------- . } . } . . impl<'tcx> LintContext for LateContext<'tcx> { . type LintExpectationId = StableLintExpectationId; . . /// Gets the overall compiler `Session` object. . fn sess(&self) -> &Session { 5,111,952 ( 0.03%) self.tcx.sess . } . . fn opt_span_lint>( . &self, . lint: &'static Lint, . span: Option, . decorate: impl for<'a> Diagnostic<'a, ()>, . ) { 102 ( 0.00%) let hir_id = self.last_node_with_lint_attrs; . 102 ( 0.00%) match span { 357 ( 0.00%) Some(s) => self.tcx.emit_node_span_lint(lint, hir_id, s, decorate), . None => self.tcx.emit_node_lint(lint, hir_id, decorate), . } . } . . fn get_lint_level_spec(&self, lint: &'static Lint) -> StableLevelSpec { . self.tcx.lint_level_spec_at_node(lint, self.last_node_with_lint_attrs) . } . } -- line 612 ---------------------------------------- -- line 660 ---------------------------------------- . } . . /// Gets the type-checking results for the current body. . /// As this will ICE if called outside bodies, only call when working with . /// `Expr` or `Pat` nodes (they are guaranteed to be found only in bodies). . #[inline] . #[track_caller] . pub fn typeck_results(&self) -> &'tcx ty::TypeckResults<'tcx> { 1,376,288 ( 0.01%) self.typeck_results.expect("`LateContext::typeck_results` called outside of body") . } . . /// Returns the final resolution of a `QPath`, or `Res::Err` if unavailable. . /// Unlike `.typeck_results().qpath_res(qpath, id)`, this can be used even outside . /// bodies (e.g. for paths in `hir::Ty`), without any risk of ICE-ing. . pub fn qpath_res(&self, qpath: &hir::QPath<'_>, id: hir::HirId) -> Res { . match *qpath { . hir::QPath::Resolved(_, path) => path.res, -- line 676 ---------------------------------------- -- line 949 ---------------------------------------- . fn data_layout(&self) -> &abi::TargetDataLayout { . &self.tcx.data_layout . } . } . . impl<'tcx> ty::layout::HasTyCtxt<'tcx> for LateContext<'tcx> { . #[inline] . fn tcx(&self) -> TyCtxt<'tcx> { 3 ( 0.00%) self.tcx . } . } . . impl<'tcx> ty::layout::HasTypingEnv<'tcx> for LateContext<'tcx> { . #[inline] . fn typing_env(&self) -> ty::TypingEnv<'tcx> { . self.typing_env() . } -- line 965 ---------------------------------------- 393,484 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/needless_borrows_for_generic_args.rs -------------------------------------------------------------------------------- Ir -- line 67 ---------------------------------------- . /// be moved. . possible_borrowers: Vec<(LocalDefId, PossibleBorrowerMap<'tcx, 'tcx>)>, . . // `IntoIterator` for arrays requires Rust 1.53. . msrv: Msrv, . } . impl NeedlessBorrowsForGenericArgs<'_> { . pub fn new(conf: &'static Conf) -> Self { 4 ( 0.00%) Self { . possible_borrowers: Vec::new(), . msrv: conf.msrv.into(), . } . } . } . . impl<'tcx> LateLintPass<'tcx> for NeedlessBorrowsForGenericArgs<'tcx> { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if matches!(expr.kind, ExprKind::AddrOf(..)) . && !expr.span.from_expansion() . && let use_site = get_expr_use_site(cx.tcx, cx.typeck_results(), SyntaxContext::root(), expr) . && use_site.same_ctxt . && !use_site.is_ty_unified . && let use_node = use_site.use_node(cx) . && let Some(DefinedTy::Mir { def_site_def_id: _, ty }) = use_node.defined_ty(cx) . && let ty::Param(param_ty) = *ty.skip_binder().kind() . && let Some((hir_id, fn_id, i)) = match use_node { -- line 92 ---------------------------------------- -- line 128 ---------------------------------------- . |diag| { . let mut app = Applicability::MachineApplicable; . let snip_span = peel_n_hir_expr_refs(expr, count).0.span; . let snip = snippet_with_context(cx, snip_span, expr.span.ctxt(), "..", &mut app).0; . diag.span_suggestion(expr.span, "change this to", snip.into_owned(), app); . }, . ); . } 3,145,784 ( 0.02%) } . 21 ( 0.00%) fn check_body_post(&mut self, cx: &LateContext<'tcx>, body: &Body<'_>) { . if self . .possible_borrowers . .last() . .is_some_and(|&(local_def_id, _)| local_def_id == cx.tcx.hir_body_owner_def_id(body.id())) . { . self.possible_borrowers.pop(); . } 24 ( 0.00%) } . } . . fn path_has_args(p: &QPath<'_>) -> bool { . match *p { . QPath::Resolved(_, Path { segments: [.., s], .. }) | QPath::TypeRelative(_, s) => s.args.is_some(), . QPath::Resolved(..) => false, . } . } -- line 154 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_ignore_case_cmp.rs -------------------------------------------------------------------------------- Ir -- line 41 ---------------------------------------- . . declare_lint_pass!(ManualIgnoreCaseCmp => [MANUAL_IGNORE_CASE_CMP]); . . enum MatchType<'a> { . ToAscii(bool, Ty<'a>), . Literal(LitKind), . } . 8 ( 0.00%) fn get_ascii_type<'a>(cx: &LateContext<'a>, kind: rustc_hir::ExprKind<'_>) -> Option<(Span, MatchType<'a>)> { 7 ( 0.00%) if let MethodCall(path, expr, _, _) = kind { 1 ( 0.00%) let is_lower = match path.ident.name { 4 ( 0.00%) sym::to_ascii_lowercase => true, . sym::to_ascii_uppercase => false, . _ => return None, . }; . let ty_raw = cx.typeck_results().expr_ty(expr); . let ty = ty_raw.peel_refs(); . if needs_ref_to_cmp(cx, ty) . || ty.is_str() . || ty.is_slice() -- line 60 ---------------------------------------- -- line 61 ---------------------------------------- . || matches!(ty.opt_diag_name(cx), Some(sym::OsStr | sym::OsString)) . { . return Some((expr.span, ToAscii(is_lower, ty_raw))); . } . } else if let Lit(expr) = kind { . return Some((expr.span, Literal(expr.node))); . } . None 8 ( 0.00%) } . . /// Returns true if the type needs to be dereferenced to be compared . fn needs_ref_to_cmp(cx: &LateContext<'_>, ty: Ty<'_>) -> bool { . ty.is_char() . || *ty.kind() == ty::Uint(UintTy::U8) . || ty.is_diag_item(cx, sym::Vec) . || ty.is_lang_item(cx, LangItem::String) . } . . impl LateLintPass<'_> for ManualIgnoreCaseCmp { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) { . // check if expression represents a comparison of two strings . // using .to_ascii_lowercase() or .to_ascii_uppercase() methods, . // or one of the sides is a literal . // Offer to replace it with .eq_ignore_ascii_case() method 786,446 ( 0.00%) if let Binary(op, left, right) = &expr.kind 1 ( 0.00%) && (op.node == BinOpKind::Eq || op.node == BinOpKind::Ne) 17 ( 0.00%) && let Some((left_span, left_val)) = get_ascii_type(cx, left.kind) 32 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/manual_ignore_case_cmp.rs:clippy_lints::manual_ignore_case_cmp::get_ascii_type (1x) . && let Some((right_span, right_val)) = get_ascii_type(cx, right.kind) . && match (&left_val, &right_val) { . (ToAscii(l_lower, ..), ToAscii(r_lower, ..)) if l_lower == r_lower => true, . (ToAscii(..), Literal(..)) | (Literal(..), ToAscii(..)) => true, . _ => false, . } . { . let deref = match right_val { -- line 95 ---------------------------------------- -- line 117 ---------------------------------------- . expr.span, . "consider using `.eq_ignore_ascii_case()` instead", . format!("{neg}{left_snip}.eq_ignore_ascii_case({deref}{right_snip})"), . app, . ); . }, . ); . } 3,145,784 ( 0.02%) } . } 6 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/attrs/mod.rs -------------------------------------------------------------------------------- Ir -- line 506 ---------------------------------------- . . impl Attributes { . pub fn new(conf: &'static Conf) -> Self { . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for Attributes { 36 ( 0.00%) fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) { 20 ( 0.00%) let attrs = cx.tcx.hir_attrs(item.hir_id()); 218 ( 0.00%) => ???:::hir_attrs (4x) 11 ( 0.00%) if let ItemKind::Fn { ident, body, .. } = item.kind { 7 ( 0.00%) inline_always::check(cx, item.span, ident.name, attrs, Some(body)); 23 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/attrs/inline_always.rs:clippy_lints::attrs::inline_always::check (1x) . } 3 ( 0.00%) repr_attributes::check(cx, item.span, attrs, self.msrv); 28 ( 0.00%) } . . fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) { . if let ImplItemKind::Fn(_, body) = item.kind { . inline_always::check( . cx, . item.span, . item.ident.name, . cx.tcx.hir_attrs(item.hir_id()), -- line 528 ---------------------------------------- -- line 543 ---------------------------------------- . } . . pub struct EarlyAttributes { . msrv: MsrvStack, . } . . impl EarlyAttributes { . pub fn new(conf: &'static Conf) -> Self { 1 ( 0.00%) Self { msrv: conf.msrv.into() } . } . } . . impl EarlyLintPass for EarlyAttributes { . fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) { . deprecated_cfg_attr::check(cx, attr, &self.msrv); . deprecated_cfg_attr::check_clippy(cx, attr); . non_minimal_cfg::check(cx, attr); -- line 559 ---------------------------------------- -- line 563 ---------------------------------------- . } . . pub struct PostExpansionEarlyAttributes { . msrv: MsrvStack, . } . . impl PostExpansionEarlyAttributes { . pub fn new(conf: &'static Conf) -> Self { 1 ( 0.00%) Self { msrv: conf.msrv.into() } . } . } . . impl EarlyLintPass for PostExpansionEarlyAttributes { . fn check_crate(&mut self, cx: &EarlyContext<'_>, _krate: &ast::Crate) { . blanket_clippy_restriction_lints::check_command_line(cx); . } . 10 ( 0.00%) fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) { 3 ( 0.00%) check_clippy_attr(cx.sess(), attr); 89 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/attrs.rs:clippy_utils::attrs::check_clippy_attr:: (1x) 5 ( 0.00%) if let Some(items) = &attr.meta_item_list() 7 ( 0.00%) => ???:::meta_item_list (1x) . && let Some(name) = attr.name() . { . if matches!(name, sym::allow) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) { . allow_attributes::check(cx, attr); . } . if matches!(name, sym::allow | sym::expect) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) { . allow_attributes_without_reason::check(cx, name, items, attr); . } -- line 590 ---------------------------------------- -- line 603 ---------------------------------------- . } . } . } . . if attr.has_name(sym::should_panic) { . should_panic_without_expect::check(cx, attr); . } . 1 ( 0.00%) if attr.has_name(sym::ignore) . && let AttrKind::Normal(normal_attr) = &attr.kind . && !matches!(normal_attr.item.args, AttrArgs::Eq { .. }) . { . span_lint_and_help( . cx, . IGNORE_WITHOUT_REASON, . attr.span, . "`#[ignore]` without reason", . None, . "add a reason with `= \"..\"`", . ); . } 8 ( 0.00%) } . . fn check_item(&mut self, cx: &EarlyContext<'_>, item: &'_ ast::Item) { 12 ( 0.00%) match item.kind { 6 ( 0.00%) ast::ItemKind::ExternCrate(..) | ast::ItemKind::Use(..) => useless_attribute::check(cx, item, &item.attrs), 103 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/attrs/useless_attribute.rs:clippy_lints::attrs::useless_attribute::check (2x) . _ => {}, . } . 20 ( 0.00%) mixed_attributes_style::check(cx, item.span, &item.attrs); 756 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/attrs/mixed_attributes_style.rs:clippy_lints::attrs::mixed_attributes_style::check (4x) . } . 3,932,280 ( 0.02%) fn check_attributes(&mut self, cx: &EarlyContext<'_>, attrs: &[Attribute]) { 1,179,684 ( 0.01%) self.msrv.check_attributes(attrs); 1,179,719 ( 0.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes (393,228x) . duplicated_attributes::check(cx, attrs); 786,456 ( 0.00%) msrvs::check_attrs(cx.sess(), attrs); 7,078,132 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/msrvs.rs:clippy_utils::msrvs::check_attrs:: (393,228x) 3,145,824 ( 0.02%) } . . fn check_attributes_post(&mut self, _cx: &EarlyContext<'_>, attrs: &[Attribute]) { 1,572,912 ( 0.01%) self.msrv.check_attributes_post(attrs); 1,179,719 ( 0.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:::check_attributes_post (393,228x) . } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_pop_if.rs -------------------------------------------------------------------------------- Ir -- line 63 ---------------------------------------- . msrv: Msrv, . binary_heap_pop_if_feature_enabled: bool, . } . . impl ManualPopIf { . pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self { . Self { . msrv: conf.msrv.into(), 6 ( 0.00%) binary_heap_pop_if_feature_enabled: tcx.features().enabled(sym::binary_heap_pop_if), 40 ( 0.00%) => ???:::features (1x) 4 ( 0.00%) => ???:::enabled (1x) . } . } . . fn msrv_compatible(&self, cx: &LateContext<'_>, kind: ManualPopIfKind) -> bool { 4 ( 0.00%) match kind { . ManualPopIfKind::Vec => self.msrv.meets(cx, msrvs::VEC_POP_IF), . ManualPopIfKind::VecDequeBack => self.msrv.meets(cx, msrvs::VEC_DEQUE_POP_BACK_IF), . ManualPopIfKind::VecDequeFront => self.msrv.meets(cx, msrvs::VEC_DEQUE_POP_FRONT_IF), . ManualPopIfKind::BinaryHeap => self.binary_heap_pop_if_feature_enabled, . } . } . } . -- line 84 ---------------------------------------- -- line 199 ---------------------------------------- . cond: &'tcx Expr<'_>, . then_block: &'tcx Expr<'_>, . if_expr_span: Span, . kind: ManualPopIfKind, . ) -> Option> { . let peek_method = kind.peek_method(); . let pop_method = kind.pop_method(); . 8 ( 0.00%) if let ExprKind::MethodCall(path, receiver, [closure_arg], _) = cond.kind . && path.ident.name == sym::is_some_and . && let ExprKind::MethodCall(check_path, collection_expr, [], _) = receiver.kind . && check_path.ident.name == peek_method . && kind.is_diag_item(cx, collection_expr) . && let ExprKind::Closure(closure) = closure_arg.kind . && let body = cx.tcx.hir_body(closure.body) . && let Some((pop_collection, pop_span, suggestable)) = check_pop_unwrap(cx, then_block, pop_method) . && eq_expr_value(cx, if_expr_span.ctxt(), collection_expr, pop_collection) -- line 215 ---------------------------------------- -- line 243 ---------------------------------------- . cond: &'tcx Expr<'_>, . then_block: &'tcx Expr<'_>, . if_expr_span: Span, . kind: ManualPopIfKind, . ) -> Option> { . let peek_method = kind.peek_method(); . let pop_method = kind.pop_method(); . 8 ( 0.00%) if let ExprKind::Let(let_expr) = cond.kind . && let PatKind::TupleStruct(qpath, [binding_pat], _) = let_expr.pat.kind . { . let res = cx.qpath_res(&qpath, let_expr.pat.hir_id); . . if let Some(def_id) = res.opt_def_id() . && is_lang_item_or_ctor(cx, def_id, LangItem::OptionSome) . && let PatKind::Binding(_, binding_id, binding_name, _) = binding_pat.kind . && let ExprKind::MethodCall(path, collection_expr, [], _) = let_expr.init.kind -- line 259 ---------------------------------------- -- line 307 ---------------------------------------- . cond: &'tcx Expr<'_>, . then_block: &'tcx Expr<'_>, . if_expr_span: Span, . kind: ManualPopIfKind, . ) -> Option> { . let peek_method = kind.peek_method(); . let pop_method = kind.pop_method(); . 8 ( 0.00%) if let ExprKind::Binary(op, left, right) = cond.kind . && op.node == rustc_ast::BinOpKind::And . && let ExprKind::Let(let_expr) = left.kind . && let PatKind::TupleStruct(qpath, [binding_pat], _) = let_expr.pat.kind . { . let res = cx.qpath_res(&qpath, let_expr.pat.hir_id); . . if let Some(def_id) = res.opt_def_id() . && is_lang_item_or_ctor(cx, def_id, LangItem::OptionSome) -- line 323 ---------------------------------------- -- line 355 ---------------------------------------- . cond: &'tcx Expr<'_>, . then_block: &'tcx Expr<'_>, . if_expr_span: Span, . kind: ManualPopIfKind, . ) -> Option> { . let peek_method = kind.peek_method(); . let pop_method = kind.pop_method(); . 8 ( 0.00%) if let ExprKind::MethodCall(unwrap_path, receiver, [default_arg], _) = cond.kind . && unwrap_path.ident.name == sym::unwrap_or . && matches!(default_arg.kind, ExprKind::Lit(lit) if matches!(lit.node, LitKind::Bool(false))) . && let ExprKind::MethodCall(map_path, map_receiver, [closure_arg], _) = receiver.kind . && map_path.ident.name == sym::map . && let ExprKind::MethodCall(check_path, collection_expr, [], _) = map_receiver.kind . && check_path.ident.name == peek_method . && kind.is_diag_item(cx, collection_expr) . && let ExprKind::Closure(closure) = closure_arg.kind -- line 371 ---------------------------------------- -- line 455 ---------------------------------------- . ControlFlow::Break((collection_expr, span, false)) . } else { . ControlFlow::Continue(()) . } . }) . } . . impl<'tcx> LateLintPass<'tcx> for ManualPopIf { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,451 ( 0.00%) let ExprKind::If(cond, then_block, None) = expr.kind else { . return; . }; . 5 ( 0.00%) let in_else_clause = is_else_clause(cx.tcx, expr); 162 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_else_clause (1x) . 26 ( 0.00%) for kind in [ . ManualPopIfKind::Vec, . ManualPopIfKind::VecDequeBack, . ManualPopIfKind::VecDequeFront, . ManualPopIfKind::BinaryHeap, . ] { . if let Some(mut pattern) = check_is_some_and_pattern(cx, cond, then_block, expr.span, kind) . .or_else(|| check_if_let_pattern(cx, cond, then_block, expr.span, kind)) . .or_else(|| check_let_chain_pattern(cx, cond, then_block, expr.span, kind)) -- line 478 ---------------------------------------- -- line 482 ---------------------------------------- . if in_else_clause { . pattern.suggestable = false; . } . . pattern.emit_lint(cx); . return; . } . } 3,145,784 ( 0.02%) } . } 3 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/swap_ptr_to_ref.rs -------------------------------------------------------------------------------- Ir -- line 35 ---------------------------------------- . pub SWAP_PTR_TO_REF, . suspicious, . "call to `mem::swap` using pointer derived references" . } . . declare_lint_pass!(SwapPtrToRef => [SWAP_PTR_TO_REF]); . . impl LateLintPass<'_> for SwapPtrToRef { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'_>, e: &Expr<'_>) { 786,448 ( 0.00%) if let ExprKind::Call(fn_expr, [arg1, arg2]) = e.kind . && fn_expr.basic_res().is_diag_item(cx, sym::mem_swap) . && let ctxt = e.span.ctxt() . && let (from_ptr1, arg1_span) = is_ptr_to_ref(cx, arg1, ctxt) . && let (from_ptr2, arg2_span) = is_ptr_to_ref(cx, arg2, ctxt) . && (from_ptr1 || from_ptr2) . { . span_lint_and_then( . cx, -- line 52 ---------------------------------------- -- line 63 ---------------------------------------- . "use ptr::swap", . format!("core::ptr::swap({snip1}, {snip2})"), . app, . ); . } . }, . ); . } 3,145,784 ( 0.02%) } . } . . /// Checks if the expression converts a mutable pointer to a mutable reference. If it is, also . /// returns the span of the pointer expression if it's suitable for making a suggestion. . fn is_ptr_to_ref(cx: &LateContext<'_>, e: &Expr<'_>, ctxt: SyntaxContext) -> (bool, Option) { . if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, borrowed_expr) = e.kind . && let ExprKind::Unary(UnOp::Deref, derefed_expr) = borrowed_expr.kind . && cx.typeck_results().expr_ty(derefed_expr).is_raw_ptr() -- line 79 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/utils/author.rs -------------------------------------------------------------------------------- Ir -- line 96 ---------------------------------------- . } else { . println!(" && {}", format_args!($($t)*)); . } . } . } . . impl<'tcx> LateLintPass<'tcx> for Author { . fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { 8 ( 0.00%) check_item(cx, item.hir_id()); 784 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/utils/author.rs:clippy_lints::utils::author::check_item (4x) . } . . fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) { . check_item(cx, item.hir_id()); . } . . fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) { . check_item(cx, item.hir_id()); -- line 112 ---------------------------------------- -- line 113 ---------------------------------------- . } . . fn check_arm(&mut self, cx: &LateContext<'tcx>, arm: &'tcx hir::Arm<'_>) { . check_node(cx, arm.hir_id, |v| { . v.arm(&v.bind("arm", arm)); . }); . } . 3,539,007 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 786,446 ( 0.00%) check_node(cx, expr.hir_id, |v| { . v.expr(&v.bind("expr", expr)); . }); 3,145,784 ( 0.02%) } . 9 ( 0.00%) fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) { 6 ( 0.00%) match stmt.kind { 4 ( 0.00%) StmtKind::Expr(e) | StmtKind::Semi(e) if has_attr(cx, e.hir_id) => return, . _ => {}, . } 2 ( 0.00%) check_node(cx, stmt.hir_id, |v| { . v.stmt(&v.bind("stmt", stmt)); . }); 8 ( 0.00%) } . } . 36 ( 0.00%) fn check_item(cx: &LateContext<'_>, hir_id: HirId) { 20 ( 0.00%) if let Some(body) = cx.tcx.hir_maybe_body_owned_by(hir_id.expect_owner().def_id) { 578 ( 0.00%) => ???:::hir_maybe_body_owned_by (4x) . check_node_with_body( . cx, . hir_id, 2 ( 0.00%) |v| { . v.expr(&v.bind("expr", body.value)); . }, . Some(body), . ); . } 32 ( 0.00%) } . . fn check_node(cx: &LateContext<'_>, hir_id: HirId, f: impl Fn(&PrintVisitor<'_, '_>)) { . check_node_with_body(cx, hir_id, f, None); . } . . /// Check the node at `hir_id`, in the context of `body` or the default from `cx` if none is given. . fn check_node_with_body( . cx: &LateContext<'_>, . hir_id: HirId, . f: impl Fn(&PrintVisitor<'_, '_>), . body: Option<&Body<'_>>, . ) { 393,223 ( 0.00%) if has_attr(cx, hir_id) { . let typeck_results = body.map_or_else(|| cx.typeck_results(), |body| cx.tcx.typeck_body(body.id())); . f(&PrintVisitor::new(cx, typeck_results)); . println!("{{"); . println!(" // report your lint here"); . println!("}}"); . } . } . -- line 170 ---------------------------------------- -- line 875 ---------------------------------------- . kind!("Semi({e})"); . self.expr(e); . }, . } . } . } . . fn has_attr(cx: &LateContext<'_>, hir_id: HirId) -> bool { 393,235 ( 0.00%) let attrs = cx.tcx.hir_attrs(hir_id); 104 ( 0.00%) => ???:::hir_attrs (2x) . get_builtin_attr(attrs, sym::author).count() > 0 . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/higher.rs -------------------------------------------------------------------------------- Ir -- line 29 ---------------------------------------- . /// entire `for` loop span . pub span: Span, . /// label . pub label: Option, . } . . impl<'tcx> ForLoop<'tcx> { . /// Parses a desugared `for` loop 2,359,338 ( 0.01%) pub fn hir(expr: &Expr<'tcx>) -> Option { 786,446 ( 0.00%) if let ExprKind::DropTemps(e) = expr.kind . && let ExprKind::Match(iterexpr, [arm], MatchSource::ForLoopDesugar) = e.kind . && let ExprKind::Call(_, [arg]) = iterexpr.kind . && let ExprKind::Loop(block, label, ..) = arm.body.kind . && let [stmt] = block.stmts . && let hir::StmtKind::Expr(e) = stmt.kind . && let ExprKind::Match(_, [_, some_arm], _) = e.kind . && let hir::PatKind::Struct(_, [field], _) = some_arm.pat.kind . { -- line 46 ---------------------------------------- -- line 48 ---------------------------------------- . pat: field.pat, . arg, . body: some_arm.body, . loop_id: arm.body.hir_id, . span: expr.span.ctxt().outer_expn_data().call_site, . label, . }); . } 393,223 ( 0.00%) None 2,359,338 ( 0.01%) } . } . . /// An `if` expression without `let` . pub struct If<'hir> { . /// `if` condition . pub cond: &'hir Expr<'hir>, . /// `if` then expression . pub then: &'hir Expr<'hir>, -- line 65 ---------------------------------------- -- line 66 ---------------------------------------- . /// `else` expression . pub r#else: Option<&'hir Expr<'hir>>, . } . . impl<'hir> If<'hir> { . #[inline] . /// Parses an `if` expression without `let` . pub const fn hir(expr: &Expr<'hir>) -> Option { 5,898,293 ( 0.03%) if let ExprKind::If(cond, then, r#else) = expr.kind 12 ( 0.00%) && !has_let_expr(cond) 17 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/higher.rs:clippy_utils::higher::has_let_expr (1x) . { . Some(Self { cond, then, r#else }) . } else { . None . } . } . } . -- line 83 ---------------------------------------- -- line 93 ---------------------------------------- . pub if_else: Option<&'hir Expr<'hir>>, . /// `if let PAT = EXPR` . /// ^^^^^^^^^^^^^^ . pub let_span: Span, . } . . impl<'hir> IfLet<'hir> { . /// Parses an `if let` expression 1,179,670 ( 0.01%) pub fn hir(cx: &LateContext<'_>, expr: &Expr<'hir>) -> Option { 2,359,348 ( 0.01%) if let ExprKind::If( . &Expr { . kind: . ExprKind::Let(&hir::LetExpr { . pat: let_pat, . init: let_expr, . span: let_span, . .. . }), . .. . }, . if_then, . if_else, 4 ( 0.00%) ) = expr.kind . { . let mut iter = cx.tcx.hir_parent_iter(expr.hir_id); . if let Some((_, Node::Block(Block { stmts: [], .. }))) = iter.next() . && let Some(( . _, . Node::Expr(Expr { . kind: ExprKind::Loop(_, _, LoopSource::While, _), . .. -- line 123 ---------------------------------------- -- line 130 ---------------------------------------- . return Some(Self { . let_pat, . let_expr, . if_then, . if_else, . let_span, . }); . } 1,179,670 ( 0.01%) None 1,179,670 ( 0.01%) } . } . . /// An `if let` or `match` expression. Useful for lints that trigger on one or the other. . #[derive(Debug)] . pub enum IfLetOrMatch<'hir> { . /// Any `match` expression . Match(&'hir Expr<'hir>, &'hir [Arm<'hir>], MatchSource), . /// scrutinee, pattern, then block, else block -- line 147 ---------------------------------------- -- line 211 ---------------------------------------- . pub start: Option<&'a Expr<'a>>, . /// The upper bound of the range, or `None` for ranges such as `X..`. . pub end: Option<&'a Expr<'a>>, . pub span: Span, . } . . impl<'a> Range<'a> { . /// Higher a `hir` range to something similar to `ast::ExprKind::Range`. 7,864,460 ( 0.04%) pub fn hir(cx: &LateContext<'_>, expr: &'a Expr<'_>) -> Option> { 1,572,892 ( 0.01%) let span = expr.range_span()?; 17,301,840 ( 0.09%) => ???:::range_span (786,446x) . let (ty, start, end) = match expr.kind { . ExprKind::Call(path, [arg1, arg2]) . if let ExprKind::Path(qpath) = path.kind . && cx.tcx.qpath_is_lang_item(qpath, hir::LangItem::RangeInclusiveNew) => . { . (RangeTy::OpsInclusive, Some(arg1), Some(arg2)) . }, . ExprKind::Struct(&qpath, fields, StructTailExpr::None) => match (cx.tcx.qpath_lang_item(qpath)?, fields) { -- line 228 ---------------------------------------- -- line 256 ---------------------------------------- . }, . (hir::LangItem::RangeTo, [end]) if end.ident.name == sym::end => (RangeTy::OpsTo, None, Some(end.expr)), . _ => return None, . }, . _ => return None, . }; . . Some(Range { ty, start, end, span }) 6,291,568 ( 0.03%) } . } . . /// A type that can appear as the type of a range expression. . /// . /// This is a component of [`Range`]. . #[derive(Debug, Copy, Clone, Eq, PartialEq)] . pub enum RangeTy { . /// [`core::ops::RangeFrom`] -- line 272 ---------------------------------------- -- line 361 ---------------------------------------- . Repeat(&'a Expr<'a>, &'a Expr<'a>), . /// `vec![a, b, c]` . Vec(&'a [Expr<'a>]), . } . . impl<'a> VecArgs<'a> { . /// Returns the arguments of the `vec!` macro if this expression was expanded . /// from `vec!`. 8,257,697 ( 0.04%) pub fn hir(cx: &LateContext<'_>, expr: &'a Expr<'_>) -> Option> { 2,359,345 ( 0.01%) if let ExprKind::Call(fun, args) = expr.kind 6 ( 0.00%) && let ExprKind::Path(ref qpath) = fun.kind 18 ( 0.00%) && is_expn_of(fun.span, sym::vec).is_some() 459 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_expn_of (3x) . && let Some(fun_def_id) = cx.qpath_res(qpath, fun.hir_id).opt_def_id() . && let Some(name) = cx.tcx.get_diagnostic_name(fun_def_id) . { . return match (name, args) { . (sym::vec_from_elem, [elem, size]) => { . // `vec![elem; size]` case . Some(VecArgs::Repeat(elem, size)) . }, -- line 380 ---------------------------------------- -- line 381 ---------------------------------------- . (sym::box_assume_init_into_vec_unsafe, [write_box_via_move]) . if let ExprKind::Call(_, [_box, elems]) = write_box_via_move.kind . && let ExprKind::Array(elems) = elems.kind => . { . // `vec![a, b, c]` case . Some(VecArgs::Vec(elems)) . }, . (sym::vec_new, []) => Some(VecArgs::Vec(&[])), 3 ( 0.00%) _ => None, . }; . } . 3 ( 0.00%) None 8,257,697 ( 0.04%) } . } . . /// A desugared `while` loop . pub struct While<'hir> { . /// `while` loop condition . pub condition: &'hir Expr<'hir>, . /// `while` loop body . pub body: &'hir Expr<'hir>, -- line 402 ---------------------------------------- -- line 448 ---------------------------------------- . /// ^^^^^^^^^^^^^^ . pub let_span: Span, . } . . impl<'hir> WhileLet<'hir> { . #[inline] . /// Parses a desugared `while let` loop . pub const fn hir(expr: &Expr<'hir>) -> Option { 2,359,318 ( 0.01%) if let ExprKind::Loop( . &Block { . expr: . Some(&Expr { . kind: . ExprKind::If( . &Expr { . kind: . ExprKind::Let(&hir::LetExpr { -- line 464 ---------------------------------------- -- line 607 ---------------------------------------- . _ => (), . } . } . None . } . . /// Checks that a condition doesn't have a `let` expression, to keep `If` and `While` from accepting . /// `if let` and `while let`. 15 ( 0.00%) pub const fn has_let_expr<'tcx>(cond: &'tcx Expr<'tcx>) -> bool { 18 ( 0.00%) match &cond.kind { . ExprKind::Let(_) => true, . ExprKind::Binary(_, lhs, rhs) => has_let_expr(lhs) || has_let_expr(rhs), . _ => false, . } 15 ( 0.00%) } 2,359,350 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/implicit_saturating_add.rs -------------------------------------------------------------------------------- Ir -- line 35 ---------------------------------------- . pub IMPLICIT_SATURATING_ADD, . style, . "Perform saturating addition instead of implicitly checking max bound of data type" . } . . declare_lint_pass!(ImplicitSaturatingAdd => [IMPLICIT_SATURATING_ADD]); . . impl<'tcx> LateLintPass<'tcx> for ImplicitSaturatingAdd { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,449 ( 0.00%) if let ExprKind::If(cond, then, None) = expr.kind . && let Some((c, op_node, l)) = get_const(cx, cond) . && let BinOpKind::Ne | BinOpKind::Lt = op_node . && let ExprKind::Block(block, None) = then.kind . && let Block { . stmts: . [ . Stmt { . kind: StmtKind::Expr(ex) | StmtKind::Semi(ex), -- line 52 ---------------------------------------- -- line 88 ---------------------------------------- . IMPLICIT_SATURATING_ADD, . expr.span, . "manual saturating add detected", . "use instead", . sugg, . app, . ); . } 3,145,784 ( 0.02%) } . } . . fn get_int_max(ty: Ty<'_>) -> Option { . use rustc_middle::ty::{Int, Uint}; . match ty.peel_refs().kind() { . Int(IntTy::I8) => i8::MAX.try_into().ok(), . Int(IntTy::I16) => i16::MAX.try_into().ok(), . Int(IntTy::I32) => i32::MAX.try_into().ok(), -- line 104 ---------------------------------------- -- line 111 ---------------------------------------- . Uint(UintTy::U64) => Some(u64::MAX.into()), . Uint(UintTy::U128) => Some(u128::MAX), . Uint(UintTy::Usize) => usize::MAX.try_into().ok(), . _ => None, . } . } . . fn get_const<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> Option<(u128, BinOpKind, &'tcx Expr<'tcx>)> { 2 ( 0.00%) if let ExprKind::Binary(op, l, r) = expr.kind { . let ecx = ConstEvalCtxt::new(cx); . let ctxt = expr.span.ctxt(); . if let Some(Constant::Int(c)) = ecx.eval_local(r, ctxt) { . return Some((c, op.node, l)); . } . if let Some(Constant::Int(c)) = ecx.eval_local(l, ctxt) { . return Some((c, invert_op(op.node)?, r)); . } -- line 127 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/default_constructed_unit_structs.rs -------------------------------------------------------------------------------- Ir -- line 54 ---------------------------------------- . if let hir::TyKind::Path(ref qpath) = ty.kind { . is_ty_alias(qpath) . } else { . false . } . } . . impl LateLintPass<'_> for DefaultConstructedUnitStructs { 2,752,561 ( 0.01%) fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { 786,448 ( 0.00%) if let ExprKind::Call(fn_expr, &[]) = expr.kind . // make sure we have a call to `Default::default` . && let ExprKind::Path(ref qpath @ hir::QPath::TypeRelative(base, _)) = fn_expr.kind . // make sure this isn't a type alias: . // `::Assoc` cannot be used as a constructor . && !is_alias(*base) . && let Res::Def(_, def_id) = cx.qpath_res(qpath, fn_expr.hir_id) . && cx.tcx.is_diagnostic_item(sym::default_fn, def_id) . // make sure we have a struct with no fields (unit struct) -- line 71 ---------------------------------------- -- line 91 ---------------------------------------- . diag.multipart_suggestion( . "remove this call to `default`", . removals, . Applicability::MachineApplicable, . ); . }, . ); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/minmax.rs -------------------------------------------------------------------------------- Ir -- line 31 ---------------------------------------- . pub MIN_MAX, . correctness, . "`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant" . } . . declare_lint_pass!(MinMaxPass => [MIN_MAX]); . . impl<'tcx> LateLintPass<'tcx> for MinMaxPass { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if let Some((outer_max, outer_c, oe)) = min_max(cx, expr) 8,257,805 ( 0.04%) => site/frontend/rust-clippy/clippy_lints/src/minmax.rs:clippy_lints::minmax::min_max (393,223x) . && let Some((inner_max, inner_c, ie)) = min_max(cx, oe) . && outer_max != inner_max . && let Some(ord) = Constant::partial_cmp(cx.tcx, cx.typeck_results().expr_ty(ie), &outer_c, &inner_c) . && matches!( . (outer_max, ord), . (MinMax::Max, Equal | Greater) | (MinMax::Min, Equal | Less) . ) . { . span_lint( . cx, . MIN_MAX, . expr.span, . "this `min`/`max` combination leads to constant result", . ); . } 2,359,338 ( 0.01%) } . } . . #[derive(PartialEq, Eq, Debug, Clone, Copy)] . enum MinMax { . Min, . Max, . } . 2,752,561 ( 0.01%) fn min_max<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<(MinMax, Constant, &'a Expr<'a>)> { 1,966,113 ( 0.01%) match expr.kind { 1 ( 0.00%) ExprKind::Call(path, args) => { 3 ( 0.00%) if let ExprKind::Path(ref qpath) = path.kind { . cx.typeck_results() 4 ( 0.00%) .qpath_res(qpath, path.hir_id) 15 ( 0.00%) => ???:::qpath_res (1x) . .opt_def_id() 6 ( 0.00%) .and_then(|def_id| match cx.tcx.get_diagnostic_name(def_id) { 80 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::cmp_min) => fetch_const(cx, expr.span.ctxt(), None, args, MinMax::Min), . Some(sym::cmp_max) => fetch_const(cx, expr.span.ctxt(), None, args, MinMax::Max), . _ => None, . }) . } else { . None . } . }, 2 ( 0.00%) ExprKind::MethodCall(path, receiver, args @ [_], _) => { . let m = match path.ident.name { . sym::max => MinMax::Max, . sym::min => MinMax::Min, . _ => return None, . }; . if cx.typeck_results().expr_ty(receiver).is_floating_point() . || cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::Ord) . { . fetch_const(cx, expr.span.ctxt(), Some(receiver), args, m) . } else { . None . } . }, . _ => None, . } 3,145,784 ( 0.02%) } . . fn fetch_const<'a>( . cx: &LateContext<'_>, . ctxt: SyntaxContext, . receiver: Option<&'a Expr<'a>>, . args: &'a [Expr<'a>], . m: MinMax, . ) -> Option<(MinMax, Constant, &'a Expr<'a>)> { -- line 105 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs -------------------------------------------------------------------------------- Ir -- line 73 ---------------------------------------- . derive_src: Option, . . // When a macro is disallowed in an early pass, it's stored . // and emitted during the late pass. This happens for attributes. . early_macro_cache: AttrStorage, . } . . impl DisallowedMacros { 6 ( 0.00%) pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf, early_macro_cache: AttrStorage) -> Self { 12 ( 0.00%) let (disallowed, _) = create_disallowed_map( 38 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_config/src/types.rs:clippy_config::types::create_disallowed_map::::new::{closure#0}> (1x) . tcx, . &conf.disallowed_macros, . PathNS::Macro, . |def_kind| matches!(def_kind, DefKind::Macro(_)), . "macro", . false, . ); 6 ( 0.00%) Self { 4 ( 0.00%) disallowed, . seen: FxHashSet::default(), . derive_src: None, . early_macro_cache, . } 5 ( 0.00%) } . 3,146,000 ( 0.02%) fn check(&mut self, cx: &LateContext<'_>, span: Span, derive_src: Option) { 393,250 ( 0.00%) if self.disallowed.is_empty() { . return; . } . . for mac in macro_backtrace(span) { . if !self.seen.insert(mac.expn) { . return; . } . -- line 107 ---------------------------------------- -- line 119 ---------------------------------------- . msg, . add_note, . ); . } else { . span_lint_and_then(cx, DISALLOWED_MACROS, mac.span, msg, add_note); . } . } . } 3,146,000 ( 0.02%) } . } . . impl LateLintPass<'_> for DisallowedMacros { 6 ( 0.00%) fn check_crate(&mut self, cx: &LateContext<'_>) { . // once we check a crate in the late pass we can emit the early pass lints . if let Some(attr_spans) = self.early_macro_cache.clone().0.get() { . for span in attr_spans { 5 ( 0.00%) self.check(cx, *span, None); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (1x) . } . } 7 ( 0.00%) } . . fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 1,966,115 ( 0.01%) self.check(cx, expr.span, None); 7,078,014 ( 0.03%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (393,223x) . // `$t + $t` can have the context of $t, check also the span of the binary operator 786,447 ( 0.00%) if let ExprKind::Binary(op, ..) = expr.kind { 4 ( 0.00%) self.check(cx, op.span, None); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (1x) . } . } . . fn check_stmt(&mut self, cx: &LateContext<'_>, stmt: &Stmt<'_>) { 4 ( 0.00%) self.check(cx, stmt.span, None); 18 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (1x) . } . . fn check_ty(&mut self, cx: &LateContext<'_>, ty: &Ty<'_, AmbigArg>) { 28 ( 0.00%) self.check(cx, ty.span, None); 126 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (7x) . } . . fn check_pat(&mut self, cx: &LateContext<'_>, pat: &Pat<'_>) { . self.check(cx, pat.span, None); . } . 40 ( 0.00%) fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { 16 ( 0.00%) self.check(cx, item.span, self.derive_src); 72 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (4x) 20 ( 0.00%) self.check(cx, item.vis_span, None); 72 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (4x) . 12 ( 0.00%) if matches!( 4 ( 0.00%) item.kind, . ItemKind::Struct(..) | ItemKind::Enum(..) | ItemKind::Union(..) . ) && macro_backtrace(item.span).all(|m| !matches!(m.kind, MacroKind::Derive)) . { . self.derive_src = Some(item.owner_id); . } 32 ( 0.00%) } . . fn check_foreign_item(&mut self, cx: &LateContext<'_>, item: &ForeignItem<'_>) { . self.check(cx, item.span, None); . self.check(cx, item.vis_span, None); . } . . fn check_impl_item(&mut self, cx: &LateContext<'_>, item: &ImplItem<'_>) { . self.check(cx, item.span, None); -- line 179 ---------------------------------------- -- line 182 ---------------------------------------- . } . } . . fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &TraitItem<'_>) { . self.check(cx, item.span, None); . } . . fn check_path(&mut self, cx: &LateContext<'_>, path: &Path<'_>, _: HirId) { 36 ( 0.00%) self.check(cx, path.span, None); 162 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/disallowed_macros.rs:::check (9x) . } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs -------------------------------------------------------------------------------- Ir -- line 460 ---------------------------------------- . /// assert_eq!(13, unsafe { mem::size_of_val_raw(y) }); . /// ``` . #[inline] . #[must_use] . #[stable(feature = "layout_for_ptr", since = "CURRENT_RUSTC_VERSION")] . #[rustc_const_stable(feature = "layout_for_ptr", since = "CURRENT_RUSTC_VERSION")] . pub const unsafe fn size_of_val_raw(val: *const T) -> usize { . // SAFETY: the caller must provide a valid raw pointer 1 ( 0.00%) unsafe { intrinsics::size_of_val(val) } . } . . /// Returns the [ABI]-required minimum alignment of a type in bytes. . /// . /// Every reference to a value of the type `T` must be a multiple of this number. . /// . /// This is the alignment used for struct fields. It may be smaller than the preferred alignment. . /// -- line 476 ---------------------------------------- -- line 634 ---------------------------------------- . /// . /// [type-layout]: ../../reference/type-layout.html#r-layout.primitive . #[inline] . #[must_use] . #[stable(feature = "layout_for_ptr", since = "CURRENT_RUSTC_VERSION")] . #[rustc_const_stable(feature = "layout_for_ptr", since = "CURRENT_RUSTC_VERSION")] . pub const unsafe fn align_of_val_raw(val: *const T) -> usize { . // SAFETY: the caller must provide a valid raw pointer 1 ( 0.00%) unsafe { intrinsics::align_of_val(val) } . } . . /// Returns `true` if dropping values of type `T` matters. . /// . /// This is purely an optimization hint, and may be implemented conservatively: . /// it may return `true` for types that don't actually need to be dropped. . /// As such always returning `true` would be a valid implementation of . /// this function. However if this function actually returns `false`, then you -- line 650 ---------------------------------------- -- line 825 ---------------------------------------- . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_swap", since = "1.85.0")] . #[rustc_diagnostic_item = "mem_swap"] . pub const fn swap(x: &mut T, y: &mut T) { . // SAFETY: `&mut` guarantees these are typed readable and writable . // as well as non-overlapping. 9 ( 0.00%) unsafe { intrinsics::typed_swap_nonoverlapping(x, y) } . } . . /// Replaces `dest` with the default value of `T`, returning the previous `dest` value. . /// . /// * If you want to replace the values of two variables, see [`swap`]. . /// * If you want to replace with a passed value instead of the default value, see [`replace`]. . /// . /// # Examples -- line 841 ---------------------------------------- -- line 967 ---------------------------------------- . // such that the old value is not duplicated. Nothing is dropped and . // nothing here can panic. . unsafe { . // Ideally we wouldn't use the intrinsics here, but going through the . // `ptr` methods introduces two unnecessary UbChecks, so until we can . // remove those for pointers that come from references, this uses the . // intrinsics instead so this stays very cheap in MIR (and debug). . 2,359,627 ( 0.01%) let result = crate::intrinsics::read_via_copy(dest); 1,573,275 ( 0.01%) crate::intrinsics::write_via_move(dest, src); . result . } . } . . /// Disposes of a value. . /// . /// This effectively does nothing for types which implement `Copy`, e.g. . /// integers. Such values are copied and _then_ moved into the function, so the -- line 984 ---------------------------------------- -- line 1406 ---------------------------------------- . /// // ⚠️ This is undefined behavior. Don't do this. ⚠️ . /// // assert_eq!(0, unsafe { std::mem::transmute::<_, u8>(std::mem::discriminant(&unit_like)) }); . /// ``` . #[stable(feature = "discriminant_value", since = "1.21.0")] . #[rustc_const_stable(feature = "const_discriminant", since = "1.75.0")] . #[rustc_diagnostic_item = "mem_discriminant"] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . pub const fn discriminant(v: &T) -> Discriminant { 1 ( 0.00%) Discriminant(intrinsics::discriminant_value(v)) . } . . /// Returns the number of variants in the enum type `T`. . /// . /// If `T` is not an enum, calling this function will not result in undefined behavior, but the . /// return value is unspecified. Equally, if `T` is an enum with more variants than `usize::MAX` . /// the return value is unspecified. Uninhabited variants will be counted. . /// -- line 1422 ---------------------------------------- 393,225 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/main_recursion.rs -------------------------------------------------------------------------------- Ir -- line 29 ---------------------------------------- . . #[derive(Default)] . pub struct MainRecursion { . has_no_std_attr: bool, . } . . impl LateLintPass<'_> for MainRecursion { . fn check_crate(&mut self, cx: &LateContext<'_>) { 3 ( 0.00%) self.has_no_std_attr = is_no_std_crate(cx); 54 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/lib.rs:clippy_utils::is_no_std_crate (1x) . } . 1,572,892 ( 0.01%) fn check_expr_post(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { 1,572,894 ( 0.01%) if self.has_no_std_attr { . return; . } . . if let ExprKind::Call(func, []) = &expr.kind . && let ExprKind::Path(QPath::Resolved(_, path)) = &func.kind . && let Some(def_id) = path.res.opt_def_id() . && is_entrypoint_fn(cx, def_id) . { -- line 49 ---------------------------------------- -- line 51 ---------------------------------------- . cx, . MAIN_RECURSION, . func.span, . format!("recursing into entrypoint `{}`", snippet(cx, func.span, "main")), . None, . "consider using another function for this recursion", . ); . } 1,966,115 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/hir.rs -------------------------------------------------------------------------------- Ir -- line 482 ---------------------------------------- . . impl<'hir> ConstArg<'hir> { . /// Converts a `ConstArg` in an unambiguous position to one in an ambiguous position. This is . /// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions. . /// . /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if . /// infer consts are relevant to you then care should be taken to handle them separately. . pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> { 3 ( 0.00%) if let ConstArgKind::Infer(()) = self.kind { . return None; . } . . // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the layout is . // the same across different ZST type arguments. We also asserted that the `self` is . // not a `ConstArgKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`. . let ptr = self as *const ConstArg<'hir> as *const ConstArg<'hir, AmbigArg>; . Some(unsafe { &*ptr }) -- line 498 ---------------------------------------- -- line 1490 ---------------------------------------- . matches!(n.args, AttrArgs::Empty) . } . _ => false, . } . } . . #[inline] . fn symbol_path(&self) -> Option> { 11 ( 0.00%) match &self { . Attribute::Unparsed(n) => Some(n.path.segments.iter().copied().collect()), . _ => None, . } . } . . fn path_span(&self) -> Option { . match &self { . Attribute::Unparsed(attr) => Some(attr.path.span), -- line 1506 ---------------------------------------- -- line 1517 ---------------------------------------- . } . . fn is_automatically_derived_attr(&self) -> bool { . matches!(self, Attribute::Parsed(AttributeKind::AutomaticallyDerived)) . } . . #[inline] . fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind)> { 2 ( 0.00%) match &self { . Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => { . Some((*comment, *kind)) . } . _ => None, . } . } . . fn doc_resolution_scope(&self) -> Option { -- line 1533 ---------------------------------------- -- line 1547 ---------------------------------------- . AttributeKind::ProcMacro . | AttributeKind::ProcMacroAttribute . | AttributeKind::ProcMacroDerive { .. } . ) . ) . } . . fn is_doc_hidden(&self) -> bool { 2 ( 0.00%) matches!(self, Attribute::Parsed(AttributeKind::Doc(d)) if d.hidden.is_some()) . } . . fn is_doc_keyword_or_attribute(&self) -> bool { . matches!(self, Attribute::Parsed(AttributeKind::Doc(d)) if d.attribute.is_some() || d.keyword.is_some()) . } . . fn is_rustc_doc_primitive(&self) -> bool { . matches!(self, Attribute::Parsed(AttributeKind::RustcDocPrimitive(..))) -- line 1563 ---------------------------------------- -- line 2302 ---------------------------------------- . #[derive(Debug, Clone, Copy, StableHash)] . pub struct Body<'hir> { . pub params: &'hir [Param<'hir>], . pub value: &'hir Expr<'hir>, . } . . impl<'hir> Body<'hir> { . pub fn id(&self) -> BodyId { 33 ( 0.00%) BodyId { hir_id: self.value.hir_id } . } . } . . /// The type of source expression that caused this coroutine to be created. . #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, StableHash, Encodable, Decodable)] . pub enum CoroutineKind { . /// A coroutine that comes from a desugaring. . Desugared(CoroutineDesugaring, CoroutineSource), -- line 2318 ---------------------------------------- -- line 2719 ---------------------------------------- . . /// If `Self.kind` is `ExprKind::DropTemps(expr)`, drill down until we get a non-`DropTemps` . /// `Expr`. This is used in suggestions to ignore this `ExprKind` as it is semantically . /// silent, only signaling the ownership system. By doing this, suggestions that check the . /// `ExprKind` of any given `Expr` for presentation don't have to care about `DropTemps` . /// beyond remembering to call this function before doing analysis on it. . pub fn peel_drop_temps(&self) -> &Self { . let mut expr = self; 14 ( 0.00%) while let ExprKind::DropTemps(inner) = &expr.kind { . expr = inner; . } . expr . } . . pub fn peel_blocks(&self) -> &Self { . let mut expr = self; 3,932,262 ( 0.02%) while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind { . expr = inner; . } . expr . } . . pub fn peel_borrows(&self) -> &Self { . let mut expr = self; 1,179,669 ( 0.01%) while let ExprKind::AddrOf(.., inner) = &expr.kind { . expr = inner; . } . expr . } . . pub fn can_have_side_effects(&self) -> bool { . match self.peel_drop_temps().kind { . ExprKind::Path(_) | ExprKind::Lit(_) | ExprKind::OffsetOf(..) | ExprKind::Use(..) => { -- line 2751 ---------------------------------------- -- line 3559 ---------------------------------------- . . impl<'hir> Ty<'hir> { . /// Converts a `Ty` in an unambiguous position to one in an ambiguous position. This is . /// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions. . /// . /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if . /// infer types are relevant to you then care should be taken to handle them separately. . pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> { 16 ( 0.00%) if let TyKind::Infer(()) = self.kind { . return None; . } . . // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is . // the same across different ZST type arguments. We also asserted that the `self` is . // not a `TyKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`. . let ptr = self as *const Ty<'hir> as *const Ty<'hir, AmbigArg>; . Some(unsafe { &*ptr }) -- line 3575 ---------------------------------------- -- line 4313 ---------------------------------------- . #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, StableHash)] . pub enum IsAsync { . Async(Span), . NotAsync, . } . . impl IsAsync { . pub fn is_async(self) -> bool { 2 ( 0.00%) matches!(self, IsAsync::Async(_)) . } . } . . #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, StableHash)] . #[derive(Default)] . pub enum Defaultness { . Default { . has_value: bool, -- line 4329 ---------------------------------------- -- line 4359 ---------------------------------------- . DefaultReturn(Span), . /// Everything else. . Return(&'hir Ty<'hir>), . } . . impl<'hir> FnRetTy<'hir> { . #[inline] . pub fn span(&self) -> Span { 8 ( 0.00%) match *self { 1 ( 0.00%) Self::DefaultReturn(span) => span, . Self::Return(ref ty) => ty.span, . } . } . . pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> { . if let Self::Return(ty) = self . && ty.is_suggestable_infer_ty() . { -- line 4376 ---------------------------------------- -- line 4594 ---------------------------------------- . /// either an `EiiImpls` or `EiiExternTarget` attribute . pub eii: bool, . } . . impl<'hir> Item<'hir> { . #[inline] . pub fn hir_id(&self) -> HirId { . // Items are always HIR owners. 24 ( 0.00%) HirId::make_owner(self.owner_id.def_id) . } . . #[inline] . pub fn item_id(&self) -> ItemId { . ItemId { owner_id: self.owner_id } . } . . /// Check if this is an [`ItemKind::Enum`], [`ItemKind::Struct`] or -- line 4610 ---------------------------------------- -- line 4789 ---------------------------------------- . pub safety: HeaderSafety, . pub constness: Constness, . pub asyncness: IsAsync, . pub abi: ExternAbi, . } . . impl FnHeader { . pub fn is_async(&self) -> bool { 2 ( 0.00%) matches!(self.asyncness, IsAsync::Async(_)) . } . . pub fn is_unsafe(&self) -> bool { . self.safety().is_unsafe() . } . . pub fn is_safe(&self) -> bool { . self.safety().is_safe() . } . . pub fn safety(&self) -> Safety { 4 ( 0.00%) match self.safety { . HeaderSafety::SafeTargetFeatures => Safety::Unsafe, . HeaderSafety::Normal(safety) => safety, . } . } . } . . #[derive(Debug, Clone, Copy, StableHash)] . pub enum ItemKind<'hir> { -- line 4817 ---------------------------------------- -- line 4905 ---------------------------------------- . // We do not put a `Span` in `Defaultness` because it breaks foreign crate metadata . // decoding as `Span`s cannot be decoded when a `Session` is not available. . pub defaultness_span: Option, . pub trait_ref: TraitRef<'hir>, . } . . impl ItemKind<'_> { . pub fn ident(&self) -> Option { 6 ( 0.00%) match *self { . ItemKind::ExternCrate(_, ident) . | ItemKind::Use(_, UseKind::Single(ident)) . | ItemKind::Static(_, ident, ..) . | ItemKind::Const(ident, ..) . | ItemKind::Fn { ident, .. } . | ItemKind::Macro(ident, ..) . | ItemKind::Mod(ident, ..) . | ItemKind::TyAlias(ident, ..) -- line 4921 ---------------------------------------- 1,048,628 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/vec_init_then_push.rs -------------------------------------------------------------------------------- Ir -- line 147 ---------------------------------------- . s, . Applicability::HasPlaceholders, . ); . } . } . . impl<'tcx> LateLintPass<'tcx> for VecInitThenPush { . fn check_block(&mut self, _: &LateContext<'tcx>, _: &'tcx Block<'tcx>) { 2 ( 0.00%) self.searcher = None; . } . . fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) { . if let Some(init_expr) = local.init . && let PatKind::Binding(BindingMode::MUT, id, name, None) = local.pat.kind . && !local.span.in_external_macro(cx.sess().source_map()) . && let Some(init) = get_vec_init_kind(cx, init_expr) . && !matches!(init, VecInitKind::WithExprCapacity(_)) -- line 163 ---------------------------------------- -- line 171 ---------------------------------------- . err_span: local.span, . found: 0, . last_push_expr: init_expr.hir_id, . }); . } . } . . fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 1,179,669 ( 0.01%) if self.searcher.is_none() . && let ExprKind::Assign(left, right, _) = expr.kind . && let ExprKind::Path(QPath::Resolved(None, path)) = left.kind . && let [name] = &path.segments . && let Res::Local(id) = path.res . && !expr.span.in_external_macro(cx.sess().source_map()) . && let Some(init) = get_vec_init_kind(cx, right) . && !matches!(init, VecInitKind::WithExprCapacity(_)) . { -- line 187 ---------------------------------------- -- line 191 ---------------------------------------- . lhs_is_let: false, . let_ty_span: None, . name: name.ident.name, . err_span: expr.span, . found: 0, . last_push_expr: expr.hir_id, . }); . } 393,223 ( 0.00%) } . . fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) { 2 ( 0.00%) if let Some(searcher) = self.searcher.take() { . if let StmtKind::Expr(expr) | StmtKind::Semi(expr) = stmt.kind . && !stmt.span.from_expansion() . && let ExprKind::MethodCall(name, self_arg, [_], _) = expr.kind . && self_arg.res_local_id() == Some(searcher.local_id) . && name.ident.name == sym::push . { . self.searcher = Some(VecPushSearcher { . err_span: searcher.err_span.to(stmt.span), -- line 210 ---------------------------------------- -- line 211 ---------------------------------------- . found: searcher.found + 1, . last_push_expr: expr.hir_id, . ..searcher . }); . } else { . searcher.display_err(cx); . } . } 1 ( 0.00%) } . . fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx Block<'tcx>) { 4 ( 0.00%) if let Some(searcher) = self.searcher.take() { . searcher.display_err(cx); . } . } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_utils/src/visitors.rs -------------------------------------------------------------------------------- Ir -- line 87 ---------------------------------------- . } . V::Result::output() . } . } . macro_rules! visitable_ref { . ($t:ident, $f:ident) => { . impl<'tcx> Visitable<'tcx> for &'tcx $t<'tcx> { . fn visit>(self, visitor: &mut V) -> V::Result { 5 ( 0.00%) visitor.$f(self) 469 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/cognitive_complexity.rs:::check::{closure#0}> as rustc_hir::intravisit::Visitor>::visit_expr (1x) . } . } . }; . } . visitable_ref!(Arm, visit_arm); . visitable_ref!(Block, visit_block); . visitable_ref!(Body, visit_body); . visitable_ref!(Expr, visit_expr); . visitable_ref!(Stmt, visit_stmt); . . /// Calls the given function once for each expression contained. This does not enter any bodies or . /// nested items. 4 ( 0.00%) pub fn for_each_expr_without_closures<'tcx, B, C: Continue>( . node: impl Visitable<'tcx>, . f: impl FnMut(&'tcx Expr<'tcx>) -> ControlFlow, . ) -> Option { . struct V { . f: F, . } . impl<'tcx, B, C: Continue, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow> Visitor<'tcx> for V { . type Result = ControlFlow; . 93 ( 0.00%) fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) -> Self::Result { 786,454 ( 0.00%) match (self.f)(e) { 1,179,748 ( 0.01%) ControlFlow::Continue(c) if c.descend() => walk_expr(self, e), 455 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr::::check::{closure#0}>> (1x) . ControlFlow::Break(b) => ControlFlow::Break(b), . ControlFlow::Continue(_) => ControlFlow::Continue(()), . } 56 ( 0.00%) } . . // Avoid unnecessary `walk_*` calls. . fn visit_ty(&mut self, _: &'tcx hir::Ty<'tcx, AmbigArg>) -> Self::Result { . ControlFlow::Continue(()) . } . fn visit_pat(&mut self, _: &'tcx Pat<'tcx>) -> Self::Result { . ControlFlow::Continue(()) . } -- line 132 ---------------------------------------- -- line 133 ---------------------------------------- . fn visit_qpath(&mut self, _: &'tcx QPath<'tcx>, _: HirId, _: Span) -> Self::Result { . ControlFlow::Continue(()) . } . // Avoid monomorphising all `visit_*` functions. . fn visit_nested_item(&mut self, _: ItemId) -> Self::Result { . ControlFlow::Continue(()) . } . } 20 ( 0.00%) let mut v = V { f }; . node.visit(&mut v).break_value() 4 ( 0.00%) } . . /// Calls the given function once for each expression contained. This will enter bodies, but not . /// nested items. . pub fn for_each_expr<'tcx, B, C: Continue>( . tcx: TyCtxt<'tcx>, . node: impl Visitable<'tcx>, . f: impl FnMut(&'tcx Expr<'tcx>) -> ControlFlow, . ) -> Option { -- line 151 ---------------------------------------- -- line 157 ---------------------------------------- . type NestedFilter = nested_filter::OnlyBodies; . type Result = ControlFlow; . . fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { . self.tcx . } . . fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) -> Self::Result { 16 ( 0.00%) match (self.f)(e) { 5 ( 0.00%) ControlFlow::Continue(c) if c.descend() => walk_expr(self, e), 100 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler/rustc_hir/src/intravisit.rs:rustc_hir::intravisit::walk_expr::>'2 (1x) . ControlFlow::Break(b) => ControlFlow::Break(b), . ControlFlow::Continue(_) => ControlFlow::Continue(()), . } . } . . // Only walk closures . fn visit_anon_const(&mut self, _: &'tcx AnonConst) -> Self::Result { . ControlFlow::Continue(()) -- line 174 ---------------------------------------- -- line 183 ---------------------------------------- . fn visit_qpath(&mut self, _: &'tcx QPath<'tcx>, _: HirId, _: Span) -> Self::Result { . ControlFlow::Continue(()) . } . // Avoid monomorphising all `visit_*` functions. . fn visit_nested_item(&mut self, _: ItemId) -> Self::Result { . ControlFlow::Continue(()) . } . } 3 ( 0.00%) let mut v = V { tcx, f }; . node.visit(&mut v).break_value() . } . . /// returns `true` if expr contains match expr desugared from try . fn contains_try(expr: &Expr<'_>) -> bool { . for_each_expr_without_closures(expr, |e| { . if matches!(e.kind, ExprKind::Match(_, _, hir::MatchSource::TryDesugar(_))) { . ControlFlow::Break(()) -- line 199 ---------------------------------------- -- line 319 ---------------------------------------- . ControlFlow::Continue(()) . } . }) . .is_some() . } . . /// Returns whether the given expression can be evaluated as a constant assuming that all its sub . /// expressions can be evaluated as constants. 9 ( 0.00%) fn is_const_evaluatable_helper<'tcx>(tcx: TyCtxt<'tcx>, typeck: &'tcx TypeckResults<'tcx>, e: &'tcx Expr<'_>) -> bool { 21 ( 0.00%) match e.kind { . ExprKind::Call( . &Expr { . kind: ExprKind::Path(ref p), . hir_id, . .. . }, . _, . ) if typeck -- line 336 ---------------------------------------- -- line 337 ---------------------------------------- . .qpath_res(p, hir_id) . .opt_def_id() . .is_some_and(|id| is_stable_const_fn_at(tcx, CRATE_HIR_ID, id, Msrv::default())) => . { . true . }, . ExprKind::MethodCall(..) . if typeck 5 ( 0.00%) .type_dependent_def_id(e.hir_id) 51 ( 0.00%) => ???:::type_dependent_def_id (1x) 9 ( 0.00%) .is_some_and(|id| is_stable_const_fn_at(tcx, CRATE_HIR_ID, id, Msrv::default())) => 6,124 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/qualify_min_const_fn.rs:clippy_utils::qualify_min_const_fn::is_stable_const_fn_at (1x) . { . true . }, . ExprKind::Binary(_, lhs, rhs) 5 ( 0.00%) if typeck.expr_ty(lhs).peel_refs().is_primitive_ty() 40 ( 0.00%) => ???:::expr_ty (1x) 2 ( 0.00%) && typeck.expr_ty(rhs).peel_refs().is_primitive_ty() => 40 ( 0.00%) => ???:::expr_ty (1x) . { . true . }, . ExprKind::Unary(UnOp::Deref, e) if typeck.expr_ty(e).is_raw_ptr() => true, . ExprKind::Unary(_, e) if typeck.expr_ty(e).peel_refs().is_primitive_ty() => true, . ExprKind::Index(base, _, _) . if matches!(typeck.expr_ty(base).peel_refs().kind(), ty::Slice(_) | ty::Array(..)) => . { . true . }, 1 ( 0.00%) ExprKind::Path(ref p) 3 ( 0.00%) if matches!( 12 ( 0.00%) typeck.qpath_res(p, e.hir_id), 15 ( 0.00%) => ???:::qpath_res (1x) . Res::Def( . DefKind::Const { .. } . | DefKind::AssocConst { .. } . | DefKind::AnonConst . | DefKind::ConstParam . | DefKind::Ctor(..) . | DefKind::Fn . | DefKind::AssocFn, -- line 373 ---------------------------------------- -- line 392 ---------------------------------------- . | ExprKind::Repeat(..) . | ExprKind::Struct(..) . | ExprKind::Tup(_) . | ExprKind::Type(..) . | ExprKind::UnsafeBinderCast(..) => true, . . _ => false, . } 10 ( 0.00%) } . . /// Checks if the given expression can be evaluated as a constant at the specified node 3 ( 0.00%) pub fn is_const_evaluatable<'tcx>(tcx: TyCtxt<'tcx>, typeck: &'tcx TypeckResults<'tcx>, e: &'tcx Expr<'_>) -> bool { . for_each_expr(tcx, e, move |e| { 24 ( 0.00%) if !is_const_evaluatable_helper(tcx, typeck, e) { 6,204 ( 0.00%) => site/frontend/rust-clippy/clippy_utils/src/visitors.rs:clippy_utils::visitors::is_const_evaluatable_helper (1x) . ControlFlow::Break(()) . } else if matches!(e.kind, ExprKind::ConstBlock(_)) { . ControlFlow::Continue(Descend::No) . } else { . ControlFlow::Continue(Descend::Yes) . } . }) . .is_none() 3 ( 0.00%) } . . /// Checks if the given expression can be used as a const parameter. . /// . /// This is more strict than `is_const_evaluatable` as it requires that the expression does not . /// contain any type parameters or any operations on const parameters. . pub fn is_const_param_evaluatable<'tcx>( . tcx: TyCtxt<'tcx>, . typeck: &'tcx TypeckResults<'tcx>, -- line 422 ---------------------------------------- 34 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs -------------------------------------------------------------------------------- Ir -- line 268 ---------------------------------------- . /// . /// This default shouldn't be overridden without good reason, . /// such as when forwarding to another PartialEq implementation. . #[inline] . #[must_use] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_diagnostic_item = "cmp_partialeq_ne"] . fn ne(&self, other: &Rhs) -> bool { 3,145,699 ( 0.02%) !self.eq(other) 47 ( 0.00%) => ???:::eq (1x) . } . } . . /// Derive macro generating an impl of the trait [`PartialEq`]. . /// The behavior of this macro is described in detail [here](PartialEq#derivable). . #[rustc_builtin_macro] . #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] . #[allow_internal_unstable(core_intrinsics, structural_match)] -- line 284 ---------------------------------------- -- line 486 ---------------------------------------- . /// assert_eq!(Ordering::Equal.is_lt(), false); . /// assert_eq!(Ordering::Greater.is_lt(), false); . /// ``` . #[inline] . #[must_use] . #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")] . #[stable(feature = "ordering_helpers", since = "1.53.0")] . pub const fn is_lt(self) -> bool { 1 ( 0.00%) self.as_raw() < 0 . } . . /// Returns `true` if the ordering is the `Greater` variant. . /// . /// # Examples . /// . /// ``` . /// use std::cmp::Ordering; -- line 502 ---------------------------------------- -- line 505 ---------------------------------------- . /// assert_eq!(Ordering::Equal.is_gt(), false); . /// assert_eq!(Ordering::Greater.is_gt(), true); . /// ``` . #[inline] . #[must_use] . #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")] . #[stable(feature = "ordering_helpers", since = "1.53.0")] . pub const fn is_gt(self) -> bool { 7 ( 0.00%) self.as_raw() > 0 . } . . /// Returns `true` if the ordering is either the `Less` or `Equal` variant. . /// . /// # Examples . /// . /// ``` . /// use std::cmp::Ordering; -- line 521 ---------------------------------------- -- line 543 ---------------------------------------- . /// assert_eq!(Ordering::Equal.is_ge(), true); . /// assert_eq!(Ordering::Greater.is_ge(), true); . /// ``` . #[inline] . #[must_use] . #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")] . #[stable(feature = "ordering_helpers", since = "1.53.0")] . pub const fn is_ge(self) -> bool { 917,520 ( 0.00%) self.as_raw() >= 0 . } . . /// Reverses the `Ordering`. . /// . /// * `Less` becomes `Greater`. . /// * `Greater` becomes `Less`. . /// * `Equal` becomes `Equal`. . /// -- line 559 ---------------------------------------- -- line 1043 ---------------------------------------- . #[inline] . #[must_use] . #[rustc_diagnostic_item = "cmp_ord_max"] . fn max(self, other: Self) -> Self . where . Self: Sized + [const] Destruct, . { . if other < self { self } else { other } 45,336,084 ( 0.22%) } . . /// Compares and returns the minimum of two values. . /// . /// Returns the first argument if the comparison determines them to be equal. . /// . /// # Examples . /// . /// ``` -- line 1059 ---------------------------------------- -- line 1082 ---------------------------------------- . #[inline] . #[must_use] . #[rustc_diagnostic_item = "cmp_ord_min"] . fn min(self, other: Self) -> Self . where . Self: Sized + [const] Destruct, . { . if other < self { other } else { self } 47 ( 0.00%) } . . /// Restrict a value to a certain interval. . /// . /// Returns `max` if `self` is greater than `max`, and `min` if `self` is . /// less than `min`. Otherwise this returns `self`. . /// . /// # Panics . /// -- line 1098 ---------------------------------------- -- line 1722 ---------------------------------------- . #[stable(feature = "cmp_min_max_by", since = "1.53.0")] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . pub const fn max_by Ordering>( . v1: T, . v2: T, . compare: F, . ) -> T { . if compare(&v1, &v2).is_gt() { v1 } else { v2 } 48 ( 0.00%) } . . /// Returns the element that gives the maximum value from the specified function. . /// . /// Returns the second argument if the comparison determines them to be equal. . /// . /// # Examples . /// . /// ``` -- line 1738 ---------------------------------------- -- line 1889 ---------------------------------------- . /// NOTE: Calling this on a non-primitive type (such as `()`) . /// leads to an infinitely-looping self-recursive implementation. . macro_rules! impl_partial_eq_for_primitive { . ($($t:ty)*) => ($( . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . const impl PartialEq for $t { . #[inline] 431 ( 0.00%) fn eq(&self, other: &Self) -> bool { *self == *other } . // Override the default to use the primitive implementation for `!=`. . #[inline] . fn ne(&self, other: &Self) -> bool { *self != *other } . } . )*) . } . . impl_partial_eq_for_primitive! { -- line 1905 ---------------------------------------- -- line 1928 ---------------------------------------- . } . . eq_impl! { () bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } . . #[rustfmt::skip] . macro_rules! partial_ord_methods_primitive_impl { . () => { . #[inline(always)] 116 ( 0.00%) fn lt(&self, other: &Self) -> bool { *self < *other } . #[inline(always)] . fn le(&self, other: &Self) -> bool { *self <= *other } . #[inline(always)] . fn gt(&self, other: &Self) -> bool { *self > *other } . #[inline(always)] . fn ge(&self, other: &Self) -> bool { *self >= *other } . . // These implementations are the same for `Ord` or `PartialOrd` types -- line 1944 ---------------------------------------- -- line 2135 ---------------------------------------- . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . const impl PartialEq<&B> for &A . where . A: [const] PartialEq, . { . #[inline] . fn eq(&self, other: &&B) -> bool { 1 ( 0.00%) PartialEq::eq(*self, *other) . } . #[inline] . fn ne(&self, other: &&B) -> bool { . PartialEq::ne(*self, *other) . } . } . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -- line 2151 ---------------------------------------- 11,334,055 ( 0.06%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/needless_update.rs -------------------------------------------------------------------------------- Ir -- line 44 ---------------------------------------- . pub NEEDLESS_UPDATE, . complexity, . "using `Foo { ..base }` when there are no missing fields" . } . . declare_lint_pass!(NeedlessUpdate => [NEEDLESS_UPDATE]); . . impl<'tcx> LateLintPass<'tcx> for NeedlessUpdate { 1,966,115 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) if let ExprKind::Struct(_, fields, StructTailExpr::Base(base)) = expr.kind { . let ty = cx.typeck_results().expr_ty(expr); . if let ty::Adt(def, _) = ty.kind() . && fields.len() == def.non_enum_variant().fields.len() . && !def.variant(0_usize.into()).is_field_list_non_exhaustive() . { . span_lint( . cx, . NEEDLESS_UPDATE, . base.span, . "struct update has no effect, all the fields in the struct have already been specified", . ); . } . } 2,359,338 ( 0.01%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/utils/dump_hir.rs -------------------------------------------------------------------------------- Ir -- line 18 ---------------------------------------- . /// fn foo(input: u32) -> u64 { . /// input as u64 . /// } . /// ``` . DumpHir => [] . ); . . impl<'tcx> LateLintPass<'tcx> for DumpHir { 32 ( 0.00%) fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { 5 ( 0.00%) if has_attr(cx, item.hir_id()) { . println!("{item:#?}"); . } 32 ( 0.00%) } . 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { 1,179,669 ( 0.01%) if has_attr(cx, expr.hir_id) { . println!("{expr:#?}"); . } 3,145,784 ( 0.02%) } . 9 ( 0.00%) fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) { 5 ( 0.00%) match stmt.kind { 4 ( 0.00%) hir::StmtKind::Expr(e) | hir::StmtKind::Semi(e) if has_attr(cx, e.hir_id) => return, . _ => {}, . } 2 ( 0.00%) if has_attr(cx, stmt.hir_id) { . println!("{stmt:#?}"); . } 8 ( 0.00%) } . . fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &TraitItem<'_>) { . if has_attr(cx, item.hir_id()) { . println!("{item:#?}"); . } . } . . fn check_impl_item(&mut self, cx: &LateContext<'_>, item: &hir::ImplItem<'_>) { . if has_attr(cx, item.hir_id()) { . println!("{item:#?}"); . } . } . } . . fn has_attr(cx: &LateContext<'_>, hir_id: hir::HirId) -> bool { 786,463 ( 0.00%) let attrs = cx.tcx.hir_attrs(hir_id); 218 ( 0.00%) => ???:::hir_attrs (4x) 1 ( 0.00%) get_builtin_attr(attrs, sym::dump).count() > 0 . } 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/useless_conversion.rs -------------------------------------------------------------------------------- Ir -- line 127 ---------------------------------------- . } . . into_iter_span . } . . /// Extracts the receiver of a `.into_iter()` method call. . fn into_iter_call<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>) -> Option<&'hir Expr<'hir>> { . if let ExprKind::MethodCall(name, recv, [], _) = expr.kind 1 ( 0.00%) && name.ident.name == sym::into_iter . && cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::IntoIterator) . { . Some(recv) . } else { . None . } . } . -- line 143 ---------------------------------------- -- line 150 ---------------------------------------- . expr = recv; . depth += 1; . } . (expr, depth) . } . . #[expect(clippy::too_many_lines)] . impl<'tcx> LateLintPass<'tcx> for UselessConversion { 3,145,784 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 786,446 ( 0.00%) if e.span.from_expansion() { 15 ( 0.00%) if e.span.desugaring_kind().is_none() { 500 ( 0.00%) => ???:::desugaring_kind (5x) 5 ( 0.00%) self.expn_depth += 1; . } . return; . } . . if Some(&e.hir_id) == self.try_desugar_arm.last() { . return; . } . 2,752,524 ( 0.01%) match e.kind { . ExprKind::Match(_, arms, MatchSource::TryDesugar(_)) => { . let (ExprKind::Ret(Some(e)) | ExprKind::Break(_, Some(e))) = arms[0].body.kind else { . return; . }; . if let ExprKind::Call(_, [arg, ..]) = e.kind { . self.try_desugar_arm.push(arg.hir_id); . } . }, . 3 ( 0.00%) ExprKind::MethodCall(path, recv, [arg], _) => { . if matches!( . path.ident.name, . sym::map | sym::map_err | sym::map_break | sym::map_continue . ) && has_eligible_receiver(cx, recv, e) . && matches!( . arg.res(cx).assoc_parent(cx).opt_diag_name(cx), . Some(sym::Into | sym::From) . ) -- line 188 ---------------------------------------- -- line 202 ---------------------------------------- . "consider removing", . Applicability::MachineApplicable, . ); . }, . ); . } . }, . 2 ( 0.00%) ExprKind::MethodCall(name, recv, [], _) => { 1 ( 0.00%) if name.ident.name == sym::into && cx.ty_based_def(e).opt_parent(cx).is_diag_item(cx, sym::Into) { . let a = cx.typeck_results().expr_ty(e); . let b = cx.typeck_results().expr_ty(recv); . if same_type_modulo_regions(a, b) { . let mut app = Applicability::MachineApplicable; . let sugg = snippet_with_context(cx, recv.span, e.span.ctxt(), "", &mut app).0; . span_lint_and_sugg( . cx, . USELESS_CONVERSION, -- line 219 ---------------------------------------- -- line 220 ---------------------------------------- . e.span, . format!("useless conversion to the same type: `{b}`"), . "consider removing `.into()`", . sugg.into_owned(), . app, . ); . } . } 3 ( 0.00%) if let Some(into_iter_recv) = into_iter_call(cx, e) . // Make sure that there is no parent expression, or if there is, make sure it's not a `.into_iter()` call. . // The reason for that is that we only want to lint once (the outermost call) . // in cases like `foo.into_iter().into_iter()` . && get_parent_expr(cx, e) . .and_then(|parent| into_iter_call(cx, parent)) . .is_none() . { . if let Some(parent) = get_parent_expr(cx, e) { -- line 236 ---------------------------------------- -- line 388 ---------------------------------------- . e.span, . format!("useless conversion to the same type: `{into_iter_ty}`"), . "consider removing `.into_iter()`", . sugg, . applicability, . ); . } . } 1 ( 0.00%) if name.ident.name == sym::try_into . && cx.ty_based_def(e).opt_parent(cx).is_diag_item(cx, sym::TryInto) . && let a = cx.typeck_results().expr_ty(e) . && let b = cx.typeck_results().expr_ty(recv) . && a.is_diag_item(cx, sym::Result) . && let ty::Adt(_, args) = a.kind() . && let Some(a_type) = args.types().next() . && same_type_modulo_regions(a_type, b) . { -- line 404 ---------------------------------------- -- line 450 ---------------------------------------- . app, . ); . } . } . }, . . _ => {}, . } 3,145,784 ( 0.02%) } . . fn check_expr_post(&mut self, _: &LateContext<'tcx>, e: &'tcx Expr<'_>) { . if Some(&e.hir_id) == self.try_desugar_arm.last() { . self.try_desugar_arm.pop(); . } 786,461 ( 0.00%) if e.span.from_expansion() && e.span.desugaring_kind().is_none() { 500 ( 0.00%) => ???:::desugaring_kind (5x) 5 ( 0.00%) self.expn_depth -= 1; . } . } . } . . fn has_eligible_receiver(cx: &LateContext<'_>, recv: &Expr<'_>, expr: &Expr<'_>) -> bool { . if cx.ty_based_def(expr).opt_parent(cx).is_impl(cx) { . matches!( . cx.typeck_results().expr_ty(recv).opt_diag_name(cx), -- line 473 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/manual_float_methods.rs -------------------------------------------------------------------------------- Ir -- line 128 ---------------------------------------- . | DefKind::Ctor(..) . | DefKind::AssocConst { .. } => false, . . DefKind::Fn | DefKind::AssocFn | DefKind::Closure => tcx.constness(def_id) == Constness::NotConst, . } . } . . impl<'tcx> LateLintPass<'tcx> for ManualFloatMethods { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { 786,447 ( 0.00%) if let ExprKind::Binary(kind, lhs, rhs) = expr.kind 2 ( 0.00%) && let ExprKind::Binary(lhs_kind, lhs_lhs, lhs_rhs) = lhs.kind . && let ExprKind::Binary(rhs_kind, rhs_lhs, rhs_rhs) = rhs.kind . // Checking all possible scenarios using a function would be a hopeless task, as we have . // 16 possible alignments of constants/operands. For now, let's use `partition`. . && let mut exprs = [lhs_lhs, lhs_rhs, rhs_lhs, rhs_rhs] . && exprs.iter_mut().partition_in_place(|i| i.res_local_id().is_some()) == 2 . && !expr.span.in_external_macro(cx.sess().source_map()) . && ( . is_not_const(cx.tcx, cx.tcx.hir_enclosing_body_owner(expr.hir_id).into()) -- line 146 ---------------------------------------- -- line 197 ---------------------------------------- . "or, for conciseness", . format!("!{local_snippet}.is_infinite()"), . Applicability::MaybeIncorrect, . ); . }, . } . }); . } 3,145,784 ( 0.02%) } . } -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs -------------------------------------------------------------------------------- Ir -- line 151 ---------------------------------------- . } . . // Tiny Vecs are dumb. Skip to: . // - 8 if the element size is 1, because any heap allocator is likely . // to round up a request of less than 8 bytes to at least 8 bytes. . // - 4 if elements are moderate-sized (<= 1 KiB). . // - 1 otherwise, to avoid wasting too much space for very short Vecs. . const fn min_non_zero_cap(size: usize) -> usize { 79,337,944 ( 0.39%) if size == 1 { . 8 . } else if size <= 1024 { . 4 . } else { . 1 . } . } . -- line 167 ---------------------------------------- -- line 178 ---------------------------------------- . _marker: PhantomData, . } . } . . /// A specialized version of `self.reserve(len, 1)` which requires the . /// caller to ensure `len == self.capacity()`. . #[cfg(not(no_global_oom_handling))] . #[inline(never)] 12 ( 0.00%) pub(crate) fn grow_one(&mut self) { . // SAFETY: All calls on self.inner pass T::LAYOUT as the elem_layout . unsafe { self.inner.grow_one(T::LAYOUT) } 12 ( 0.00%) } . } . . impl RawVec { . #[cfg(not(no_global_oom_handling))] . pub(crate) const MIN_NON_ZERO_CAP: usize = min_non_zero_cap(size_of::()); . . /// Like `new`, but parameterized over the choice of allocator for . /// the returned `RawVec`. -- line 197 ---------------------------------------- -- line 417 ---------------------------------------- . } . } . . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . const unsafe impl<#[may_dangle] T, A: [const] Allocator + [const] Destruct> Drop for RawVec { . /// Frees the memory owned by the `RawVec` *without* trying to drop its contents. . fn drop(&mut self) { . // SAFETY: We are in a Drop impl, self.inner will not be used again. 4,765,059 ( 0.02%) unsafe { self.inner.deallocate(T::LAYOUT) } . } . } . . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . #[rustfmt::skip] // FIXME(fee1-dead): temporary measure before rustfmt is bumped . const impl RawVecInner { . #[cfg(not(no_global_oom_handling))] . #[inline] -- line 433 ---------------------------------------- -- line 453 ---------------------------------------- . // We avoid `unwrap_or_else` here because it bloats the amount of . // LLVM IR generated. . let layout = match layout_array(capacity, elem_layout) { . Ok(layout) => layout, . Err(_) => return Err(CapacityOverflow.into()), . }; . . // Don't allocate here because `Drop` will not deallocate when `capacity` is 0. 236,678 ( 0.00%) if layout.size() == 0 { . return Ok(Self::new_in(alloc, elem_layout.alignment())); . } . . let result = match init { . AllocInit::Uninitialized => alloc.allocate(layout), . #[cfg(not(no_global_oom_handling))] . AllocInit::Zeroed => alloc.allocate_zeroed(layout), . }; 118,657 ( 0.00%) let ptr = match result { . Ok(ptr) => ptr, . Err(_) => return Err(AllocError { layout, non_exhaustive: () }.into()), . }; . . // Allocators currently return a `NonNull<[u8]>` whose length . // matches the size requested. If that ever changes, the capacity . // here should change to `ptr.len() / size_of::()`. . Ok(Self { -- line 478 ---------------------------------------- -- line 485 ---------------------------------------- . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment . #[cfg(not(no_global_oom_handling))] . #[inline] . unsafe fn grow_one(&mut self, elem_layout: Layout) { . // SAFETY: Precondition passed to caller 3 ( 0.00%) if let Err(err) = unsafe { self.grow_amortized(self.cap.as_inner(), 1, elem_layout) } { . handle_error(err); . } . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment -- line 501 ---------------------------------------- -- line 504 ---------------------------------------- . &mut self, . len: usize, . additional: usize, . elem_layout: Layout, . ) -> Result<(), TryReserveError> { . // This is ensured by the calling contexts. . debug_assert!(additional > 0); . 22,667,984 ( 0.11%) if elem_layout.size() == 0 { . // Since we return a capacity of `usize::MAX` when `elem_size` is . // 0, getting to here necessarily means the `RawVec` is overfull. . return Err(CapacityOverflow.into()); . } . . // Nothing we can really do about these checks, sadly. . let required_cap = len.checked_add(additional).ok_or(CapacityOverflow)?; . . // This guarantees exponential growth. The doubling cannot overflow . // because `cap <= isize::MAX` and the type of `cap` is `usize`. 22,667,989 ( 0.11%) let cap = cmp::max(self.cap.as_inner() * 2, required_cap); . let cap = cmp::max(min_non_zero_cap(elem_layout.size()), cap); . . // SAFETY: . // - cap >= len + additional . // - other preconditions passed to caller 34,001,998 ( 0.17%) let ptr = unsafe { self.finish_grow(cap, elem_layout)? }; 1,424,847,089 ( 7.01%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::finish_grow (11,333,993x) . . // SAFETY: `finish_grow` would have failed if `cap > isize::MAX` . unsafe { self.set_ptr_and_cap(ptr, cap) }; . Ok(()) . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment . /// - `cap` must be greater than the current capacity . // not marked inline(never) since we want optimizers to be able to observe the specifics of this . // function, see tests/codegen-llvm/vec-reserve-extend.rs. . #[cold] 90,671,996 ( 0.45%) unsafe fn finish_grow( . &self, . cap: usize, . elem_layout: Layout, . ) -> Result, TryReserveError> { . let new_layout = layout_array(cap, elem_layout)?; . . let memory = if let Some((ptr, old_layout)) = unsafe { self.current_memory(elem_layout) } { . // FIXME(const-hack): switch to `debug_assert_eq` -- line 552 ---------------------------------------- -- line 556 ---------------------------------------- . hint::assert_unchecked(old_layout.align() == new_layout.align()); . self.alloc.grow(ptr, old_layout, new_layout) . } . } else { . self.alloc.allocate(new_layout) . }; . . memory.map_err(const |_| AllocError { layout: new_layout, non_exhaustive: () }.into()) 68,003,998 ( 0.33%) } . } . . impl RawVecInner { . #[inline] . const fn new_in(alloc: A, align: Alignment) -> Self { . let ptr = Unique::from_non_null(NonNull::without_provenance(align.as_nonzero_usize())); . // `cap: 0` means "unallocated". zero-sized types are ignored. . Self { ptr, cap: ZERO_CAP, alloc } -- line 572 ---------------------------------------- -- line 603 ---------------------------------------- . . #[inline] . const fn ptr(&self) -> *mut T { . self.non_null::().as_ptr() . } . . #[inline] . const fn non_null(&self) -> NonNull { 3,862,251 ( 0.02%) self.ptr.cast().as_non_null_ptr() . } . . #[inline] . const fn capacity(&self, elem_size: usize) -> usize { 24,380,876 ( 0.12%) if elem_size == 0 { usize::MAX } else { self.cap.as_inner() } . } . . #[inline] . const fn allocator(&self) -> &A { . &self.alloc . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment . #[inline] . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . const unsafe fn current_memory(&self, elem_layout: Layout) -> Option<(NonNull, Layout)> { 24,534,286 ( 0.12%) if elem_layout.size() == 0 || self.cap.as_inner() == 0 { . None . } else { . // We could use Layout::array here which ensures the absence of isize and usize overflows . // and could hypothetically handle differences between stride and size, but this memory . // has already been allocated so we know it can't overflow and currently Rust does not . // support such types. So we can do better by skipping some checks and avoid an unwrap. . unsafe { . let alloc_size = elem_layout.size().unchecked_mul(self.cap.as_inner()); -- line 639 ---------------------------------------- -- line 650 ---------------------------------------- . #[cfg(not(no_global_oom_handling))] . #[inline] . unsafe fn reserve(&mut self, len: usize, additional: usize, elem_layout: Layout) { . // Callers expect this function to be very cheap when there is already sufficient capacity. . // Therefore, we move all the resizing and error-handling logic from grow_amortized and . // handle_reserve behind a call, while making sure that this function is likely to be . // inlined as just a comparison and a call if the comparison fails. . #[cold] 45,335,971 ( 0.22%) unsafe fn do_reserve_and_handle( . slf: &mut RawVecInner, . len: usize, . additional: usize, . elem_layout: Layout, . ) { . // SAFETY: Precondition passed to caller . if let Err(err) = unsafe { slf.grow_amortized(len, additional, elem_layout) } { . handle_error(err); . } 45,335,972 ( 0.22%) } . 24,380,855 ( 0.12%) if self.needs_to_grow(len, additional, elem_layout) { . unsafe { 90,671,895 ( 0.45%) do_reserve_and_handle(self, len, additional, elem_layout); 139 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:>::reserve::do_reserve_and_handle:: (1x) . } . } . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment -- line 680 ---------------------------------------- -- line 756 ---------------------------------------- . cap: usize, . elem_layout: Layout, . ) -> Result<(), TryReserveError> { . unsafe { self.shrink(cap, elem_layout) } . } . . #[inline] . const fn needs_to_grow(&self, len: usize, additional: usize, elem_layout: Layout) -> bool { 24,381,393 ( 0.12%) additional > self.capacity(elem_layout.size()).wrapping_sub(len) . } . . #[inline] . #[rustc_const_unstable(feature = "const_heap", issue = "79597")] . const unsafe fn set_ptr_and_cap(&mut self, ptr: NonNull<[u8]>, cap: usize) { . // Allocators currently return a `NonNull<[u8]>` whose length matches . // the size requested. If that ever changes, the capacity here should . // change to `ptr.len() / size_of::()`. 11,333,998 ( 0.06%) self.ptr = Unique::from(ptr.cast()); 11,333,996 ( 0.06%) self.cap = unsafe { Cap::new_unchecked(cap) }; . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to . /// initially construct `self` . /// - `elem_layout`'s size must be a multiple of its alignment . /// - The sum of `len` and `additional` must be greater than the current capacity . unsafe fn grow_exact( -- line 782 ---------------------------------------- -- line 789 ---------------------------------------- . // Since we return a capacity of `usize::MAX` when the type size is . // 0, getting to here necessarily means the `RawVec` is overfull. . return Err(CapacityOverflow.into()); . } . . let cap = len.checked_add(additional).ok_or(CapacityOverflow)?; . . // SAFETY: preconditions passed to caller 28 ( 0.00%) let ptr = unsafe { self.finish_grow(cap, elem_layout)? }; 509 ( 0.00%) => /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:::finish_grow (2x) . . // SAFETY: `finish_grow` would have failed if `cap > isize::MAX` . unsafe { self.set_ptr_and_cap(ptr, cap) }; . Ok(()) . } . . /// # Safety . /// - `elem_layout` must be valid for `self`, i.e. it must be the same `elem_layout` used to -- line 805 ---------------------------------------- -- line 824 ---------------------------------------- . /// # Safety . /// `cap <= self.capacity()` . unsafe fn shrink_unchecked( . &mut self, . cap: usize, . elem_layout: Layout, . ) -> Result<(), TryReserveError> { . // SAFETY: Precondition passed to caller 1 ( 0.00%) let Some((ptr, layout)) = (unsafe { self.current_memory(elem_layout) }) else { . return Ok(()); . }; . . // If shrinking to 0, deallocate the buffer. We don't reach this point . // for the T::IS_ZST case since current_memory() will have returned . // None. 2 ( 0.00%) if cap == 0 { . unsafe { self.alloc.deallocate(ptr, layout) }; . self.ptr = . unsafe { Unique::new_unchecked(ptr::without_provenance_mut(elem_layout.align())) }; . self.cap = ZERO_CAP; . } else { . let ptr = unsafe { . // Layout cannot overflow here because it would have . // overflowed earlier when capacity was larger. -- line 847 ---------------------------------------- 19,856,070 ( 0.10%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs -------------------------------------------------------------------------------- Ir -- line 30 ---------------------------------------- . match (ptr).guaranteed_eq(null_mut()) { . Some(res) => res, . // To remain maximally conservative, we stop execution when we don't . // know whether the pointer is null or not. . // We can *not* return `false` here, that would be unsound in `NonNull::new`! . None => panic!("null-ness of this pointer cannot be determined in const context"), . } . } else { 786,754 ( 0.00%) ptr.addr() == 0 . } . ) . } . . /// Casts to a pointer of another type. . #[stable(feature = "ptr_cast", since = "1.38.0")] . #[rustc_const_stable(feature = "const_ptr_cast", since = "1.38.0")] . #[rustc_diagnostic_item = "const_ptr_cast"] -- line 46 ---------------------------------------- -- line 262 ---------------------------------------- . /// [`as_uninit_ref`]: #method.as_uninit_ref . /// [`as_ref_unchecked`]: #method.as_ref_unchecked . #[stable(feature = "ptr_as_ref", since = "1.9.0")] . #[rustc_const_stable(feature = "const_ptr_is_null", since = "1.84.0")] . #[inline] . pub const unsafe fn as_ref<'a>(self) -> Option<&'a T> { . // SAFETY: the caller must guarantee that `self` is valid . // for a reference if it isn't null. 393,322 ( 0.00%) if self.is_null() { None } else { unsafe { Some(&*self) } } . } . . /// Returns a shared reference to the value behind the pointer. . /// If the pointer may be null or the value may be uninitialized, [`as_uninit_ref`] must be used instead. . /// If the pointer may be null, but the value is known to have been initialized, [`as_ref`] must be used instead. . /// . /// [`as_ref`]: #method.as_ref . /// [`as_uninit_ref`]: #method.as_uninit_ref -- line 278 ---------------------------------------- -- line 615 ---------------------------------------- . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . pub const unsafe fn offset_from(self, origin: *const T) -> isize . where . T: Sized, . { . let pointee_size = size_of::(); . assert!(0 < pointee_size && pointee_size <= isize::MAX as usize); . // SAFETY: the caller must uphold the safety contract for `ptr_offset_from`. 48 ( 0.00%) unsafe { intrinsics::ptr_offset_from(self, origin) } . } . . /// Calculates the distance between two pointers within the same allocation. The returned value is in . /// units of **bytes**. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [`offset_from`][pointer::offset_from] on it. See that method for . /// documentation and safety requirements. -- line 631 ---------------------------------------- -- line 725 ---------------------------------------- . this: *const () = self as *const (), . origin: *const () = origin as *const (), . ) => runtime_ptr_ge(this, origin) . ); . . let pointee_size = size_of::(); . assert!(0 < pointee_size && pointee_size <= isize::MAX as usize); . // SAFETY: the caller must uphold the safety contract for `ptr_offset_from_unsigned`. 87 ( 0.00%) unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } . } . . /// Calculates the distance between two pointers within the same allocation, *where it's known that . /// `self` is equal to or greater than `origin`*. The returned value is in . /// units of **bytes**. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [`offset_from_unsigned`][pointer::offset_from_unsigned] on it. -- line 741 ---------------------------------------- -- line 863 ---------------------------------------- . ( . this: *const () = self as *const (), . count: usize = count, . size: usize = size_of::(), . ) => runtime_add_nowrap(this, count, size) . ); . . // SAFETY: the caller must uphold the safety contract for `offset`. 1,243,367 ( 0.01%) unsafe { intrinsics::offset(self, count) } . } . . /// Adds an unsigned offset in bytes to a pointer. . /// . /// `count` is in units of bytes. . /// . /// This is purely a convenience for casting to a `u8` pointer and . /// using [add][pointer::add] on it. See that method for documentation -- line 879 ---------------------------------------- -- line 1590 ---------------------------------------- . #[diagnostic::on_const( . message = "pointers cannot be reliably compared during const eval", . note = "see issue #53020 for more information" . )] . impl PartialEq for *const T { . #[inline] . #[allow(ambiguous_wide_pointer_comparisons)] . fn eq(&self, other: &*const T) -> bool { 393,230 ( 0.00%) *self == *other . } . } . . /// Pointer equality is an equivalence relation. . #[stable(feature = "rust1", since = "1.0.0")] . #[diagnostic::on_const( . message = "pointers cannot be reliably compared during const eval", . note = "see issue #53020 for more information" -- line 1606 ---------------------------------------- 4,259,800 ( 0.02%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/fmt.rs -------------------------------------------------------------------------------- Ir -- line 651 ---------------------------------------- . let capacity = args.estimated_capacity(); . let mut output = string::String::with_capacity(capacity); . output . .write_fmt(args) . .expect("a formatting trait implementation returned an error when the underlying stream did not"); . output . } . 13,170,250 ( 0.06%) args.as_str().map_or_else(|| format_inner(args), crate::borrow::ToOwned::to_owned) 3,935,863,992 (19.36%) => ???:alloc::fmt::format::format_inner (3,014,562x) . } 718,945 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/rt.rs -------------------------------------------------------------------------------- Ir -- line 123 ---------------------------------------- . } . #[inline] . pub const fn new_upper_exp(x: &T) -> Argument<'_> { . argument_new!(T, x, ::fmt) . } . #[inline] . #[track_caller] . pub const fn from_usize(x: &usize) -> Argument<'_> { 9,043,533 ( 0.04%) if *x > u16::MAX as usize { . panic!("Formatting argument out of range"); . } . Argument { ty: ArgumentType::Count(*x as u16) } . } . . /// Format this placeholder argument. . /// . /// # Safety -- line 139 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs -------------------------------------------------------------------------------- Ir -- line 13 ---------------------------------------- . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . const impl PartialEq<[U]> for [T] . where . T: [const] PartialEq, . { . #[inline] . fn eq(&self, other: &[U]) -> bool { . let len = self.len(); 6,029,810 ( 0.03%) if len == other.len() { . // SAFETY: Just checked that they're the same length, and the pointers . // come from references-to-slices so they're guaranteed readable. . unsafe { SlicePartialEq::equal_same_length(self.as_ptr(), other.as_ptr(), len) } . } else { . false . } . } . } -- line 29 ---------------------------------------- -- line 149 ---------------------------------------- . { . #[inline] . unsafe fn equal_same_length(lhs: *const Self, rhs: *const B, len: usize) -> bool { . // SAFETY: by our precondition, `lhs` and `rhs` are guaranteed to be valid . // for reading `len` values, which also means the size is guaranteed . // not to overflow because it exists in memory; . unsafe { . let size = crate::intrinsics::unchecked_mul(len, Self::SIZE); 34,285,499 ( 0.17%) compare_bytes(lhs as _, rhs as _, size) == 0 72 ( 0.00%) => ???:0x0000000000173660 (4x) . } . } . } . . #[doc(hidden)] . #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] . // intermediate trait for specialization of slice's PartialOrd . const trait SlicePartialOrd: Sized { -- line 165 ---------------------------------------- -- line 429 ---------------------------------------- . // SIMD . let mut chunks = arr.chunks_exact(LANE_COUNT); . for chunk in &mut chunks { . if chunk.iter().fold(false, |acc, x| acc | (*x == *self)) { . return true; . } . } . // Scalar remainder 977 ( 0.00%) return chunks.remainder().iter().any(|x| *x == *self); . } . } . )* . }; . } . . impl_slice_contains!(u16, u32, u64, i16, i32, i64, f32, f64, usize, isize, char); 64,703 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/neg_cmp_op_on_partial_ord.rs -------------------------------------------------------------------------------- Ir -- line 38 ---------------------------------------- . pub NEG_CMP_OP_ON_PARTIAL_ORD, . complexity, . "The use of negated comparison operators on partially ordered types may produce confusing code." . } . . declare_lint_pass!(NoNegCompOpForPartialOrd => [NEG_CMP_OP_ON_PARTIAL_ORD]); . . impl<'tcx> LateLintPass<'tcx> for NoNegCompOpForPartialOrd { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,449 ( 0.00%) if let ExprKind::Unary(UnOp::Not, inner) = expr.kind 2 ( 0.00%) && let ExprKind::Binary(ref op, left, _) = inner.kind 3 ( 0.00%) && let BinOpKind::Le | BinOpKind::Ge | BinOpKind::Lt | BinOpKind::Gt = op.node . && !expr.span.in_external_macro(cx.sess().source_map()) . { . let ty = cx.typeck_results().expr_ty(left); . . let implements_ord = { . if let Some(id) = cx.tcx.get_diagnostic_item(sym::Ord) { . implements_trait(cx, ty, id, &[]) . } else { -- line 57 ---------------------------------------- -- line 74 ---------------------------------------- . expr.span, . "the use of negated comparison operators on partially ordered \ . types produces code that is hard to read and refactor, please \ . consider using the `partial_cmp` method instead, to make it \ . clear that the two values could be incomparable", . ); . } . } 3,145,784 ( 0.02%) } . } 4 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/box_default.rs -------------------------------------------------------------------------------- Ir -- line 31 ---------------------------------------- . pub BOX_DEFAULT, . style, . "Using Box::new(T::default()) instead of Box::default()" . } . . declare_lint_pass!(BoxDefault => [BOX_DEFAULT]); . . impl LateLintPass<'_> for BoxDefault { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { . // If the expression is a call (`Box::new(...)`) 786,449 ( 0.00%) if let ExprKind::Call(box_new, [arg]) = expr.kind . // And call is of the form `::something` . // Here, it would be `::new` 4 ( 0.00%) && let ExprKind::Path(QPath::TypeRelative(ty, seg)) = box_new.kind . // And that method is `new` . && seg.ident.name == sym::new . // And the call is that of a `Box` method . && ty.basic_res().is_lang_item(cx, LangItem::OwnedBox) . // And the single argument to the call is another function call . // This is the `T::default()` (or default equivalent) of `Box::new(T::default())` . && let ExprKind::Call(arg_path, _) = arg.kind . // And we are not in a foreign crate's macro -- line 52 ---------------------------------------- -- line 62 ---------------------------------------- . BOX_DEFAULT, . expr.span, . "`Box::new(_)` of default value", . "try", . "Box::default()".into(), . Applicability::MachineApplicable, . ); . } 3,145,784 ( 0.02%) } . } . . fn is_plain_default(cx: &LateContext<'_>, arg_path: &Expr<'_>) -> bool { . // we need to match the actual path so we don't match e.g. "u8::default" . if let ExprKind::Path(QPath::Resolved(None, path)) = &arg_path.kind . && let Res::Def(_, def_id) = path.res . { . // avoid generic parameters -- line 78 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/operators/eq_op.rs -------------------------------------------------------------------------------- Ir -- line 2 ---------------------------------------- . use clippy_utils::diagnostics::{span_lint, span_lint_and_then}; . use clippy_utils::macros::{find_assert_eq_args, first_node_macro_backtrace}; . use clippy_utils::{eq_expr_value, is_in_test_function, sym}; . use rustc_hir::{BinOpKind, Expr}; . use rustc_lint::LateContext; . . use super::EQ_OP; . 3,539,007 ( 0.02%) pub(crate) fn check_assert<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { 393,223 ( 0.00%) if let Some(macro_call) = first_node_macro_backtrace(cx, e).find(|macro_call| { 6 ( 0.00%) matches!( 4 ( 0.00%) cx.tcx.get_diagnostic_name(macro_call.def_id), 87 ( 0.00%) => ???:::get_diagnostic_name (1x) . Some(sym::assert_eq_macro | sym::assert_ne_macro | sym::debug_assert_eq_macro | sym::debug_assert_ne_macro) . ) . }) && let Some((lhs, rhs, _)) = find_assert_eq_args(cx, e, macro_call.expn) . && eq_expr_value(cx, macro_call.span.ctxt(), lhs, rhs) . && macro_call.is_local() . && !is_in_test_function(cx.tcx, e.hir_id) . { . span_lint( -- line 21 ---------------------------------------- -- line 23 ---------------------------------------- . EQ_OP, . lhs.span.to(rhs.span), . format!( . "identical args used in this `{}!` macro call", . cx.tcx.item_name(macro_call.def_id) . ), . ); . } 3,145,784 ( 0.02%) } . 9 ( 0.00%) pub(crate) fn check<'tcx>( . cx: &LateContext<'tcx>, . e: &'tcx Expr<'_>, . op: BinOpKind, . left: &'tcx Expr<'_>, . right: &'tcx Expr<'_>, . ) { . if is_useless_with_eq_exprs(op) 7 ( 0.00%) && eq_expr_value(cx, e.span.ctxt(), left, right) 616 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/hir_utils.rs:clippy_utils::hir_utils::eq_expr_value (1x) . && !is_in_test_function(cx.tcx, e.hir_id) . { . span_lint_and_then( . cx, . EQ_OP, . e.span, . format!("equal expressions as operands to `{}`", op.as_str()), . |diag| { -- line 49 ---------------------------------------- -- line 50 ---------------------------------------- . if let BinOpKind::Ne = op . && cx.typeck_results().expr_ty(left).is_floating_point() . { . diag.note("if you intended to check if the operand is NaN, use `.is_nan()` instead"); . } . }, . ); . } 8 ( 0.00%) } 1,179,673 ( 0.01%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs -------------------------------------------------------------------------------- Ir -- line 129 ---------------------------------------- . /// assert!(b.is_empty()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")] . #[rustc_no_implicit_autorefs] . #[inline] . #[must_use] . pub const fn is_empty(&self) -> bool { 1 ( 0.00%) self.len() == 0 . } . . /// Returns the first element of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let v = [10, 40, 30]; -- line 145 ---------------------------------------- -- line 148 ---------------------------------------- . /// let w: &[i32] = &[]; . /// assert_eq!(None, w.first()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . #[must_use] . pub const fn first(&self) -> Option<&T> { 1,573,130 ( 0.01%) if let [first, ..] = self { Some(first) } else { None } . } . . /// Returns a mutable reference to the first element of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 164 ---------------------------------------- -- line 191 ---------------------------------------- . /// assert_eq!(elements, &[1, 2]); . /// } . /// ``` . #[stable(feature = "slice_splits", since = "1.5.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . #[must_use] . pub const fn split_first(&self) -> Option<(&T, &[T])> { 192 ( 0.00%) if let [first, tail @ ..] = self { Some((first, tail)) } else { None } . } . . /// Returns the first and all the rest of the elements of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 207 ---------------------------------------- -- line 274 ---------------------------------------- . /// let w: &[i32] = &[]; . /// assert_eq!(None, w.last()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . #[must_use] . pub const fn last(&self) -> Option<&T> { 4,718,754 ( 0.02%) if let [.., last] = self { Some(last) } else { None } . } . . /// Returns a mutable reference to the last item in the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 290 ---------------------------------------- -- line 297 ---------------------------------------- . /// let y: &mut [i32] = &mut []; . /// assert_eq!(None, y.last_mut()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_first_last", since = "1.83.0")] . #[inline] . #[must_use] . pub const fn last_mut(&mut self) -> Option<&mut T> { 4 ( 0.00%) if let [.., last] = self { Some(last) } else { None } . } . . /// Returns an array reference to the first `N` items in the slice. . /// . /// If the slice is not at least `N` in length, this will return `None`. . /// . /// # Examples . /// -- line 313 ---------------------------------------- -- line 320 ---------------------------------------- . /// . /// let w: &[i32] = &[]; . /// assert_eq!(Some(&[]), w.first_chunk::<0>()); . /// ``` . #[inline] . #[stable(feature = "slice_first_last_chunk", since = "1.77.0")] . #[rustc_const_stable(feature = "slice_first_last_chunk", since = "1.77.0")] . pub const fn first_chunk(&self) -> Option<&[T; N]> { 6 ( 0.00%) if self.len() < N { . None . } else { . // SAFETY: We explicitly check for the correct number of elements, . // and do not let the reference outlive the slice. . Some(unsafe { &*(self.as_ptr().cast_array()) }) . } . } . -- line 336 ---------------------------------------- -- line 2155 ---------------------------------------- . /// . /// assert_eq!(None, v.split_at_checked(7)); . /// ``` . #[stable(feature = "split_at_checked", since = "1.80.0")] . #[rustc_const_stable(feature = "split_at_checked", since = "1.80.0")] . #[inline] . #[must_use] . pub const fn split_at_checked(&self, mid: usize) -> Option<(&[T], &[T])> { 4 ( 0.00%) if mid <= self.len() { . // SAFETY: `[ptr; mid]` and `[mid; len]` are inside `self`, which . // fulfills the requirements of `split_at_unchecked`. . Some(unsafe { self.split_at_unchecked(mid) }) . } else { . None . } . } . -- line 2171 ---------------------------------------- -- line 2627 ---------------------------------------- . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use] . pub fn starts_with(&self, needle: &[T]) -> bool . where . T: PartialEq, . { . let n = needle.len(); 7,113,002 ( 0.03%) self.len() >= n && needle == &self[..n] . } . . /// Returns `true` if `needle` is a suffix of the slice or equal to the slice. . /// . /// # Examples . /// . /// ``` . /// let v = [10, 40, 30]; -- line 2643 ---------------------------------------- -- line 2658 ---------------------------------------- . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[must_use] . pub fn ends_with(&self, needle: &[T]) -> bool . where . T: PartialEq, . { . let (m, n) = (self.len(), needle.len()); 23 ( 0.00%) m >= n && needle == &self[m - n..] . } . . /// Returns a subslice with the prefix removed. . /// . /// If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. . /// If `prefix` is empty, simply returns the original slice. If `prefix` is equal to the . /// original slice, returns an empty slice. . /// -- line 2674 ---------------------------------------- 326,826 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/unicode.rs -------------------------------------------------------------------------------- Ir -- line 74 ---------------------------------------- . . declare_lint_pass!(Unicode => [ . INVISIBLE_CHARACTERS, . NON_ASCII_LITERAL, . UNICODE_NOT_NFC, . ]); . . impl LateLintPass<'_> for Unicode { 1,572,892 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) { 786,447 ( 0.00%) if let ExprKind::Lit(lit) = expr.kind 786,429 ( 0.00%) && let LitKind::Str(_, _) | LitKind::Char(_) = lit.node . { 2 ( 0.00%) check_str(cx, lit.span, expr.hir_id); . } 1,966,115 ( 0.01%) } . } . . fn escape>(s: T) -> String { . let mut result = String::new(); . for c in s { . if c as u32 > 0x7F { . for d in c.escape_unicode() { . result.push(d); -- line 96 ---------------------------------------- -- line 98 ---------------------------------------- . } else { . result.push(c); . } . } . result . } . . fn check_str(cx: &LateContext<'_>, span: Span, id: HirId) { 4 ( 0.00%) if !span_is_local(span) { 16 ( 0.00%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/macros.rs:clippy_utils::macros::span_is_local (1x) . return; . } . . let string = snippet(cx, span, ""); . // All three lints here can only fire when the snippet contains a non-ASCII character. Note . // that the snippet can contain non-ASCII characters even when the literal's value does not, . // e.g. the literal produced by `file!()` inside a macro spans the whole macro invocation. . if string.is_ascii() { -- line 114 ---------------------------------------- 2 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: /home/moon/.rustup/toolchains/nightly-2026-08-07-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs -------------------------------------------------------------------------------- Ir -- line 754 ---------------------------------------- . /// ``` . #[inline] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_atomic", issue = "160078")] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . pub const fn load(&self, order: Ordering) -> bool { . // SAFETY: any data races are prevented by atomic intrinsics and the raw . // pointer passed in is valid because we got it from a reference. 786,472 ( 0.00%) unsafe { atomic_load(self.v.get().cast::(), order) != 0 } . } . . /// Stores a value into the bool. . /// . /// `store` takes an [`Ordering`] argument which describes the memory ordering . /// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`]. . /// . /// # Panics -- line 770 ---------------------------------------- -- line 3986 ---------------------------------------- . . #[inline] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . #[rustc_const_unstable(feature = "const_atomic", issue = "160078")] . const unsafe fn atomic_load(dst: *const T, order: Ordering) -> T { . // SAFETY: the caller must uphold the safety contract for `atomic_load`. . unsafe { . match order { 786,465 ( 0.00%) Relaxed => intrinsics::atomic_load::(dst), 158 ( 0.00%) Acquire => intrinsics::atomic_load::(dst), 22 ( 0.00%) SeqCst => intrinsics::atomic_load::(dst), . Release => panic!("there is no such thing as a release load"), . AcqRel => panic!("there is no such thing as an acquire-release load"), . } . } . } . . #[inline] . #[cfg(target_has_atomic)] -- line 4004 ---------------------------------------- -- line 4021 ---------------------------------------- . #[inline] . #[cfg(target_has_atomic)] . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . #[rustc_const_unstable(feature = "const_atomic", issue = "160078")] . const unsafe fn atomic_add(dst: *mut T, val: U, order: Ordering) -> T { . // SAFETY: the caller must uphold the safety contract for `atomic_add`. . unsafe { . match order { 55 ( 0.00%) Relaxed => intrinsics::atomic_xadd::(dst, val), . Acquire => intrinsics::atomic_xadd::(dst, val), . Release => intrinsics::atomic_xadd::(dst, val), . AcqRel => intrinsics::atomic_xadd::(dst, val), . SeqCst => intrinsics::atomic_xadd::(dst, val), . } . } . } . -- line 4037 ---------------------------------------- -- line 4041 ---------------------------------------- . #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces . #[rustc_const_unstable(feature = "const_atomic", issue = "160078")] . const unsafe fn atomic_sub(dst: *mut T, val: U, order: Ordering) -> T { . // SAFETY: the caller must uphold the safety contract for `atomic_sub`. . unsafe { . match order { . Relaxed => intrinsics::atomic_xsub::(dst, val), . Acquire => intrinsics::atomic_xsub::(dst, val), 653,297 ( 0.00%) Release => intrinsics::atomic_xsub::(dst, val), . AcqRel => intrinsics::atomic_xsub::(dst, val), . SeqCst => intrinsics::atomic_xsub::(dst, val), . } . } . } . . /// Publicly exposed for stdarch; nobody else should use this. . #[inline] -- line 4057 ---------------------------------------- 1 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/loops/mod.rs -------------------------------------------------------------------------------- Ir -- line 852 ---------------------------------------- . Self { . msrv: conf.msrv.into(), . enforce_iter_loop_reborrow: conf.enforce_iter_loop_reborrow, . } . } . } . . impl<'tcx> LateLintPass<'tcx> for Loops { 4,325,453 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { 786,446 ( 0.00%) let for_loop = higher::ForLoop::hir(expr); 5,898,345 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_utils/src/higher.rs:::hir (393,223x) 393,223 ( 0.00%) if let Some(higher::ForLoop { . pat, . arg, . body, . loop_id, . span, . label, 786,446 ( 0.00%) }) = for_loop . { . // we don't want to check expanded macros . // this check is not at the top of the function . // since higher::for_loop expressions are marked as expansions . if body.span.from_expansion() { . return; . } . self.check_for_loop(cx, pat, arg, body, expr, span, label); . if let ExprKind::Block(block, _) = body.kind { . never_loop::check(cx, block, loop_id, span, for_loop.as_ref()); . } . } . . // we don't want to check expanded macros 786,446 ( 0.00%) if expr.span.from_expansion() { . return; . } . . // check for never_loop 1,179,654 ( 0.01%) if let ExprKind::Loop(block, ..) = expr.kind { . never_loop::check(cx, block, expr.hir_id, expr.span, None); . } . . // check for `loop { if let {} else break }` that could be `while let` . // (also matches an explicit "match" instead of "if let") . // (even if the "match" or "if let" is used for declaration) . // (also matches on `let {} else break`) . if let ExprKind::Loop(block, label, LoopSource::Loop, _) = expr.kind { . // also check for empty `loop {}` statements, skipping those in #[panic_handler] . empty_loop::check(cx, expr, block); . while_let_loop::check(cx, expr, block); . infinite_loop::check(cx, expr, block, label); . } . 786,436 ( 0.00%) while_let_on_iterator::check(cx, expr); 6,684,706 ( 0.03%) => /home/moon/git/rustc-perf/site/frontend/rust-clippy/clippy_lints/src/loops/while_let_on_iterator.rs:clippy_lints::loops::while_let_on_iterator::check (393,218x) . . if let Some(higher::While { . condition, body, span, .. . }) = higher::While::hir(expr) . { . while_immutable_condition::check(cx, condition, body); . while_float::check(cx, condition); . missing_spin_loop::check(cx, condition, body); . manual_while_let_some::check(cx, condition, body, span); . } . 786,440 ( 0.00%) if let ExprKind::MethodCall(path, recv, args, _) = expr.kind { 1 ( 0.00%) let name = path.ident.name; . . let is_iterator_method = || { . cx.ty_based_def(expr) . .assoc_fn_parent(cx) . .is_diag_item(cx, sym::Iterator) . }; . . // is_iterator_method is a bit expensive, so we call it last in each match arm . match (name, args) { 4 ( 0.00%) (sym::for_each | sym::all | sym::any, [arg]) => { . if let ExprKind::Closure(closure) = arg.kind . && is_iterator_method() . { . unused_enumerate_index::check_method(cx, recv, arg, closure); . never_loop::check_iterator_reduction(cx, expr, recv, closure); . } . }, . -- line 935 ---------------------------------------- -- line 947 ---------------------------------------- . { . never_loop::check_iterator_reduction(cx, expr, recv, closure); . } . }, . . _ => {}, . } . } 3,145,784 ( 0.02%) } . } . . impl Loops { . #[expect(clippy::too_many_arguments)] . fn check_for_loop<'tcx>( . &self, . cx: &LateContext<'tcx>, . pat: &'tcx Pat<'_>, -- line 963 ---------------------------------------- -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/casts/needless_type_cast.rs -------------------------------------------------------------------------------- Ir -- line 19 ---------------------------------------- . init: Option<&'a Expr<'a>>, . } . . struct UsageInfo<'a> { . cast_to: Option>, . in_generic_context: bool, . } . 24 ( 0.00%) pub(super) fn check<'a>(cx: &LateContext<'a>, body: &Body<'a>) { . let mut bindings: FxHashMap> = FxHashMap::default(); . 3 ( 0.00%) for_each_expr_without_closures(body.value, |expr| { 1,966,111 ( 0.01%) match expr.kind { 2 ( 0.00%) ExprKind::Block(block, _) => { 2 ( 0.00%) for stmt in block.stmts { 2 ( 0.00%) if let StmtKind::Let(let_stmt) = stmt.kind { . collect_binding_from_local(cx, let_stmt, &mut bindings); . } . } . }, . ExprKind::Let(let_expr) => { . collect_binding_from_let(cx, let_expr, &mut bindings); . }, . _ => {}, . } . ControlFlow::<()>::Continue(()) . }); . . #[allow(rustc::potential_query_instability)] 9 ( 0.00%) let mut binding_vec: Vec<_> = bindings.into_iter().collect(); . binding_vec.sort_by_key(|(_, info)| info.ty_span.lo()); . 3 ( 0.00%) for (hir_id, binding_info) in binding_vec { . check_binding_usages(cx, body, hir_id, &binding_info); . } 24 ( 0.00%) } . . fn collect_binding_from_let<'a>( . cx: &LateContext<'a>, . let_expr: &rustc_hir::LetExpr<'a>, . bindings: &mut FxHashMap>, . ) { . if let_expr.ty.is_none() . || let_expr.span.from_expansion() -- line 62 ---------------------------------------- 393,218 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/infinite_iter.rs -------------------------------------------------------------------------------- Ir -- line 48 ---------------------------------------- . pub MAYBE_INFINITE_ITER, . pedantic, . "possible infinite iteration" . } . . declare_lint_pass!(InfiniteIter => [INFINITE_ITER, MAYBE_INFINITE_ITER]); . . impl<'tcx> LateLintPass<'tcx> for InfiniteIter { 2,752,561 ( 0.01%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { . let (lint, msg) = match complete_infinite_iter(cx, expr) { . Infinite => (INFINITE_ITER, "infinite iteration detected"), . MaybeInfinite => (MAYBE_INFINITE_ITER, "possible infinite iteration detected"), . Finite => { . return; . }, . }; . span_lint(cx, lint, expr.span, msg); 2,359,338 ( 0.01%) } . } . . #[derive(Copy, Clone, Debug, PartialEq, Eq)] . enum Finiteness { . Infinite, . MaybeInfinite, . Finite, . } . . use self::Finiteness::{Finite, Infinite, MaybeInfinite}; . . impl Finiteness { . #[must_use] . fn and(self, b: Self) -> Self { 2 ( 0.00%) match (self, b) { . (Finite, _) | (_, Finite) => Finite, . (MaybeInfinite, _) | (_, MaybeInfinite) => MaybeInfinite, . _ => Infinite, . } . } . . #[must_use] . fn or(self, b: Self) -> Self { -- line 88 ---------------------------------------- -- line 138 ---------------------------------------- . (sym::filter, 1, First, Infinite), . (sym::filter_map, 1, First, Infinite), . (sym::flat_map, 1, First, Infinite), . (sym::unzip, 0, First, Infinite), . (sym::take_while, 1, First, MaybeInfinite), . (sym::scan, 2, First, MaybeInfinite), . ]; . 20 ( 0.00%) fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness { 16 ( 0.00%) match expr.kind { 4 ( 0.00%) ExprKind::MethodCall(method, receiver, args, _) => { . for &(name, len, heuristic, cap) in &HEURISTICS { 38 ( 0.00%) if method.ident.name == name && args.len() == len { . return (match heuristic { . Always => Infinite, . First => is_infinite(cx, receiver), . Any => is_infinite(cx, receiver).or(is_infinite(cx, &args[0])), . All => is_infinite(cx, receiver).and(is_infinite(cx, &args[0])), . }) . .and(cap); . } -- line 158 ---------------------------------------- -- line 176 ---------------------------------------- . .into() . } else { . Finite . } . }, . ExprKind::Struct(..) => higher::Range::hir(cx, expr).is_some_and(|r| r.end.is_none()).into(), . _ => Finite, . } 14 ( 0.00%) } . . /// the names and argument lengths of methods that *may* exhaust their . /// iterators . const POSSIBLY_COMPLETING_METHODS: [(Symbol, usize); 6] = [ . (sym::find, 1), . (sym::rfind, 1), . (sym::position, 1), . (sym::rposition, 1), -- line 192 ---------------------------------------- -- line 207 ---------------------------------------- . (sym::min, 0), . (sym::min_by, 1), . (sym::min_by_key, 1), . (sym::sum, 0), . (sym::product, 0), . ]; . . fn complete_infinite_iter(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness { 1,966,113 ( 0.01%) match expr.kind { 3 ( 0.00%) ExprKind::MethodCall(method, receiver, args, _) => { 1 ( 0.00%) let method_str = method.ident.name; . for &(name, len) in &COMPLETING_METHODS { 22 ( 0.00%) if method_str == name && args.len() == len { . return is_infinite(cx, receiver); . } . } . for &(name, len) in &POSSIBLY_COMPLETING_METHODS { 6 ( 0.00%) if method_str == name && args.len() == len { . return MaybeInfinite.and(is_infinite(cx, receiver)); . } . } 2 ( 0.00%) if method.ident.name == sym::last && args.is_empty() { . let not_double_ended = cx . .tcx . .get_diagnostic_item(sym::DoubleEndedIterator) . .is_some_and(|id| !implements_trait(cx, cx.typeck_results().expr_ty(receiver), id, &[])); . if not_double_ended { . return is_infinite(cx, receiver); . } 1 ( 0.00%) } else if method.ident.name == sym::collect { . let ty = cx.typeck_results().expr_ty(expr); . if matches!( . ty.opt_diag_name(cx), . Some( . sym::BinaryHeap . | sym::BTreeMap . | sym::BTreeSet . | sym::HashMap -- line 244 ---------------------------------------- -- line 247 ---------------------------------------- . | sym::Vec . | sym::VecDeque, . ) . ) { . return is_infinite(cx, receiver); . } . } . }, 2 ( 0.00%) ExprKind::Binary(op, l, r) if op.node.is_comparison() => { 6 ( 0.00%) return is_infinite(cx, l).and(is_infinite(cx, r)).and(MaybeInfinite); 172 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/infinite_iter.rs:clippy_lints::infinite_iter::is_infinite (2x) . }, // TODO: ExprKind::Loop + Match . _ => (), . } . Finite . } 40 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/legacy_numeric_constants.rs -------------------------------------------------------------------------------- Ir -- line 46 ---------------------------------------- . Self { msrv: conf.msrv.into() } . } . } . . impl<'tcx> LateLintPass<'tcx> for LegacyNumericConstants { . fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) { . // Integer modules are "TBD" deprecated, and the contents are too, . // so lint on the `use` statement directly. 16 ( 0.00%) if let ItemKind::Use(path, kind @ (UseKind::Single(_) | UseKind::Glob)) = item.kind 4 ( 0.00%) && !item.span.in_external_macro(cx.sess().source_map()) . // use `present_items` because it could be in either type_ns or value_ns . && let Some(res) = path.res.present_items().next() . && let Some(def_id) = res.opt_def_id() . && self.msrv.meets(cx, msrvs::NUMERIC_ASSOCIATED_CONSTANTS) . { . let module = if is_integer_module(cx, def_id) { . true . } else if is_numeric_const(cx, def_id) { -- line 63 ---------------------------------------- -- line 96 ---------------------------------------- . } else if let [.., module_name, name] = &*def_path { . diag.help( . format!("remove this import and use the associated constant `{module_name}::{name}` from the primitive type instead") . ); . } . }, . ); . } 4 ( 0.00%) } . 3,932,230 ( 0.02%) fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) { . // `std::::` check 1,179,677 ( 0.01%) let (sugg, msg) = if let ExprKind::Path(qpath) = &expr.kind . && let QPath::Resolved(None, path) = qpath 2 ( 0.00%) && let Some(def_id) = path.res.opt_def_id() 14 ( 0.00%) && is_numeric_const(cx, def_id) 157 ( 0.00%) => site/frontend/rust-clippy/clippy_lints/src/legacy_numeric_constants.rs:clippy_lints::legacy_numeric_constants::is_numeric_const (2x) . && let [.., mod_name, name] = &*cx.get_def_path(def_id) . // Skip linting if this usage looks identical to the associated constant, . // since this would only require removing a `use` import (which is already linted). . && !is_numeric_const_path_canonical(path, [*mod_name, *name]) . { . (format!("{mod_name}::{name}"), "usage of a legacy numeric constant") . // `::xxx_value` check 786,444 ( 0.00%) } else if let ExprKind::Call(func, []) = &expr.kind . && let ExprKind::Path(qpath) = &func.kind . && let QPath::TypeRelative(ty, last_segment) = qpath . && let Some(def_id) = cx.qpath_res(qpath, func.hir_id).opt_def_id() . && is_integer_method(cx, def_id) . && let Some(mod_name) = ty.span.get_text(cx) . && ty.span.eq_ctxt(last_segment.ident.span) . { . let name = last_segment.ident.name.as_str()[..=2].to_ascii_uppercase(); -- line 127 ---------------------------------------- -- line 138 ---------------------------------------- . diag.span_suggestion_verbose( . expr.span, . "use the associated constant instead", . sugg, . Applicability::MaybeIncorrect, . ); . }); . } 3,145,784 ( 0.02%) } . } . . fn is_integer_module(cx: &LateContext<'_>, did: DefId) -> bool { . matches!( . cx.tcx.get_diagnostic_name(did), . Some( . sym::isize_legacy_mod . | sym::i128_legacy_mod -- line 154 ---------------------------------------- -- line 161 ---------------------------------------- . | sym::u64_legacy_mod . | sym::u32_legacy_mod . | sym::u16_legacy_mod . | sym::u8_legacy_mod . ) . ) . } . 2 ( 0.00%) fn is_numeric_const(cx: &LateContext<'_>, did: DefId) -> bool { 12 ( 0.00%) matches!( 6 ( 0.00%) cx.tcx.get_diagnostic_name(did), 133 ( 0.00%) => ???:::get_diagnostic_name (2x) . Some( . sym::isize_legacy_const_max . | sym::isize_legacy_const_min . | sym::i128_legacy_const_max . | sym::i128_legacy_const_min . | sym::i16_legacy_const_max . | sym::i16_legacy_const_min . | sym::i32_legacy_const_max -- line 179 ---------------------------------------- -- line 219 ---------------------------------------- . | sym::f64_legacy_const_min_10_exp . | sym::f64_legacy_const_min_exp . | sym::f64_legacy_const_min_positive . | sym::f64_legacy_const_nan . | sym::f64_legacy_const_neg_infinity . | sym::f64_legacy_const_radix . ) . ) 4 ( 0.00%) } . . // Whether path expression looks like `i32::MAX` . fn is_numeric_const_path_canonical(expr_path: &hir::Path<'_>, [mod_name, name]: [Symbol; 2]) -> bool { . let [ . hir::PathSegment { . ident: one, args: None, .. . }, . hir::PathSegment { -- line 235 ---------------------------------------- 393,237 ( 0.00%) -------------------------------------------------------------------------------- -- Auto-annotated source: site/frontend/rust-clippy/clippy_lints/src/combined_late_pass.rs -------------------------------------------------------------------------------- Ir -- line 16 ---------------------------------------- . pub struct Gated