diff options
| author | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-09-16 23:13:17 +0800 |
|---|---|---|
| committer | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-09-16 23:13:17 +0800 |
| commit | d31a2a0c603c6a7ec2a69e2b5658bcca016dbc29 (patch) | |
| tree | 46fec4f2c0cf0473e10ac076b53d5dfda79ee571 | |
| parent | 17a28f706395bab81047c5e4fd3d903304cc5c72 (diff) | |
| download | rust-d31a2a0c603c6a7ec2a69e2b5658bcca016dbc29.tar.gz rust-d31a2a0c603c6a7ec2a69e2b5658bcca016dbc29.zip | |
trim type numeric literal suffix
| -rw-r--r-- | src/librustc_typeck/check/demand.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 25559bdec76..ebed4924949 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -422,12 +422,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let suffix_suggestion = format!( "{}{}{}{}", if needs_paren { "(" } else { "" }, - { - // 42u8 - // ^^ - let lit_offset = src.len() - checked_ty.to_string().len(); - &src[..lit_offset] - }, + src.trim_right_matches(&checked_ty.to_string()), expected_ty, if needs_paren { ")" } else { "" }, ); |
