Skip to content

Commit c647735

Browse files
committed
rustc_lint: remove unused to_string
In this instance, we can just pass a &str slice and save an allocation.
1 parent 4d247ad commit c647735

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_lint/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ fn lint_overflowing_range_endpoint<'tcx>(
145145
// We need to preserve the literal's suffix,
146146
// as it may determine typing information.
147147
let suffix = match lit.node {
148-
LitKind::Int(_, LitIntType::Signed(s)) => s.name_str().to_string(),
149-
LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str().to_string(),
150-
LitKind::Int(_, LitIntType::Unsuffixed) => "".to_string(),
148+
LitKind::Int(_, LitIntType::Signed(s)) => s.name_str(),
149+
LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str(),
150+
LitKind::Int(_, LitIntType::Unsuffixed) => "",
151151
_ => bug!(),
152152
};
153153
let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix);

0 commit comments

Comments
 (0)