Skip to content

Conversation

decathorpe
Copy link
Contributor

Rust 1.68.0 promoted the bindings_with_variant_name lint to "deny-by-default" :
https://github.com/rust-lang/rust/blob/1.68.0/RELEASES.md#compiler

Allowing this in a few places (i.e. adding #[allow(bindings_with_variant_name)] attributes in two doctest snippets) fixes the following compilation errors when running cargo test on Rust 1.68.0 or later:

---- src/ascii_char.rs - ascii_char::AsciiChar::from_ascii (line 297) stdout ----
error[E0170]: pattern binding `a` is named the same as one of the variants of the type `ascii::AsciiChar`
 --> src/ascii_char.rs:299:5
  |
5 | let a = AsciiChar::from_ascii('g').unwrap();
  |     ^
  |
  = note: `#[deny(bindings_with_variant_name)]` on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0170`.
Couldn't compile the test.
---- src/ascii_string.rs - ascii_string::AsciiString::pop (line 310) stdout ----
error[E0170]: pattern binding `c` is named the same as one of the variants of the type `ascii::AsciiChar`
 --> src/ascii_string.rs:313:25
  |
6 | assert_eq!(s.pop().map(|c| c.as_char()), Some('o'));
  |                         ^
  |
  = note: `#[deny(bindings_with_variant_name)]` on by default

error[E0170]: pattern binding `c` is named the same as one of the variants of the type `ascii::AsciiChar`
 --> src/ascii_string.rs:314:25
  |
7 | assert_eq!(s.pop().map(|c| c.as_char()), Some('o'));
  |                         ^

error[E0170]: pattern binding `c` is named the same as one of the variants of the type `ascii::AsciiChar`
 --> src/ascii_string.rs:315:25
  |
8 | assert_eq!(s.pop().map(|c| c.as_char()), Some('f'));
  |                         ^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0170`.
Couldn't compile the test.

failures:
    src/ascii_char.rs - ascii_char::AsciiChar::from_ascii (line 297)
    src/ascii_string.rs - ascii_string::AsciiString::pop (line 310)

test result: FAILED. 51 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.66s

error: doctest failed, to rerun pass `--doc`

@tormol tormol merged commit 888dfce into tomprogrammer:master Mar 24, 2023
@tormol
Copy link
Collaborator

tormol commented Mar 24, 2023

Thanks.

I'll fix/disable the new clippy lints tomorrow.

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.

2 participants