1
Fork 0

Eagerly replace {integer}/{float} with i32/f64 for suggestion

This commit is contained in:
Esteban Kuber 2021-12-15 22:59:32 +00:00
parent 3fe3b89cd5
commit 474626af50
5 changed files with 49 additions and 12 deletions

View file

@ -521,6 +521,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
can_suggest: bool,
fn_id: hir::HirId,
) -> bool {
let found =
self.resolve_numeric_literals_with_default(self.resolve_vars_if_possible(found));
// Only suggest changing the return type for methods that
// haven't set a return type at all (and aren't `fn main()` or an impl).
match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) {