mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:56 +00:00
Use #[expect(lint)]
over #[allow(lint)]
where possible (#17822)
This commit is contained in:
parent
8535af8516
commit
fa628018b2
148 changed files with 221 additions and 268 deletions
|
@ -1459,7 +1459,7 @@ impl<'src> Lexer<'src> {
|
|||
|
||||
/// Retrieves the current offset of the cursor within the source code.
|
||||
// SAFETY: Lexer doesn't allow files larger than 4GB
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
#[inline]
|
||||
fn offset(&self) -> TextSize {
|
||||
TextSize::new(self.source.len() as u32) - self.cursor.text_len()
|
||||
|
|
|
@ -62,7 +62,7 @@ impl<'src> Cursor<'src> {
|
|||
///
|
||||
/// Use [`Cursor::rest`] to get the remaining text.
|
||||
// SAFETY: The `source.text_len` call in `new` would panic if the string length is larger than a `u32`.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
pub(super) fn text_len(&self) -> TextSize {
|
||||
TextSize::new(self.chars.as_str().len() as u32)
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ pub(crate) struct TokenSourceCheckpoint {
|
|||
/// of `contents`.
|
||||
///
|
||||
/// See [#9546](https://github.com/astral-sh/ruff/pull/9546) for a more detailed explanation.
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
fn allocate_tokens_vec(contents: &str) -> Vec<Token> {
|
||||
let lower_bound = contents.len().saturating_mul(15) / 100;
|
||||
Vec::with_capacity(lower_bound)
|
||||
|
|
|
@ -274,7 +274,7 @@ fn extract_options(source: &str) -> Option<ParseOptions> {
|
|||
// Use it for quickly debugging a parser issue.
|
||||
#[test]
|
||||
#[ignore]
|
||||
#[allow(clippy::print_stdout)]
|
||||
#[expect(clippy::print_stdout)]
|
||||
fn parser_quick_test() {
|
||||
let source = "\
|
||||
f'{'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue