Manual cleanup of some is_{or_none|some_and}
usages
This commit is contained in:
parent
264fa0fc54
commit
1951d86a35
7 changed files with 12 additions and 8 deletions
|
@ -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')
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -417,7 +417,8 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
|||
// Any descendants of `std` should be private. These crates are usually not marked
|
||||
// private in metadata, so we ignore that field.
|
||||
if extern_private.is_none()
|
||||
&& dep_root.is_some_and(|d| STDLIB_STABLE_CRATES.contains(&d.name))
|
||||
&& let Some(dep) = dep_root
|
||||
&& STDLIB_STABLE_CRATES.contains(&dep.name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ impl<Prov: Provenance> ProvenanceMap<Prov> {
|
|||
debug_assert!(prov.len() <= 1);
|
||||
if let Some(entry) = prov.first() {
|
||||
// If it overlaps with this byte, it is on this byte.
|
||||
debug_assert!(self.bytes.as_ref().is_none_or(|b| b.get(&offset).is_none()));
|
||||
debug_assert!(self.bytes.as_ref().is_none_or(|b| !b.contains_key(&offset)));
|
||||
Some(entry.1)
|
||||
} else {
|
||||
// Look up per-byte provenance.
|
||||
|
|
|
@ -336,7 +336,7 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
.collect();
|
||||
|
||||
constraints
|
||||
.retain(|(_, def_id, _)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def)));
|
||||
.retain(|(_, def_id, _)| def_id.is_none_or(|def| !bound_trait_defs.contains(&def)));
|
||||
|
||||
if constraints.is_empty() {
|
||||
continue;
|
||||
|
|
|
@ -675,7 +675,7 @@ impl OutputTypes {
|
|||
|
||||
/// Returns `true` if user specified a name and not just produced type
|
||||
pub fn contains_explicit_name(&self, key: &OutputType) -> bool {
|
||||
self.0.get(key).is_some_and(|f| f.is_some())
|
||||
matches!(self.0.get(key), Some(Some(..)))
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option<OutFileName>> {
|
||||
|
@ -1951,7 +1951,7 @@ fn collect_print_requests(
|
|||
matches: &getopts::Matches,
|
||||
) -> Vec<PrintRequest> {
|
||||
let mut prints = Vec::<PrintRequest>::new();
|
||||
if cg.target_cpu.as_ref().is_some_and(|s| s == "help") {
|
||||
if cg.target_cpu.as_deref() == Some("help") {
|
||||
prints.push(PrintRequest { kind: PrintKind::TargetCPUs, out: OutFileName::Stdout });
|
||||
cg.target_cpu = None;
|
||||
};
|
||||
|
|
|
@ -420,7 +420,8 @@ fn make_elided_region_spans_suggs<'a>(
|
|||
|
||||
let mut process_consecutive_brackets =
|
||||
|span: Option<Span>, spans_suggs: &mut Vec<(Span, String)>| {
|
||||
if span.is_some_and(|span| bracket_span.is_none_or(|bracket_span| span == bracket_span))
|
||||
if let Some(span) = span
|
||||
&& bracket_span.is_none_or(|bracket_span| span == bracket_span)
|
||||
{
|
||||
consecutive_brackets += 1;
|
||||
} else if let Some(bracket_span) = bracket_span.take() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue