2023-09-12 11:13:53 -05:00
|
|
|
//@ignore-32bit
|
2023-08-24 14:32:12 -05:00
|
|
|
//@aux-build:proc_macros.rs
|
2023-07-02 07:35:19 -05:00
|
|
|
#![allow(clippy::redundant_closure_call, unused)]
|
|
|
|
#![warn(clippy::single_call_fn)]
|
|
|
|
#![no_main]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate proc_macros;
|
|
|
|
|
|
|
|
// Do not lint since it's public
|
|
|
|
pub fn f() {}
|
|
|
|
|
|
|
|
fn i() {}
|
|
|
|
fn j() {}
|
|
|
|
|
|
|
|
fn h() {
|
|
|
|
// Linted
|
|
|
|
let a = i;
|
|
|
|
// Do not lint closures
|
|
|
|
let a = (|| {
|
|
|
|
// Not linted
|
|
|
|
a();
|
|
|
|
// Imo, it's reasonable to lint this as the function is still only being used once. Just in
|
|
|
|
// a closure.
|
|
|
|
j();
|
|
|
|
});
|
|
|
|
a();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn g() {
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn c() {
|
|
|
|
println!("really");
|
|
|
|
println!("long");
|
|
|
|
println!("function...");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn d() {
|
|
|
|
c();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn a() {}
|
|
|
|
|
|
|
|
fn b() {
|
|
|
|
a();
|
|
|
|
|
|
|
|
external! {
|
|
|
|
fn lol() {
|
|
|
|
lol_inner();
|
|
|
|
}
|
|
|
|
fn lol_inner() {}
|
|
|
|
}
|
|
|
|
with_span! {
|
|
|
|
span
|
|
|
|
fn lol2() {
|
|
|
|
lol2_inner();
|
|
|
|
}
|
|
|
|
fn lol2_inner() {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn e() {
|
|
|
|
b();
|
|
|
|
b();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn k() {}
|
|
|
|
|
2024-01-25 12:17:36 -06:00
|
|
|
mod issue12182 {
|
|
|
|
#[allow(clippy::single_call_fn)]
|
|
|
|
fn print_foo(text: &str) {
|
|
|
|
println!("{text}");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn use_print_foo() {
|
|
|
|
print_foo("foo");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-02 07:35:19 -05:00
|
|
|
#[test]
|
|
|
|
fn l() {
|
|
|
|
k();
|
|
|
|
}
|