let .. else
| Grep rustc for "=> break" and "=> continue": | |
| Summary: | |
| -- Result or Option cases -- 36 counts | |
| -- Not Result or Option -- 10 counts | |
| -- Requires `if` guard -- 4 counts | |
| -- Result or Option cases - 35 counts | |
| let output = match prog { | |
| Ok(ref output) => output, | |
| Err(_) => break, | |
| }; | |
| - | |
| let parent_node = match map.find(parent_id) { | |
| Some(parent) => parent, | |
| None => break, | |
| }; | |
| - | |
| let entries = match build.out.join(host).read_dir() { | |
| Ok(iter) => iter, | |
| Err(_) => continue, | |
| }; | |
| - | |
| let name = match id2name.get(&node.id) { | |
| Some(name) => name, | |
| None => continue, | |
| }; | |
| - | |
| let dep = match id2name.get(dep) { | |
| Some(dep) => dep, | |
| None => continue, | |
| }; | |
| - | |
| let deps = match pkg.dependencies { | |
| Some(ref deps) => deps, | |
| None => continue | |
| }; | |
| - | |
| let output = match generate(input) { | |
| Some(o) => o, | |
| None => continue, | |
| }; | |
| - | |
| let filename = match path.file_name().and_then(|s| s.to_str()) { | |
| Some(s) => s, | |
| None => continue, | |
| }; | |
| - | |
| let assertion = match self.assertion_maybe(item_id, attr) { | |
| Some(a) => a, | |
| None => continue, | |
| }; | |
| - | |
| let items = match m.meta_item_list() { | |
| Some(item) => item, | |
| None => continue, | |
| }; | |
| - | |
| let binding = match resolution.binding { | |
| Some(binding) => binding, | |
| None => continue, | |
| }; | |
| - | |
| let typ = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { | |
| Some(s) => s.to_string(), | |
| None => continue, | |
| }; | |
| - | |
| let child_name = match child.name() { | |
| Some(s) => s, | |
| None => continue, | |
| }; | |
| - | |
| let trait_def_id = match opt_trait_def_id { | |
| Some(def_id) => def_id, | |
| None => continue, | |
| }; | |
| - | |
| let ids = match store.find_lints(&lint_name) { | |
| Ok(ids) => ids, | |
| Err(_) => continue, | |
| }; | |
| - | |
| let level = match attr.name().and_then(|name| Level::from_str(&name.as_str())) { | |
| None => continue, | |
| Some(lvl) => lvl, | |
| }; | |
| - | |
| let myname = match item.name { | |
| None => continue, | |
| Some(ref s) => s.to_string(), | |
| }; | |
| - | |
| let (offset, niche, niche_start) = | |
| match field.find_niche(self, count)? { | |
| Some(niche) => niche, | |
| None => continue | |
| }; | |
| - | |
| let forbid_src = match self.sets.get_lint_id_level(*id, self.cur, None) { | |
| (Some(Level::Forbid), src) => src, | |
| _ => continue, | |
| }; | |
| - | |
| let id = match lookup_id(&enc_id) { | |
| Ok(Some(id)) => id, | |
| _ => continue, | |
| }; | |
| - | |
| let edges = match graph.edges(node) { | |
| Some(edges) => edges, | |
| None => continue, | |
| }; | |
| - | |
| let &(ref spec, ref dep) = match potential_matches.next() { | |
| None => continue, | |
| Some(replacement) => replacement, | |
| }; | |
| - | |
| let id = match pkg.source.as_ref().or_else(|| path_deps.get(&pkg.name)) { | |
| Some(src) => PackageId::new(&pkg.name, &pkg.version, src)?, | |
| None => continue, | |
| }; | |
| - | |
| let name = match *package { | |
| MaybePackage::Package(ref p) => p.name(), | |
| MaybePackage::Virtual(_) => continue, | |
| }; | |
| - | |
| let lib = match dep.targets().iter().find(|t| t.is_lib()) { | |
| Some(lib) => lib, | |
| None => continue, | |
| }; | |
| - | |
| let line = match str::from_utf8(line) { | |
| Ok(line) => line.trim(), | |
| Err(..) => continue, | |
| }; | |
| - | |
| let data = match iter.next() { | |
| Some(val) => val, | |
| None => continue | |
| }; | |
| - | |
| let next_split = match line.find(|c: char| !c.is_digit(10)) { | |
| Some(idx) => idx, | |
| None => continue, // no minor version | |
| }; | |
| - | |
| let pos_equals = match rest.find("=") { | |
| Some(i) => i, | |
| None => continue, | |
| }; | |
| - | |
| let pos_quote = match rest.find(&['"', '\''][..]) { | |
| Some(i) => i, | |
| None => continue, | |
| }; | |
| - | |
| let url = match rest.find(quote_delim) { | |
| Some(i) => &rest[..i], | |
| None => continue, | |
| }; | |
| - | |
| let action = match action { | |
| Some(a) => a, | |
| None => continue, | |
| }; | |
| - | |
| let file = match current_file { | |
| Some(ref f) => &**f, | |
| None => continue, | |
| }; | |
| - | |
| let lines_captures = match lines_pattern.captures(&line) { | |
| Some(captures) => captures, | |
| None => continue, | |
| }; | |
| _ | |
| let code = match code { | |
| Ok(n) => n, | |
| Err(..) => continue, | |
| }; | |
| - | |
| let feature_name = match line.find(gate_test_str) { | |
| Some(i) => { | |
| &line[i+gate_test_str.len()..line[i+1..].find(' ').unwrap_or(line.len())] | |
| }, | |
| None => continue, | |
| }; | |
| -- Not Result or Option | |
| let a_region = match *a_data { | |
| VarValue::ErrorValue => continue, | |
| VarValue::Value(a_region) => a_region, | |
| }; | |
| - | |
| let (lint_attr_name, lint_attr_span) = match *src { | |
| LintSource::Node(name, span) => (name, span), | |
| _ => continue, | |
| }; | |
| - | |
| let def = match data.bounded_ty.node { | |
| hir::TyPath(hir::QPath::Resolved(None, ref path)) => path.def, | |
| _ => continue, | |
| }; | |
| - | |
| let target = match item.inner { | |
| TypedefItem(ref t, true) => &t.type_, | |
| _ => continue, | |
| }; | |
| - | |
| let def = match self.cstore.load_macro_untracked(def_id, self.cx.sess()) { | |
| LoadedMacro::MacroDef(macro_def) => macro_def, | |
| LoadedMacro::ProcMacro(..) => continue, | |
| }; | |
| - | |
| let pos = match s[1..].iter().position(|&u| u == b'=' as u16).map(|p| p + 1) { | |
| Some(p) => p, | |
| None => continue, | |
| }; | |
| - | |
| let trn = match sub.translate() { | |
| Some(trn) => trn, | |
| // If it has no translation, don't call it out specifically. | |
| None => continue, | |
| }; | |
| - | |
| let float = match fstr.parse::<f64>().ok() { | |
| Some(f) => f, | |
| None => continue, | |
| }; | |
| - | |
| let part = match instr.parts.get(0) { | |
| Some(part) => part, | |
| None => continue, | |
| }; | |
| - | |
| let negated = match e.node { | |
| ExprBinary(binop, ref lhs, ref rhs) => { | |
| .... | |
| }, | |
| _ => continue, | |
| }; | |
| -- Requires `if` guard | |
| let result = match self.nodes[index] { | |
| Node { state: ref _state, ref mut obligation, .. } | |
| if _state.get() == NodeState::Pending => | |
| { | |
| processor.process_obligation(obligation) | |
| } | |
| _ => continue | |
| }; | |
| - | |
| let data = match *predicate { | |
| hir::WherePredicate::BoundPredicate(ref data) => data, | |
| _ => continue, | |
| }; | |
| - | |
| let (target, unwind, source_info) = match mir.basic_blocks()[block].terminator() { | |
| &Terminator { | |
| source_info, | |
| kind: TerminatorKind::Drop { | |
| location: Place::Local(local), | |
| target, | |
| unwind | |
| } | |
| } if local == gen => (target, unwind, source_info), | |
| _ => continue, | |
| }; | |
| - | |
| let callee_mir = match ty::queries::optimized_mir::try_get(self.tcx, | |
| callsite.location.span, | |
| callsite.callee) { | |
| Ok(ref callee_mir) if self.should_inline(callsite, callee_mir) => { | |
| subst_and_normalize(callee_mir, self.tcx, &callsite.substs, param_env) | |
| } | |
| Ok(_) => continue, | |
| Err(mut bug) => { | |
| // FIXME(#43542) shouldn't have to cancel an error | |
| bug.cancel(); | |
| continue | |
| } | |
| }; | |
| -- Assignment cases, do these count for something? | |
| loop { | |
| callee = match callee.node { | |
| hir::ExprBlock(ref block) => match block.expr { | |
| Some(ref tail) => &tail, | |
| None => break | |
| }, | |
| _ => break | |
| }; | |
| } | |
| loop { | |
| match tcx.hir.get(parent_id) { | |
| NodeItem(_) | NodeImplItem(_) | NodeTraitItem(_) => break, | |
| _ => { | |
| parent_id = tcx.hir.get_parent_node(parent_id); | |
| } | |
| } | |
| } | |
| match cur.parent() { | |
| Some(parent) => cur = parent, | |
| None => break, | |
| } | |
| match current.parent() { | |
| Some(p) => current = p, | |
| None => break, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment