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

approx_const not MSRV aware #7623

Closed
ghost opened this issue Sep 2, 2021 · 1 comment · Fixed by #7629
Closed

approx_const not MSRV aware #7623

ghost opened this issue Sep 2, 2021 · 1 comment · Fixed by #7629
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

@ghost
Copy link

ghost commented Sep 2, 2021

Lint name: approx_const

I tried this code:

#![feature(custom_inner_attributes)]
#![clippy::msrv = "1.30.0"]

fn main() {
    let _log2_10 = 3.321928095f64; 
    let _log10_2 = 0.301029995f64;
}

I expected to see this happen:
No warnings. The LOG2_10 and LOG10_2 consts where added in 1.43.

Instead, this happened:

error: approximate value of `f64::consts::LOG2_10` found. Consider using it directly
 --> src/main.rs:5:20
  |
5 |     let _log2_10 = 3.321928095f64; 
  |                    ^^^^^^^^^^^^^^
  |
  = note: `#[deny(clippy::approx_constant)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant

error: approximate value of `f64::consts::LOG10_2` found. Consider using it directly
 --> src/main.rs:6:20
  |
6 |     let _log10_2 = 0.301029995f64;
  |                    ^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
@ghost ghost 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 Sep 2, 2021
@ghost
Copy link
Author

ghost commented Sep 2, 2021

@rustbot claim

@rustbot rustbot assigned ghost Sep 2, 2021
@ghost ghost mentioned this issue Sep 4, 2021
bors added a commit that referenced this issue Sep 5, 2021
Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623
bors added a commit that referenced this issue Sep 5, 2021
Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623
@bors bors closed this as completed in a23af89 Sep 5, 2021
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.

0 participants