Skip to content

Commit 7e61921

Browse files
Make SimplifyBranches::new a const fn
1 parent 80a7b3d commit 7e61921

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_mir_transform/src/simplify_branches.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ use rustc_middle::ty::TyCtxt;
77
use std::borrow::Cow;
88

99
pub struct SimplifyBranches {
10-
label: String,
10+
label: &'static str,
1111
}
1212

1313
impl SimplifyBranches {
14-
pub fn new(label: &str) -> Self {
15-
SimplifyBranches { label: format!("SimplifyBranches-{}", label) }
14+
pub const fn new(label: &'static str) -> Self {
15+
SimplifyBranches { label }
1616
}
1717
}
1818

1919
impl<'tcx> MirPass<'tcx> for SimplifyBranches {
2020
fn name(&self) -> Cow<'_, str> {
21-
Cow::Borrowed(&self.label)
21+
Cow::Owned(format!("SimplifyBranches-{}", self.label))
2222
}
2323

2424
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {

0 commit comments

Comments
 (0)