diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-06-12 16:01:41 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-06-13 14:42:54 +1200 |
| commit | 6f30d9e7c973d7bee78f8d16aa623f679c37bcae (patch) | |
| tree | 3a8ecca75b37ca838bfd896558c7b8d130d2324d /src | |
| parent | 1f512948a03cd24c2f8a056be0a2f53675802fd2 (diff) | |
Reformat tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/imports.rs | 24 | ||||
| -rw-r--r-- | src/items.rs | 12 | ||||
| -rw-r--r-- | src/patterns.rs | 24 | ||||
| -rw-r--r-- | src/types.rs | 26 |
4 files changed, 37 insertions, 49 deletions
diff --git a/src/imports.rs b/src/imports.rs index 8a327069c2f..3b7c47f0fca 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -177,13 +177,11 @@ impl Rewrite for ast::ViewPath { let prefix_shape = try_opt!(shape.sub_width(ident_str.len() + 4)); let path_str = try_opt!(rewrite_view_path_prefix(path, context, prefix_shape)); - Some( - if path.segments.last().unwrap().identifier == ident { - path_str - } else { - format!("{} as {}", path_str, ident_str) - }, - ) + Some(if path.segments.last().unwrap().identifier == ident { + path_str + } else { + format!("{} as {}", path_str, ident_str) + }) } } } @@ -392,13 +390,11 @@ pub fn rewrite_use_list( }; let list_str = try_opt!(write_list(&items[first_index..], &fmt)); - Some( - if path_str.is_empty() { - format!("{{{}}}", list_str) - } else { - format!("{}::{{{}}}", path_str, list_str) - }, - ) + Some(if path_str.is_empty() { + format!("{{{}}}", list_str) + } else { + format!("{}::{{{}}}", path_str, list_str) + }) } // Returns true when self item was found. diff --git a/src/items.rs b/src/items.rs index 3639e5ae0e5..01aa7b389d5 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1990,13 +1990,11 @@ fn rewrite_fn_base( }); let snippet = snippet.trim(); if !snippet.is_empty() { - result.push( - if original_starts_with_newline { - '\n' - } else { - ' ' - }, - ); + result.push(if original_starts_with_newline { + '\n' + } else { + ' ' + }); result.push_str(snippet); if original_ends_with_newline { force_new_line_for_brace = true; diff --git a/src/patterns.rs b/src/patterns.rs index 67e4870f660..a52f42157b8 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -336,23 +336,19 @@ fn rewrite_tuple_pat( match path_str { Some(path_str) => { - Some( - if context.config.spaces_within_parens() { - format!("{}( {} )", path_str, list) - } else { - format!("{}({})", path_str, list) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("{}( {} )", path_str, list) + } else { + format!("{}({})", path_str, list) + }) } None => { let comma = if add_comma { "," } else { "" }; - Some( - if context.config.spaces_within_parens() { - format!("( {}{} )", list, comma) - } else { - format!("({}{})", list, comma) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("( {}{} )", list, comma) + } else { + format!("({}{})", list, comma) + }) } } } diff --git a/src/types.rs b/src/types.rs index f54e1c96eda..b1cea7df864 100644 --- a/src/types.rs +++ b/src/types.rs @@ -348,13 +348,11 @@ where String::new() }; - Some( - if context.config.spaces_within_parens() { - format!("( {} ){}{}", list_str, infix, output) - } else { - format!("({}){}{}", list_str, infix, output) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("( {} ){}{}", list_str, infix, output) + } else { + format!("({}){}{}", list_str, infix, output) + }) } fn type_bound_colon(context: &RewriteContext) -> &'static str { @@ -588,13 +586,13 @@ impl Rewrite for ast::PolyTraitRef { ), )); - Some( - if context.config.spaces_within_angle_brackets() && lifetime_str.len() > 0 { - format!("for< {} > {}", lifetime_str, path_str) - } else { - format!("for<{}> {}", lifetime_str, path_str) - }, - ) + Some(if context.config.spaces_within_angle_brackets() && + lifetime_str.len() > 0 + { + format!("for< {} > {}", lifetime_str, path_str) + } else { + format!("for<{}> {}", lifetime_str, path_str) + }) } else { self.trait_ref.rewrite(context, shape) } |
