Run rustfmt

This commit is contained in:
Ruben Schmidmeister 2019-05-09 21:13:32 +02:00
parent 618d092bf7
commit d1c1f8e61e
No known key found for this signature in database
GPG Key ID: 29387B5A7AAF863F
3 changed files with 22 additions and 5 deletions

View File

@ -37,7 +37,10 @@ pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span {
}
/// Returns attributes that are within `outer_span`.
pub(crate) fn filter_inline_attrs(attrs: &[ast::Attribute], outer_span: Span) -> Vec<ast::Attribute> {
pub(crate) fn filter_inline_attrs(
attrs: &[ast::Attribute],
outer_span: Span,
) -> Vec<ast::Attribute> {
attrs
.iter()
.filter(|a| outer_span.lo() <= a.span.lo() && a.span.hi() <= outer_span.hi())

View File

@ -827,7 +827,11 @@ fn join_bounds(
Some(result)
}
pub(crate) fn can_be_overflowed_type(context: &RewriteContext<'_>, ty: &ast::Ty, len: usize) -> bool {
pub(crate) fn can_be_overflowed_type(
context: &RewriteContext<'_>,
ty: &ast::Ty,
len: usize,
) -> bool {
match ty.node {
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
ast::TyKind::Rptr(_, ref mutty) | ast::TyKind::Ptr(ref mutty) => {

View File

@ -54,7 +54,10 @@ pub(crate) fn is_same_visibility(a: &Visibility, b: &Visibility) -> bool {
}
// Uses Cow to avoid allocating in the common cases.
pub(crate) fn format_visibility(context: &RewriteContext<'_>, vis: &Visibility) -> Cow<'static, str> {
pub(crate) fn format_visibility(
context: &RewriteContext<'_>,
vis: &Visibility,
) -> Cow<'static, str> {
match vis.node {
VisibilityKind::Public => Cow::from("pub "),
VisibilityKind::Inherited => Cow::from(""),
@ -143,7 +146,10 @@ pub(crate) fn ptr_vec_to_ref_vec<T>(vec: &[ptr::P<T>]) -> Vec<&T> {
}
#[inline]
pub(crate) fn filter_attributes(attrs: &[ast::Attribute], style: ast::AttrStyle) -> Vec<ast::Attribute> {
pub(crate) fn filter_attributes(
attrs: &[ast::Attribute],
style: ast::AttrStyle,
) -> Vec<ast::Attribute> {
attrs
.iter()
.filter(|a| a.style == style)
@ -503,7 +509,11 @@ pub(crate) fn remove_trailing_white_spaces(text: &str) -> String {
/// ),
/// }
/// ```
pub(crate) fn trim_left_preserve_layout(orig: &str, indent: Indent, config: &Config) -> Option<String> {
pub(crate) fn trim_left_preserve_layout(
orig: &str,
indent: Indent,
config: &Config,
) -> Option<String> {
let mut lines = LineClasses::new(orig);
let first_line = lines.next().map(|(_, s)| s.trim_end().to_owned())?;
let mut trimmed_lines = Vec::with_capacity(16);