chore: bump toolchain and apply minor updates

This commit is contained in:
Caleb Cartwright 2023-10-22 12:59:03 -05:00
parent f35f25287f
commit 746bf48ec4
4 changed files with 4 additions and 35 deletions

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-07-01"
channel = "nightly-2023-10-22"
components = ["llvm-tools", "rustc-dev"]

View File

@ -2074,28 +2074,6 @@ fn run_test(
expected_line_start: &str,
) {
let block = ItemizedBlock::new(test_input).unwrap();
<<<<<<< HEAD
assert_eq!(1, block.lines.len(), "test_input: {:?}", test_input);
assert_eq!(
expected_line, &block.lines[0],
"test_input: {:?}",
test_input
);
assert_eq!(
expected_indent, block.indent,
"test_input: {:?}",
test_input
);
assert_eq!(
expected_opener, &block.opener,
"test_input: {:?}",
test_input
);
assert_eq!(
expected_line_start, &block.line_start,
"test_input: {:?}",
test_input
=======
assert_eq!(1, block.lines.len(), "test_input: {test_input:?}");
assert_eq!(expected_line, &block.lines[0], "test_input: {test_input:?}");
assert_eq!(expected_indent, block.indent, "test_input: {test_input:?}");
@ -2103,7 +2081,6 @@ fn run_test(
assert_eq!(
expected_line_start, &block.line_start,
"test_input: {test_input:?}"
>>>>>>> upstream/master
);
}
@ -2155,23 +2132,15 @@ fn test_itemized_block_nonobvious_markers_are_rejected() {
// https://spec.commonmark.org/0.30 says: "A start number may not be negative":
"-1. Not a list item.",
"-1 Not a list item.",
<<<<<<< HEAD
=======
// Marker without prefix are not recognized as item markers:
". Not a list item.",
") Not a list item.",
>>>>>>> upstream/master
];
for line in test_inputs.iter() {
let maybe_block = ItemizedBlock::new(line);
assert!(
maybe_block.is_none(),
<<<<<<< HEAD
"The following line shouldn't be classified as a list item: {}",
line
=======
"The following line shouldn't be classified as a list item: {line}"
>>>>>>> upstream/master
);
}
}

View File

@ -132,7 +132,7 @@ pub(crate) fn format_expr(
ast::ExprKind::Tup(ref items) => {
rewrite_tuple(context, items.iter(), expr.span, shape, items.len() == 1)
}
ast::ExprKind::Let(ref pat, ref expr, _span) => rewrite_let(context, shape, pat, expr),
ast::ExprKind::Let(ref pat, ref expr, _span, _) => rewrite_let(context, shape, pat, expr),
ast::ExprKind::If(..)
| ast::ExprKind::ForLoop(..)
| ast::ExprKind::Loop(..)

View File

@ -274,7 +274,7 @@ impl<'a, 'b> PairList<'a, 'b, ast::Expr> {
fn let_chain_count(&self) -> usize {
self.list
.iter()
.filter(|(expr, _)| matches!(expr.kind, ast::ExprKind::Let(_, _, _)))
.filter(|(expr, _)| matches!(expr.kind, ast::ExprKind::Let(..)))
.count()
}
@ -284,7 +284,7 @@ fn can_rewrite_let_chain_single_line(&self) -> bool {
}
let fist_item_is_ident = is_ident(self.list[0].0);
let second_item_is_let_chain = matches!(self.list[1].0.kind, ast::ExprKind::Let(_, _, _));
let second_item_is_let_chain = matches!(self.list[1].0.kind, ast::ExprKind::Let(..));
fist_item_is_ident && second_item_is_let_chain
}