From 8a6e9f689b09421b281e0e9dc4f014001097def8 Mon Sep 17 00:00:00 2001 From: topecongiro <seuchida@gmail.com> Date: Thu, 15 Jun 2017 16:26:41 +0900 Subject: [PATCH] Format source codes --- src/items.rs | 16 +++++++++------- src/types.rs | 26 +++++++++++++------------- src/utils.rs | 1 + 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/items.rs b/src/items.rs index a660f287a5b..7a2d3048ff0 100644 --- a/src/items.rs +++ b/src/items.rs @@ -684,13 +684,15 @@ fn format_impl_ref_and_type( item: &ast::Item, offset: Indent, ) -> Option<String> { - if let ast::ItemKind::Impl(unsafety, - polarity, - _, - ref generics, - ref trait_ref, - ref self_ty, - _) = item.node + if let ast::ItemKind::Impl( + unsafety, + polarity, + _, + ref generics, + ref trait_ref, + ref self_ty, + _, + ) = item.node { let mut result = String::new(); diff --git a/src/types.rs b/src/types.rs index d725b091983..edeeb1e3b72 100644 --- a/src/types.rs +++ b/src/types.rs @@ -371,11 +371,11 @@ impl Rewrite for ast::WherePredicate { // TODO: dead spans? let result = match *self { ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { - ref bound_lifetimes, - ref bounded_ty, - ref bounds, - .. - }) => { + ref bound_lifetimes, + ref bounded_ty, + ref bounds, + .. + }) => { let type_str = try_opt!(bounded_ty.rewrite(context, shape)); let colon = type_bound_colon(context); @@ -428,10 +428,10 @@ impl Rewrite for ast::WherePredicate { } } ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate { - ref lifetime, - ref bounds, - .. - }) => { + ref lifetime, + ref bounds, + .. + }) => { try_opt!(rewrite_bounded_lifetime( lifetime, bounds.iter(), @@ -440,10 +440,10 @@ impl Rewrite for ast::WherePredicate { )) } ast::WherePredicate::EqPredicate(ast::WhereEqPredicate { - ref lhs_ty, - ref rhs_ty, - .. - }) => { + ref lhs_ty, + ref rhs_ty, + .. + }) => { let lhs_ty_str = try_opt!(lhs_ty.rewrite(context, shape)); // 3 = " = ".len() let used_width = 3 + lhs_ty_str.len(); diff --git a/src/utils.rs b/src/utils.rs index 0d1b32570c8..c432df301df 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -99,6 +99,7 @@ pub fn last_line_width(s: &str) -> usize { None => s.len(), } } + #[inline] pub fn trimmed_last_line_width(s: &str) -> usize { match s.rfind('\n') {