Skip to content

approx_constant "Known problems" section is incorrect #4025

Closed
@kraai

Description

@kraai

The documentation for approx_constant says in the "Known problems" section:

If you happen to have a value that is within 1/8192 of a known constant, but is not and should not be the same, this lint will report your value anyway. We have not yet noticed any false positives in code we tested clippy with (this includes servo), but YMMV.

The function that compares the values has the following header comment:

/// Returns `false` if the number of significant figures in `value` are                                                                               
/// less than `min_digits`; otherwise, returns true if `value` is equal                                                                               
/// to `constant`, rounded to the number of digits present in `value`.                                                                                

There's nothing in that comment, or that I can see in the code, referring to 1/8192, so I think the documentation is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Adding or improving documentationgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions