Skip to content

Lint default numeric type fallback #6064

Closed
@Nemo157

Description

@Nemo157

What it does

Lint any integer or floating point constants that have their type determined by the default fallback rather than inference

Categories (optional)

  • Kind: pedantic

What is the advantage of the recommended code over the original code

Avoids unintended use of the numeric default types, forcing the author to think about what type is appropriate.

Drawbacks

Forcing the author to think about what type is appropriate.

Example

let (x, y) = (5, 6.0);

Could be written as:

let (x, y): (i32, f32) = (5, 6.0);
let (x, y) = (5i32, 6.0f32);

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsL-restrictionLint: Belongs in the restriction lint group

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions