]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/resolve.rs
rollup merge of #17114 : nick29581/dst-type
[rust.git] / src / librustc / middle / resolve.rs
index ae3a109a505a388a9db7469838e61be9018fd72b..854b8b9ba77112337d729054f7676badf65ef1e3 100644 (file)
@@ -1549,18 +1549,13 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                             PathListMod { .. } => Some(item.span),
                             _ => None
                         }).collect::<Vec<Span>>();
-                        match mod_spans.as_slice() {
-                            [first, second, ..other] => {
-                                self.resolve_error(first,
-                                    "`mod` import can only appear once in the list");
-                                self.session.span_note(second,
-                                        "another `mod` import appears here");
-                                for &other_span in other.iter() {
-                                    self.session.span_note(other_span,
-                                        "another `mod` import appears here");
-                                }
-                            },
-                            [_] | [] => ()
+                        if mod_spans.len() > 1 {
+                            self.resolve_error(mod_spans[0],
+                                "`mod` import can only appear once in the list");
+                            for other_span in mod_spans.iter().skip(1) {
+                                self.session.span_note(*other_span,
+                                    "another `mod` import appears here");
+                            }
                         }
 
                         for source_item in source_items.iter() {