]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/_match.rs
Various minor/cosmetic improvements to code
[rust.git] / src / librustc_typeck / check / _match.rs
index bc9ba0e0054647712dc04ef491595aa56d22466a..87ee903cf4302534164f84bf196b16045508097d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use check::{FnCtxt, Expectation, Diverges, Needs};
+use check::coercion::CoerceMany;
 use rustc::hir::{self, PatKind};
 use rustc::hir::def::{Def, CtorKind};
 use rustc::hir::pat_util::EnumerateAndAdjustIterator;
 use rustc::infer::type_variable::TypeVariableOrigin;
 use rustc::traits::ObligationCauseCode;
 use rustc::ty::{self, Ty, TypeFoldable};
-use check::{FnCtxt, Expectation, Diverges, Needs};
-use check::coercion::CoerceMany;
-use util::nodemap::FxHashMap;
-
-use std::collections::hash_map::Entry::{Occupied, Vacant};
-use std::cmp;
 use syntax::ast;
 use syntax::source_map::Spanned;
 use syntax::ptr::P;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax_pos::Span;
+use util::nodemap::FxHashMap;
+
+use std::collections::hash_map::Entry::{Occupied, Vacant};
+use std::cmp;
 
 impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
     /// The `is_arg` argument indicates whether this pattern is the
@@ -545,7 +545,7 @@ pub fn check_match(&self,
         // the "discriminant type" (issue #23116).
         //
         // arielb1 [writes here in this comment thread][c] that there
-        // is certainly *some* potential danger, e.g. for an example
+        // is certainly *some* potential danger, e.g., for an example
         // like:
         //
         // [c]: https://github.com/rust-lang/rust/pull/43399#discussion_r130223956
@@ -729,10 +729,10 @@ fn check_pat_struct(&self,
             return self.tcx.types.err;
         };
 
-        // Type check the path.
+        // Type-check the path.
         self.demand_eqtype(pat.span, expected, pat_ty);
 
-        // Type check subpatterns.
+        // Type-check subpatterns.
         if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) {
             pat_ty
         } else {
@@ -771,7 +771,7 @@ fn check_pat_path(&self,
             _ => bug!("unexpected pattern definition: {:?}", def)
         }
 
-        // Type check the path.
+        // Type-check the path.
         let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id).0;
         self.demand_suptype(pat.span, expected, pat_ty);
         pat_ty
@@ -808,7 +808,7 @@ fn check_pat_tuple_struct(&self,
             return self.tcx.types.err;
         }
 
-        // Type check the path.
+        // Type-check the path.
         let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id);
         if !pat_ty.is_fn() {
             report_unexpected_def(def);
@@ -838,7 +838,7 @@ fn check_pat_tuple_struct(&self,
 
         self.demand_eqtype(pat.span, expected, pat_ty);
 
-        // Type check subpatterns.
+        // Type-check subpatterns.
         if subpats.len() == variant.fields.len() ||
                 subpats.len() < variant.fields.len() && ddpos.is_some() {
             let substs = match pat_ty.sty {