Suggest into to convert into isize only if uint is of width 8

Since Into<isize> is not implemented for uint of width greater than 8
This commit is contained in:
Samrat Man Singh 2020-04-28 21:27:14 +05:30
parent 1f0a864570
commit 57dd22baad

View File

@ -770,12 +770,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
(&ty::Int(exp), &ty::Uint(found)) => {
let is_fallible = match (exp.bit_width(), found.bit_width()) {
(Some(exp), Some(found)) if found < exp => false,
(None, Some(found)) if found <= 16 => false,
_ => true
(None, Some(8)) => false,
_ => true,
};
suggest_to_change_suffix_or_into(err, is_fallible);
true
},
}
(&ty::Uint(_), &ty::Int(_)) => {
suggest_to_change_suffix_or_into(err, true);
true