Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiser
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
This commit is contained in:
commit
872631d0f0
27 changed files with 45 additions and 63 deletions
|
@ -1480,7 +1480,7 @@ pub fn get_cmd_lint_options(
|
|||
|
||||
/// Parses the `--color` flag.
|
||||
pub fn parse_color(matches: &getopts::Matches) -> ColorConfig {
|
||||
match matches.opt_str("color").as_ref().map(|s| &s[..]) {
|
||||
match matches.opt_str("color").as_deref() {
|
||||
Some("auto") => ColorConfig::Auto,
|
||||
Some("always") => ColorConfig::Always,
|
||||
Some("never") => ColorConfig::Never,
|
||||
|
@ -1589,7 +1589,7 @@ pub fn parse_error_format(
|
|||
// is unstable, it will not be present. We have to use `opts_present` not
|
||||
// `opt_present` because the latter will panic.
|
||||
let error_format = if matches.opts_present(&["error-format".to_owned()]) {
|
||||
match matches.opt_str("error-format").as_ref().map(|s| &s[..]) {
|
||||
match matches.opt_str("error-format").as_deref() {
|
||||
None | Some("human") => {
|
||||
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color))
|
||||
}
|
||||
|
|
|
@ -1357,7 +1357,7 @@ pub fn build_session(
|
|||
let profiler = SelfProfiler::new(
|
||||
directory,
|
||||
sopts.crate_name.as_deref(),
|
||||
sopts.unstable_opts.self_profile_events.as_ref().map(|xs| &xs[..]),
|
||||
sopts.unstable_opts.self_profile_events.as_deref(),
|
||||
&sopts.unstable_opts.self_profile_counter,
|
||||
);
|
||||
match profiler {
|
||||
|
@ -1391,7 +1391,7 @@ pub fn build_session(
|
|||
local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0);
|
||||
|
||||
let optimization_fuel = Lock::new(OptimizationFuel {
|
||||
remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |i| i.1),
|
||||
remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |&(_, i)| i),
|
||||
out_of_fuel: false,
|
||||
});
|
||||
let print_fuel = AtomicU64::new(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue