Switch to Rust 2024 edition (#18129)

This commit is contained in:
Micha Reiser 2025-05-16 13:25:28 +02:00 committed by GitHub
parent e67b35743a
commit 9ae698fe30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1082 changed files with 4211 additions and 3300 deletions

View file

@ -1,4 +1,4 @@
use ruff_formatter::{write, Argument, Arguments, FormatError};
use ruff_formatter::{Argument, Arguments, FormatError, write};
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{
ElifElseClause, ExceptHandlerExceptHandler, MatchCase, StmtClassDef, StmtFor, StmtFunctionDef,
@ -7,8 +7,8 @@ use ruff_python_ast::{
use ruff_python_trivia::{SimpleToken, SimpleTokenKind, SimpleTokenizer};
use ruff_text_size::{Ranged, TextRange, TextSize};
use crate::comments::{leading_alternate_branch_comments, trailing_comments, SourceComment};
use crate::statement::suite::{contains_only_an_ellipsis, SuiteKind};
use crate::comments::{SourceComment, leading_alternate_branch_comments, trailing_comments};
use crate::statement::suite::{SuiteKind, contains_only_an_ellipsis};
use crate::verbatim::write_suppressed_clause_header;
use crate::{has_skip_comment, prelude::*};
@ -473,12 +473,22 @@ fn colon_range(after_keyword_or_condition: TextSize, source: &str) -> FormatResu
range,
}) => Ok(range),
Some(token) => {
debug_assert!(false, "Expected the colon marking the end of the case header but found {token:?} instead.");
Err(FormatError::syntax_error("Expected colon marking the end of the case header but found another token instead."))
debug_assert!(
false,
"Expected the colon marking the end of the case header but found {token:?} instead."
);
Err(FormatError::syntax_error(
"Expected colon marking the end of the case header but found another token instead.",
))
}
None => {
debug_assert!(false, "Expected the colon marking the end of the case header but found the end of the range.");
Err(FormatError::syntax_error("Expected the colon marking the end of the case header but found the end of the range."))
debug_assert!(
false,
"Expected the colon marking the end of the case header but found the end of the range."
);
Err(FormatError::syntax_error(
"Expected the colon marking the end of the case header but found the end of the range.",
))
}
}
}