}
}
&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;
}
}
// 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
}
// 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"
-> 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;
}
})
}
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
}
// 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);
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
&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("]");
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");
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);
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");
}
}
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
}
}
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
&name,
&output_filenames,
|tcx, analysis, _, result| {
- if let Err(_) = result {
+ if result.is_err() {
sess.fatal("Compilation failed, aborting rustdoc");
}
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!("<pre>{}</pre>", src);
}
data.no_run = true;
}
x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => {
- if let Ok(_) = x[1..].parse::<u32>() {
+ if x[1..].parse::<u32>().is_ok() {
data.error_codes.push(x.to_owned());
seen_rust_tags = !seen_other_tags || seen_rust_tags;
} else {
let mut idents_iter = idents.iter().peekable();
while let Some(ident) = idents_iter.next() {
path_name.push_str(&ident.as_str());
- if let Some(_) = idents_iter.peek() {
+ if idents_iter.peek().is_some() {
path_name.push_str("::")
}
}
}
};
- if let Some(_) = exprs.next() {
+ if exprs.next().is_some() {
cx.span_err(sp, "env! takes 1 or 2 arguments");
return DummyResult::expr(sp);
}