Skip to content

Conversation

@alexcrichton
Copy link
Member

Hurray more snapshot blockers!

bors added a commit that referenced this pull request Feb 12, 2014
@bors bors closed this Feb 12, 2014
@bors bors merged commit 064281c into rust-lang:master Feb 12, 2014
@alexcrichton alexcrichton deleted the another-snap-fix branch February 14, 2014 04:20
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 8, 2024
…s-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 rust-lang#12212.

changelog: [`redundant_type_annotations`]: Fix false positive with byte string literals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants