Skip to content

Prefer X.floor() instead of FP::floor(x) #9789

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

Open
leonardo-m opened this issue Nov 4, 2022 · 1 comment
Open

Prefer X.floor() instead of FP::floor(x) #9789

leonardo-m opened this issue Nov 4, 2022 · 1 comment
Labels
A-lint Area: New lints

Comments

@leonardo-m
Copy link

leonardo-m commented Nov 4, 2022

What it does

Suggests a better pattern of code.

Lint Name

direct_method_call

Category

pedantic

Advantage

More dry, shorter.

Drawbacks

No response

Example

A pattern I've seen in code:

let y = f64::floor(x as f64);

I think it's better written:

let y = (x as f64).floor();
@leonardo-m leonardo-m added the A-lint Area: New lints label Nov 4, 2022
@blyxyas
Copy link
Member

blyxyas commented Nov 17, 2022

@rustbot claim

@blyxyas blyxyas removed their assignment Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants