diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-19 19:15:00 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-19 19:15:00 +0000 |
| commit | 264fa0fc5430f3a9a52a92df706d7c9ac5af4f85 (patch) | |
| tree | 0bbd37338339064a435083342483f5b6012f4694 /compiler/rustc_errors/src | |
| parent | 39dc268459b4bd8b771e500169bea67850fad30d (diff) | |
| download | rust-264fa0fc5430f3a9a52a92df706d7c9ac5af4f85.tar.gz rust-264fa0fc5430f3a9a52a92df706d7c9ac5af4f85.zip | |
Run `clippy --fix` for `unnecessary_map_or` lint
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index f938352820d..991dfa1821a 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -3146,7 +3146,7 @@ impl FileWithAnnotatedLines { add_annotation_to_file(&mut output, Lrc::clone(&file), line, ann.as_line()); } let line_end = ann.line_end - 1; - let end_is_empty = file.get_line(line_end - 1).map_or(false, |s| !filter(&s)); + let end_is_empty = file.get_line(line_end - 1).is_some_and(|s| !filter(&s)); if middle < line_end && !end_is_empty { add_annotation_to_file(&mut output, Lrc::clone(&file), line_end, ann.as_line()); } diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 97df7f9265a..6a3f8ca497a 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -463,7 +463,7 @@ impl DiagnosticSpan { // is an empty string, increase the length to include the newline so we don't // leave an empty line if start.col.0 == 0 - && suggestion.map_or(false, |(s, _)| s.is_empty()) + && suggestion.is_some_and(|(s, _)| s.is_empty()) && let Ok(after) = je.sm.span_to_next_source(span) && after.starts_with('\n') { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index cc5eb9c335e..6e5958a20d0 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1717,7 +1717,7 @@ impl DiagCtxtInner { let bugs: Vec<_> = std::mem::take(&mut self.delayed_bugs).into_iter().map(|(b, _)| b).collect(); - let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0"); + let backtrace = std::env::var_os("RUST_BACKTRACE").is_none_or(|x| &x != "0"); let decorate = backtrace || self.ice_file.is_none(); let mut out = self .ice_file |
