diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index cfe3583a9806f..1ffe8157a0fb4 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -681,10 +681,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } } &ty::Predicate::RegionOutlives(ref binder) => { - if let Err(_) = select - .infcx() - .region_outlives_predicate(&dummy_cause, binder) - { + if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() { return false; } } diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index c04785aac2095..a02b63755dc12 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // Eventually I'll need to implement param-env-aware // `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic. let param_env = ty::ParamEnv::empty(); - if let Ok(_) = self.can_sub(param_env, error, implication) { + if self.can_sub(param_env, error, implication).is_ok() { debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implication); return true } diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index f79ce73ad928a..0127ae423da54 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -137,7 +137,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { // variables. Process these constraints. let mut fulfill_cx = FulfillmentContext::new(); fulfill_cx.register_predicate_obligations(self, result.obligations); - if let Err(_) = fulfill_cx.select_all_or_error(self) { + if fulfill_cx.select_all_or_error(self).is_err() { self.tcx.sess.delay_span_bug( span, "implied_outlives_bounds failed to solve obligations from instantiation" diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 35184ca6a2559..1e3fe70535bcc 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1587,8 +1587,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { -> bool { assert!(!skol_trait_ref.has_escaping_regions()); - if let Err(_) = self.infcx.at(&obligation.cause, obligation.param_env) - .sup(ty::Binder::dummy(skol_trait_ref), trait_bound) { + if self.infcx.at(&obligation.cause, obligation.param_env) + .sup(ty::Binder::dummy(skol_trait_ref), trait_bound).is_err() { return false; } diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 66edbeff749f7..7329f4832f2e2 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -294,7 +294,7 @@ fn resolve_associated_item<'a, 'tcx>( }) } traits::VtableBuiltin(..) => { - if let Some(_) = tcx.lang_items().clone_trait() { + if tcx.lang_items().clone_trait().is_some() { Some(Instance { def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()), substs: rcvr_substs diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 09295e2c7ff00..6b1298750fba0 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1295,7 +1295,7 @@ impl EmitterWriter { } // if we elided some lines, add an ellipsis - if let Some(_) = lines.next() { + if lines.next().is_some() { buffer.puts(row_num, max_line_num_len - 1, "...", Style::LineNumber); } else if !show_underline { draw_col_separator_no_space(&mut buffer, row_num, max_line_num_len + 1); diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index aabed6686858f..67b92d92a343d 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -138,7 +138,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let tables = self.tcx.typeck_tables_of(id); let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); - if let Some(_) = tables.closure_kind_origins().get(hir_id) { + if tables.closure_kind_origins().get(hir_id).is_some() { false } else { true @@ -735,7 +735,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { &including_downcast, )?; buf.push_str("["); - if let Err(_) = self.append_local_to_string(index, buf) { + if self.append_local_to_string(index, buf).is_err() { buf.push_str(".."); } buf.push_str("]"); diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index d96967725f45e..7e54f176e102b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2698,7 +2698,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { self.label_ribs.pop(); } self.ribs[ValueNS].pop(); - if let Some(_) = anonymous_module { + if anonymous_module.is_some() { self.ribs[TypeNS].pop(); } debug!("(resolving block) leaving block"); @@ -4256,7 +4256,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { while let Some((in_module, path_segments)) = worklist.pop() { // abort if the module is already found - if let Some(_) = result { break; } + if result.is_some() { break; } self.populate_module_if_necessary(in_module); diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index 2fe7d73de8aa0..d2e52f98238dd 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -39,7 +39,7 @@ pub struct WriteOutput<'b, W: Write + 'b> { impl<'b, W: Write> DumpOutput for WriteOutput<'b, W> { fn dump(&mut self, result: &Analysis) { - if let Err(_) = write!(self.output, "{}", as_json(&result)) { + if write!(self.output, "{}", as_json(&result)).is_err() { error!("Error writing output"); } } diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 8d8482208b97d..68e851446dc96 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -758,8 +758,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { self.span, infer::FnCall, &fty); if let Some(self_ty) = self_ty { - if let Err(_) = self.at(&ObligationCause::dummy(), self.param_env) - .sup(fty.inputs()[0], self_ty) + if self.at(&ObligationCause::dummy(), self.param_env) + .sup(fty.inputs()[0], self_ty) + .is_err() { return false } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8c47df8b04221..9b6772e2dbb21 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3915,7 +3915,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } hir::ExprKind::Continue(destination) => { - if let Ok(_) = destination.target_id { + if destination.target_id.is_ok() { tcx.types.never } else { // There was an error, make typecheck fail diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 86e5bbeab706a..68e4618328077 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -486,7 +486,7 @@ pub fn run_core(search_paths: SearchPaths, &name, &output_filenames, |tcx, analysis, _, result| { - if let Err(_) = result { + if result.is_err() { sess.fatal("Compilation failed, aborting rustdoc"); } diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 73d7a9ab8599d..ff2cc35fce807 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -44,7 +44,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>, write_header(class, &mut out).unwrap(); let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None), sess.codemap()); - if let Err(_) = classifier.write_source(&mut out) { + if classifier.write_source(&mut out).is_err() { return format!("
{}", src); } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index b22e239e20a0e..c104b88334061 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -625,7 +625,7 @@ impl LangString { data.no_run = true; } x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => { - if let Ok(_) = x[1..].parse::