Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8183b94

Browse files
committed
cargo fmt
1 parent 4bb90f5 commit 8183b94

File tree

7 files changed

+50
-12
lines changed

7 files changed

+50
-12
lines changed

src/cargo-fmt/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use cargo_metadata;
1717
use getopts;
1818

19-
2019
use std::collections::{HashMap, HashSet};
2120
use std::env;
2221
use std::fs;

src/chains.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ use crate::utils::{
8484
trimmed_last_line_width, wrap_str,
8585
};
8686

87-
pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
87+
pub fn rewrite_chain(
88+
expr: &ast::Expr,
89+
context: &RewriteContext<'_>,
90+
shape: Shape,
91+
) -> Option<String> {
8892
let chain = Chain::from_ast(expr, context);
8993
debug!("rewrite_chain {:?} {:?}", chain, shape);
9094

@@ -419,8 +423,12 @@ impl Rewrite for Chain {
419423
debug!("rewrite chain {:?} {:?}", self, shape);
420424

421425
let mut formatter = match context.config.indent_style() {
422-
IndentStyle::Block => Box::new(ChainFormatterBlock::new(self)) as Box<dyn ChainFormatter>,
423-
IndentStyle::Visual => Box::new(ChainFormatterVisual::new(self)) as Box<dyn ChainFormatter>,
426+
IndentStyle::Block => {
427+
Box::new(ChainFormatterBlock::new(self)) as Box<dyn ChainFormatter>
428+
}
429+
IndentStyle::Visual => {
430+
Box::new(ChainFormatterVisual::new(self)) as Box<dyn ChainFormatter>
431+
}
424432
};
425433

426434
formatter.format_root(&self.parent, context, shape)?;

src/expr.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,11 @@ impl Rewrite for ast::Stmt {
590590
}
591591

592592
// Rewrite condition if the given expression has one.
593-
pub fn rewrite_cond(context: &RewriteContext<'_>, expr: &ast::Expr, shape: Shape) -> Option<String> {
593+
pub fn rewrite_cond(
594+
context: &RewriteContext<'_>,
595+
expr: &ast::Expr,
596+
shape: Shape,
597+
) -> Option<String> {
594598
match expr.node {
595599
ast::ExprKind::Match(ref cond, _) => {
596600
// `match `cond` {`
@@ -1337,7 +1341,11 @@ pub fn is_every_expr_simple(lists: &[OverflowableItem<'_>]) -> bool {
13371341
lists.iter().all(OverflowableItem::is_simple)
13381342
}
13391343

1340-
pub fn can_be_overflowed_expr(context: &RewriteContext<'_>, expr: &ast::Expr, args_len: usize) -> bool {
1344+
pub fn can_be_overflowed_expr(
1345+
context: &RewriteContext<'_>,
1346+
expr: &ast::Expr,
1347+
args_len: usize,
1348+
) -> bool {
13411349
match expr.node {
13421350
ast::ExprKind::Match(..) => {
13431351
(context.use_block_indent() && args_len == 1)

src/items.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,11 @@ fn format_struct(
998998
}
999999
}
10001000

1001-
pub fn format_trait(context: &RewriteContext<'_>, item: &ast::Item, offset: Indent) -> Option<String> {
1001+
pub fn format_trait(
1002+
context: &RewriteContext<'_>,
1003+
item: &ast::Item,
1004+
offset: Indent,
1005+
) -> Option<String> {
10021006
if let ast::ItemKind::Trait(
10031007
is_auto,
10041008
unsafety,
@@ -1172,7 +1176,11 @@ pub fn format_trait_alias(
11721176
rewrite_assign_rhs(context, lhs, generic_bounds, shape.sub_width(1)?).map(|s| s + ";")
11731177
}
11741178

1175-
fn format_unit_struct(context: &RewriteContext<'_>, p: &StructParts<'_>, offset: Indent) -> Option<String> {
1179+
fn format_unit_struct(
1180+
context: &RewriteContext<'_>,
1181+
p: &StructParts<'_>,
1182+
offset: Indent,
1183+
) -> Option<String> {
11761184
let header_str = format_header(context, p.prefix, p.ident, p.vis);
11771185
let generics_str = if let Some(generics) = p.generics {
11781186
let hi = if generics.where_clause.predicates.is_empty() {

src/macros.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,11 @@ fn wrap_macro_args_inner(
10271027
//
10281028
// We always try and format on one line.
10291029
// FIXME: Use multi-line when every thing does not fit on one line.
1030-
fn format_macro_args(context: &RewriteContext<'_>, toks: TokenStream, shape: Shape) -> Option<String> {
1030+
fn format_macro_args(
1031+
context: &RewriteContext<'_>,
1032+
toks: TokenStream,
1033+
shape: Shape,
1034+
) -> Option<String> {
10311035
if !context.config.format_macro_matchers() {
10321036
let token_stream: TokenStream = toks.into();
10331037
let span = span_for_token_stream(&token_stream);
@@ -1340,7 +1344,11 @@ impl MacroBranch {
13401344
/// [pub] static ref NAME_N: TYPE_N = EXPR_N;
13411345
/// }
13421346
/// ```
1343-
fn format_lazy_static(context: &RewriteContext<'_>, shape: Shape, ts: &TokenStream) -> Option<String> {
1347+
fn format_lazy_static(
1348+
context: &RewriteContext<'_>,
1349+
shape: Shape,
1350+
ts: &TokenStream,
1351+
) -> Option<String> {
13441352
let mut result = String::with_capacity(1024);
13451353
let mut parser = new_parser_from_tts(context.parse_session, ts.trees().collect());
13461354
let nested_shape = shape

src/overflow.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,10 @@ fn no_long_items(list: &[ListItem]) -> bool {
758758
}
759759

760760
/// In case special-case style is required, returns an offset from which we start horizontal layout.
761-
pub fn maybe_get_args_offset(callee_str: &str, args: &[OverflowableItem<'_>]) -> Option<(bool, usize)> {
761+
pub fn maybe_get_args_offset(
762+
callee_str: &str,
763+
args: &[OverflowableItem<'_>],
764+
) -> Option<(bool, usize)> {
762765
if let Some(&(_, num_args_before)) = args
763766
.get(0)?
764767
.whitelist()

src/patterns.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@ impl<'a> Spanned for TuplePatField<'a> {
288288
}
289289
}
290290

291-
pub fn can_be_overflowed_pat(context: &RewriteContext<'_>, pat: &TuplePatField<'_>, len: usize) -> bool {
291+
pub fn can_be_overflowed_pat(
292+
context: &RewriteContext<'_>,
293+
pat: &TuplePatField<'_>,
294+
len: usize,
295+
) -> bool {
292296
match *pat {
293297
TuplePatField::Pat(pat) => match pat.node {
294298
ast::PatKind::Path(..)

0 commit comments

Comments
 (0)