about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-16 16:27:01 +0000
committerbors <bors@rust-lang.org>2023-10-16 16:27:01 +0000
commit9f27b1562cc8d6f6449cd3c94d89b410b51defc2 (patch)
treeab21b4c7838c36bd40fa631c1fa360724bf33abe /compiler/rustc_codegen_gcc/example
parent387d756540f63c84033bee6c72daf4152848aefa (diff)
parentbb6516ace013a2ec33ca1276b029786dfbb46ee1 (diff)
downloadrust-9f27b1562cc8d6f6449cd3c94d89b410b51defc2.tar.gz
rust-9f27b1562cc8d6f6449cd3c94d89b410b51defc2.zip
Auto merge of #11673 - y21:issue11672, r=Manishearth
[`unnecessary_lazy_eval`]: reduce applicability if closure has return type annotation

Fixes #11672

We already check if closure parameters don't have type annotations and reduce the applicability to `MaybeIncorrect` if they do, since those help type inference and removing them breaks code. We didn't do this for return type annotations however. This PR adds it. This doesn't change it to produce a fix that will compile, but it will prevent rustfix from auto-applying it.

(In general I'm not sure if we can suggest a fix that will compile. In this specific example, it might be possible to suggest `&[] as &[u8]`, but as-casts won't always work, e.g. `Default::default() as &[u8]` is a compile error, so just reducing applicability should be a safe fix in any case for now)

changelog: [`unnecessary_lazy_eval`]: reduce applicability to `MaybeIncorrect` if closure has return type annotation
Diffstat (limited to 'compiler/rustc_codegen_gcc/example')
0 files changed, 0 insertions, 0 deletions