diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-19 20:50:43 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-19 20:50:43 +0000 |
| commit | 1951d86a35c2b7d5c5434493f1897425cbfd8e96 (patch) | |
| tree | 121cbac15f8e423bb4e8d75a0dd4c736d37436ae /compiler/rustc_errors/src | |
| parent | 264fa0fc5430f3a9a52a92df706d7c9ac5af4f85 (diff) | |
| download | rust-1951d86a35c2b7d5c5434493f1897425cbfd8e96.tar.gz rust-1951d86a35c2b7d5c5434493f1897425cbfd8e96.zip | |
Manual cleanup of some `is_{or_none|some_and}` usages
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 6a3f8ca497a..c1188665a05 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -463,7 +463,8 @@ 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.is_some_and(|(s, _)| s.is_empty()) + && let Some((suggestion, _)) = suggestion + && suggestion.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 6e5958a20d0..549729548f5 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -35,6 +35,7 @@ use std::backtrace::{Backtrace, BacktraceStatus}; use std::borrow::Cow; use std::cell::Cell; use std::error::Report; +use std::ffi::OsStr; use std::hash::Hash; use std::io::Write; use std::num::NonZero; @@ -1717,7 +1718,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").is_none_or(|x| &x != "0"); + let backtrace = std::env::var_os("RUST_BACKTRACE").as_deref() != Some(OsStr::new("0")); let decorate = backtrace || self.ice_file.is_none(); let mut out = self .ice_file |
