Open
Description
Lint name: redundant_closure
I tried this code:
pub extern "C" fn foo(func: extern fn()) {
bar(|| func())
}
pub fn bar(func: impl FnOnce()) {
func()
}
I expected no lints here, because FnOnce
is not implemented for extern fn
.
The suggestion causes a compile time error by passing func
directly:
pub extern "C" fn foo(func: extern fn()) {
bar(func)
}
Meta
Rust version (rustc -Vv
):
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-pc-windows-msvc
release: 1.56.0
LLVM version: 13.0.0
@rustbot label +I-suggestion-causes-error