Skip to content

Commit 386b1c5

Browse files
Move mir_opt_level getter into Options
1 parent ff23ad3 commit 386b1c5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/rustc_session/src/options.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ macro_rules! top_level_options {
101101
);
102102
}
103103

104+
impl Options {
105+
pub fn mir_opt_level(&self) -> usize {
106+
self.debugging_opts
107+
.mir_opt_level
108+
.unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 })
109+
}
110+
}
111+
104112
top_level_options!(
105113
/// The top-level command-line options struct.
106114
///

compiler/rustc_session/src/session.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,7 @@ impl Session {
562562
self.opts.debugging_opts.binary_dep_depinfo
563563
}
564564
pub fn mir_opt_level(&self) -> usize {
565-
self.opts
566-
.debugging_opts
567-
.mir_opt_level
568-
.unwrap_or_else(|| if self.opts.optimize != config::OptLevel::No { 2 } else { 1 })
565+
self.opts.mir_opt_level()
569566
}
570567

571568
/// Gets the features enabled for the current compilation session.

0 commit comments

Comments
 (0)