Manual cleanup of some is_{or_none|some_and} usages

This commit is contained in:
Yotam Ofek 2025-01-19 20:50:43 +00:00
parent 264fa0fc54
commit 1951d86a35
7 changed files with 12 additions and 8 deletions

View file

@ -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')
{

View file

@ -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