Closed
Description
In const generics, {}
are required for complex expressions in const generic arguments (e.g. {M + N}
). They are not required, however, for literals and standalone parameters (in most cases). However, at least at the moment, it is quite common to see curly brackets in user code for all generic arguments. This may be a passing phase, as generic arguments only recently started being disambiguated; however, if it is not, we might want to lint on extraneous {}
to inform users.
This might be useful outside of const generis too, such as in:
let _ = (5); // lints about unnecessary parens
let _ = {5}; // does not lint
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: Messages for errors, warnings, and lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.