From 307799a711826294bc2b3e562cd87bf1e2ff28b4 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Wed, 24 May 2023 14:33:43 +0000 Subject: Use `is_some_and`/`is_ok_and` in less obvious spots --- compiler/rustc_errors/src/emitter.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 3e38d6afb0b..6d944e51314 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -285,15 +285,11 @@ pub trait Emitter: Translate { format!( "help: {}{}: `{}`", &msg, - if self - .source_map() - .map(|sm| is_case_difference( - sm, - substitution, - sugg.substitutions[0].parts[0].span, - )) - .unwrap_or(false) - { + if self.source_map().is_some_and(|sm| is_case_difference( + sm, + substitution, + sugg.substitutions[0].parts[0].span, + )) { " (notice the capitalization)" } else { "" -- cgit 1.4.1-3-g733a5