Move mir_opt_level getter into Options

This commit is contained in:
Dylan MacKenzie 2021-11-28 17:54:42 -08:00
parent ff23ad3179
commit 386b1c5f57
2 changed files with 9 additions and 4 deletions

View File

@ -101,6 +101,14 @@ macro_rules! top_level_options {
);
}
impl Options {
pub fn mir_opt_level(&self) -> usize {
self.debugging_opts
.mir_opt_level
.unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 })
}
}
top_level_options!(
/// The top-level command-line options struct.
///

View File

@ -562,10 +562,7 @@ impl Session {
self.opts.debugging_opts.binary_dep_depinfo
}
pub fn mir_opt_level(&self) -> usize {
self.opts
.debugging_opts
.mir_opt_level
.unwrap_or_else(|| if self.opts.optimize != config::OptLevel::No { 2 } else { 1 })
self.opts.mir_opt_level()
}
/// Gets the features enabled for the current compilation session.