Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in semicolon_if_nothing_returned involving macros #7768

Closed
dtolnay opened this issue Oct 5, 2021 · 0 comments · Fixed by #7789
Closed

Regression in semicolon_if_nothing_returned involving macros #7768

dtolnay opened this issue Oct 5, 2021 · 0 comments · Fixed by #7789
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@dtolnay
Copy link
Member

dtolnay commented Oct 5, 2021

This is minimized from various callers of the quote crate's quote macro. This regression currently affects pretty much all crates that depend on the quote crate.

macro_rules! repro {
    () => {
        while false {
        }
    };
}

fn main() {
    repro!();
}
$ cargo +nightly-2021-10-04 clippy -- -Dclippy::pedantic
    Checking repro v0.0.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s

$ cargo +nightly-2021-10-05 clippy -- -Dclippy::pedantic
    Checking repro v0.0.0

error: consider adding a `;` to the last statement for consistent formatting
 --> src/main.rs:9:5
  |
9 |     repro!();
  |     ^^^^^^^^^ help: add a `;` here: `repro!();;`
  |
  = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

error: could not compile `testing` due to previous error

Meta

Rust version (rustc -Vv):

rustc 1.57.0-nightly (003d8d3f5 2021-10-04)
binary: rustc
commit-hash: 003d8d3f56848b6f3833340e859b089a09aea36a
commit-date: 2021-10-04
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0
@dtolnay dtolnay added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Oct 5, 2021
dtolnay added a commit to dtolnay/itoa that referenced this issue Oct 5, 2021
Gonna assume this is due to rust-lang/rust-clippy#7768.

    error: consider adding a `;` to the last statement for consistent formatting
       --> src/lib.rs:271:1
        |
    271 | / impl_Integer!(
    272 | |     I8_MAX_LEN => i8,
    273 | |     U8_MAX_LEN => u8,
    274 | |     I16_MAX_LEN => i16,
    ...   |
    277 | |     U32_MAX_LEN => u32
    278 | |     as u32);
        | |____________^
        |
        = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    271 + impl_Integer!(
    272 +     I8_MAX_LEN => i8,
    273 +     U8_MAX_LEN => u8,
    274 +     I16_MAX_LEN => i16,
    275 +     U16_MAX_LEN => u16,
    276 +     I32_MAX_LEN => i32,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> src/lib.rs:280:1
        |
    280 | impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `impl_Integer!(I64_MAX_LEN => i64, U64_MAX_LEN => u64 as u64);;`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> src/lib.rs:289:1
        |
    289 | impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64);;`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
dtolnay added a commit to dtolnay/dtoa that referenced this issue Oct 5, 2021
Gonna assume this is due to rust-lang/rust-clippy#7768.

    error: consider adding a `;` to the last statement for consistent formatting
      --> src/lib.rs:84:9
       |
    84 | /         dtoa! {
    85 | |             floating_type: f32,
    86 | |             significand_type: u32,
    87 | |             exponent_type: i32,
    ...  |
    98 | |             min_power: (-36),
    99 | |         };
       | |__________^
       |
       = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
       |
    84 ~         dtoa! {
    85 +             floating_type: f32,
    86 +             significand_type: u32,
    87 +             exponent_type: i32,
    88 +
    89 +             diy_significand_size: 32,
     ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> src/lib.rs:106:9
        |
    106 | /         dtoa! {
    107 | |             floating_type: f64,
    108 | |             significand_type: u64,
    109 | |             exponent_type: isize,
    ...   |
    120 | |             min_power: (-348),
    121 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    106 ~         dtoa! {
    107 +             floating_type: f64,
    108 +             significand_type: u64,
    109 +             exponent_type: isize,
    110 +
    111 +             diy_significand_size: 64,
      ...
dtolnay added a commit to serde-rs/serde that referenced this issue Oct 5, 2021
rust-lang/rust-clippy#7768

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:849:1
        |
    849 | / seq_impl!(
    850 | |     BinaryHeap<T: Ord>,
    851 | |     seq,
    852 | |     BinaryHeap::clear,
    ...   |
    855 | |     BinaryHeap::push
    856 | | );
        | |__^
        |
    note: the lint level is defined here
       --> serde/src/lib.rs:97:52
        |
    97  | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
        |                                                    ^^^^^^^^^^^^^^^
        = note: `#[deny(clippy::semicolon_if_nothing_returned)]` implied by `#[deny(clippy::pedantic)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    849 + seq_impl!(
    850 +     BinaryHeap<T: Ord>,
    851 +     seq,
    852 +     BinaryHeap::clear,
    853 +     BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())),
    854 +     BinaryHeap::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:859:1
        |
    859 | / seq_impl!(
    860 | |     BTreeSet<T: Eq + Ord>,
    861 | |     seq,
    862 | |     BTreeSet::clear,
    ...   |
    865 | |     BTreeSet::insert
    866 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    859 + seq_impl!(
    860 +     BTreeSet<T: Eq + Ord>,
    861 +     seq,
    862 +     BTreeSet::clear,
    863 +     BTreeSet::new(),
    864 +     nop_reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:869:1
        |
    869 | / seq_impl!(
    870 | |     LinkedList<T>,
    871 | |     seq,
    872 | |     LinkedList::clear,
    ...   |
    875 | |     LinkedList::push_back
    876 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    869 + seq_impl!(
    870 +     LinkedList<T>,
    871 +     seq,
    872 +     LinkedList::clear,
    873 +     LinkedList::new(),
    874 +     nop_reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:879:1
        |
    879 | / seq_impl!(
    880 | |     HashSet<T: Eq + Hash, S: BuildHasher + Default>,
    881 | |     seq,
    882 | |     HashSet::clear,
    883 | |     HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
    884 | |     HashSet::reserve,
    885 | |     HashSet::insert);
        | |_____________________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    879 + seq_impl!(
    880 +     HashSet<T: Eq + Hash, S: BuildHasher + Default>,
    881 +     seq,
    882 +     HashSet::clear,
    883 +     HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
    884 +     HashSet::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:888:1
        |
    888 | / seq_impl!(
    889 | |     VecDeque<T>,
    890 | |     seq,
    891 | |     VecDeque::clear,
    ...   |
    894 | |     VecDeque::push_back
    895 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    888 + seq_impl!(
    889 +     VecDeque<T>,
    890 +     seq,
    891 +     VecDeque::clear,
    892 +     VecDeque::with_capacity(size_hint::cautious(seq.size_hint())),
    893 +     VecDeque::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
        --> serde/src/de/impls.rs:1300:1
         |
    1300 | / map_impl!(
    1301 | |     BTreeMap<K: Ord, V>,
    1302 | |     map,
    1303 | |     BTreeMap::new());
         | |_____________________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
         |
    1300 + map_impl!(
    1301 +     BTreeMap<K: Ord, V>,
    1302 +     map,
    1303 +     BTreeMap::new());;
         |

    error: consider adding a `;` to the last statement for consistent formatting
        --> serde/src/de/impls.rs:1306:1
         |
    1306 | / map_impl!(
    1307 | |     HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
    1308 | |     map,
    1309 | |     HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default()));
         | |___________________________________________________________________________________________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
         |
    1306 + map_impl!(
    1307 +     HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
    1308 +     map,
    1309 +     HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default()));;
         |
hkratz added a commit to rusticstuff/simdutf8 that referenced this issue Oct 8, 2021
@bors bors closed this as completed in 22144c0 Oct 8, 2021
jonasbb added a commit to jonasbb/serde_with that referenced this issue Dec 7, 2021
The issue no longer persists on nightly, so it is likely a regression around macros, i.e.,
rust-lang/rust-clippy#7768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant