Skip to content

Commit 201a868

Browse files
committed
Cargo fmt
1 parent e910519 commit 201a868

File tree

4 files changed

+25
-30
lines changed

4 files changed

+25
-30
lines changed

src/expr.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,11 +1034,10 @@ impl<'a> ControlFlow<'a> {
10341034
let trial = self.rewrite_single_line(&pat_expr_string, context, shape.width);
10351035

10361036
if let Some(cond_str) = trial {
1037-
if cond_str.len()
1038-
<= context
1039-
.config
1040-
.width_heuristics()
1041-
.single_line_if_else_max_width
1037+
if cond_str.len() <= context
1038+
.config
1039+
.width_heuristics()
1040+
.single_line_if_else_max_width
10421041
{
10431042
return Some((cond_str, 0));
10441043
}

src/lists.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ impl ListItem {
8484
}
8585

8686
pub fn is_different_group(&self) -> bool {
87-
self.inner_as_ref().contains('\n') || self.pre_comment.is_some()
88-
|| self.post_comment
89-
.as_ref()
90-
.map_or(false, |s| s.contains('\n'))
87+
self.inner_as_ref().contains('\n') || self.pre_comment.is_some() || self.post_comment
88+
.as_ref()
89+
.map_or(false, |s| s.contains('\n'))
9190
}
9291

9392
pub fn is_multiline(&self) -> bool {

src/macros.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -666,22 +666,20 @@ fn indent_macro_snippet(
666666
.min()?;
667667

668668
Some(
669-
String::from(first_line) + "\n"
670-
+ &trimmed_lines
671-
.iter()
672-
.map(|&(line, prefix_space_width)| match prefix_space_width {
673-
Some(original_indent_width) => {
674-
let new_indent_width = indent.width()
675-
+ original_indent_width
676-
.checked_sub(min_prefix_space_width)
677-
.unwrap_or(0);
678-
let new_indent = Indent::from_width(context.config, new_indent_width);
679-
format!("{}{}", new_indent.to_string(context.config), line.trim())
680-
}
681-
None => String::new(),
682-
})
683-
.collect::<Vec<_>>()
684-
.join("\n"),
669+
String::from(first_line) + "\n" + &trimmed_lines
670+
.iter()
671+
.map(|&(line, prefix_space_width)| match prefix_space_width {
672+
Some(original_indent_width) => {
673+
let new_indent_width = indent.width() + original_indent_width
674+
.checked_sub(min_prefix_space_width)
675+
.unwrap_or(0);
676+
let new_indent = Indent::from_width(context.config, new_indent_width);
677+
format!("{}{}", new_indent.to_string(context.config), line.trim())
678+
}
679+
None => String::new(),
680+
})
681+
.collect::<Vec<_>>()
682+
.join("\n"),
685683
)
686684
}
687685

src/utils.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,10 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
278278
// Return true if the given span does not intersect with file lines.
279279
macro_rules! out_of_file_lines_range {
280280
($self: ident, $span: expr) => {
281-
!$self.config.file_lines().is_all()
282-
&& !$self
283-
.config
284-
.file_lines()
285-
.intersects(&$self.codemap.lookup_line_range($span))
281+
!$self.config.file_lines().is_all() && !$self
282+
.config
283+
.file_lines()
284+
.intersects(&$self.codemap.lookup_line_range($span))
286285
};
287286
}
288287

0 commit comments

Comments
 (0)