Open
Description
Summary
'too_many_lines' is not trigfgered on functions with #[tracing::instrument].
Other lints seem to work insude the affected functions.
Lint Name
too_many_lines
Reproducer
I tried this code: (with too-many-lines-threshold = 2)
#![warn(clippy::too_many_lines)]
#[allow(unused)]
fn long_function_1() {
do_something("fn 1.1");
do_something("fn 1.2");
do_something("fn 1.3");
}
#[tracing::instrument]
fn long_function_2() {
do_something("fn 2.1");
do_something("fn 2.2");
do_something("fn 2.3");
}
fn do_something(_msg:&str){
todo!()
}
I expected to see this happen:
Expected warnings on both functions, long_function_1() and long_function_2()
Instead, this happened:
Received only a single warning on long_function_1()
cargo clippy -v
Fresh unicode-ident v1.0.14
Fresh proc-macro2 v1.0.92
Fresh quote v1.0.37
Fresh syn v2.0.89
Fresh once_cell v1.20.2
Fresh tracing-core v0.1.33
Fresh tracing-attributes v0.1.28
Fresh pin-project-lite v0.2.15
Fresh tracing v0.1.41
Fresh clippy-too-may-lines v0.1.0 (/home/alex/devel/clippy-too-may-lines)
warning: this function has too many lines (3/2)
--> src/lib.rs:4:1
|
4 | / fn long_function_1() {
5 | | do_something("fn 1.1");
6 | | do_something("fn 1.2");
7 | | do_something("fn 1.3");
8 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(clippy::too_many_lines)]
| ^^^^^^^^^^^^^^^^^^^^^^
warning: `clippy-too-may-lines` (lib) generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Version
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1