about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-07 16:02:28 +0000
committerbors <bors@rust-lang.org>2024-02-07 16:02:28 +0000
commit08c8cd501454a6976ce4803bae5ef6aa2879028f (patch)
tree518b61d5f3380d0820ec4acf1767393f0c607ae2 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parentb1e5a5842769d07f2bdcdc305ebee83283dc3d1a (diff)
parent3106219e24c9d52a739ffaf38c10f0c1357f30f3 (diff)
downloadrust-08c8cd501454a6976ce4803bae5ef6aa2879028f.tar.gz
rust-08c8cd501454a6976ce4803bae5ef6aa2879028f.zip
Auto merge of #12216 - bpandreotti:redundant-type-annotations-fix, r=Jarcho
Fix false positive in `redundant_type_annotations` lint

This PR changes the `redundant_type_annotations` lint to allow slice type annotations (i.e., `&[u8]`) for byte string literals. It will still consider _array_ type annotations (i.e., `&[u8; 4]`) as redundant. The reasoning behind this is that the type of byte string literals is by default a reference to an array, but, by using a type annotation, you can force it to be a slice. For example:
```rust
let a: &[u8; 4] = b"test";
let b: &[u8] = b"test";
```

Now, the type annotation for `a` will still be linted (as it is still redundant), but the type annotation for `b` will not.

Fixes #12212.

changelog: [`redundant_type_annotations`]: Fix false positive with byte string literals
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions