Skip to content

Commit

Permalink
rustc_lint: remove unused to_string
Browse files Browse the repository at this point in the history
In this instance, we can just pass a &str slice
and save an allocation.
  • Loading branch information
est31 committed Oct 20, 2020
1 parent 4d247ad commit c647735
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_lint/src/types.rs
Expand Up @@ -145,9 +145,9 @@ fn lint_overflowing_range_endpoint<'tcx>(
// We need to preserve the literal's suffix,
// as it may determine typing information.
let suffix = match lit.node {
LitKind::Int(_, LitIntType::Signed(s)) => s.name_str().to_string(),
LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str().to_string(),
LitKind::Int(_, LitIntType::Unsuffixed) => "".to_string(),
LitKind::Int(_, LitIntType::Signed(s)) => s.name_str(),
LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str(),
LitKind::Int(_, LitIntType::Unsuffixed) => "",
_ => bug!(),
};
let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix);
Expand Down

0 comments on commit c647735

Please sign in to comment.