From d37edef9dd088d953c5e272db37686a338c31778 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Sun, 3 Jul 2016 14:38:37 -0700 Subject: prefer `if let` to match with `None => {}` arm in some places This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block. --- src/librustc_metadata/decoder.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/librustc_metadata/decoder.rs') diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 0a59c152ca3..eada2a9cd7a 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -682,15 +682,12 @@ fn each_child_of_item_or_crate(intr: Rc, }; // Get the item. - match crate_data.get_item(child_def_id.index) { - None => {} - Some(child_item_doc) => { - // Hand off the item to the callback. - let child_name = item_name(&intr, child_item_doc); - let def_like = item_to_def_like(crate_data, child_item_doc, child_def_id); - let visibility = item_visibility(child_item_doc); - callback(def_like, child_name, visibility); - } + if let Some(child_item_doc) = crate_data.get_item(child_def_id.index) { + // Hand off the item to the callback. + let child_name = item_name(&intr, child_item_doc); + let def_like = item_to_def_like(crate_data, child_item_doc, child_def_id); + let visibility = item_visibility(child_item_doc); + callback(def_like, child_name, visibility); } } -- cgit 1.4.1-3-g733a5