about summary refs log tree commit diff
path: root/src/patterns.rs
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2019-02-11 01:12:38 +0900
committerGitHub <noreply@github.com>2019-02-11 01:12:38 +0900
commitce682bdabc39a7261eb5c3d43b20bb84fae64fde (patch)
treeea0e42f4c8e1b5dbb8721b556645e6cfd5b78a29 /src/patterns.rs
parentfca91bc22f40aaf8e8fc949313b8f5b9c9ac90cc (diff)
parent8183b949c49cfdd5889859162e82fab4c8e64065 (diff)
Merge pull request #3335 from h-michael/rust-2018
Rust 2018 idioms
Diffstat (limited to 'src/patterns.rs')
-rw-r--r--src/patterns.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/patterns.rs b/src/patterns.rs
index acfb6ee1933..956ce56bdf1 100644
--- a/src/patterns.rs
+++ b/src/patterns.rs
@@ -64,7 +64,7 @@ fn is_short_pattern_inner(pat: &ast::Pat) -> bool {
 }
 
 impl Rewrite for Pat {
-    fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+    fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         match self.node {
             PatKind::Box(ref pat) => rewrite_unary_prefix(context, "box ", &**pat, shape),
             PatKind::Ident(binding_mode, ident, ref sub_pat) => {
@@ -174,7 +174,7 @@ fn rewrite_struct_pat(
     fields: &[source_map::Spanned<ast::FieldPat>],
     ellipsis: bool,
     span: Span,
-    context: &RewriteContext,
+    context: &RewriteContext<'_>,
     shape: Shape,
 ) -> Option<String> {
     // 2 =  ` {`
@@ -240,7 +240,7 @@ fn rewrite_struct_pat(
 }
 
 impl Rewrite for FieldPat {
-    fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+    fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         let pat = self.pat.rewrite(context, shape);
         if self.is_shorthand {
             pat
@@ -271,7 +271,7 @@ pub enum TuplePatField<'a> {
 }
 
 impl<'a> Rewrite for TuplePatField<'a> {
-    fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+    fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         match *self {
             TuplePatField::Pat(p) => p.rewrite(context, shape),
             TuplePatField::Dotdot(_) => Some("..".to_string()),
@@ -288,7 +288,11 @@ impl<'a> Spanned for TuplePatField<'a> {
     }
 }
 
-pub fn can_be_overflowed_pat(context: &RewriteContext, pat: &TuplePatField, len: usize) -> bool {
+pub fn can_be_overflowed_pat(
+    context: &RewriteContext<'_>,
+    pat: &TuplePatField<'_>,
+    len: usize,
+) -> bool {
     match *pat {
         TuplePatField::Pat(pat) => match pat.node {
             ast::PatKind::Path(..)
@@ -310,7 +314,7 @@ fn rewrite_tuple_pat(
     dotdot_pos: Option<usize>,
     path_str: Option<String>,
     span: Span,
-    context: &RewriteContext,
+    context: &RewriteContext<'_>,
     shape: Shape,
 ) -> Option<String> {
     let mut pat_vec: Vec<_> = pats.iter().map(|x| TuplePatField::Pat(x)).collect();
@@ -379,8 +383,8 @@ fn rewrite_tuple_pat(
 }
 
 fn count_wildcard_suffix_len(
-    context: &RewriteContext,
-    patterns: &[TuplePatField],
+    context: &RewriteContext<'_>,
+    patterns: &[TuplePatField<'_>],
     span: Span,
     shape: Shape,
 ) -> usize {