Skip to content

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

Open
@leonardo-m

Description

@leonardo-m

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions