mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-12 14:48:16 +00:00
Switch to Rust 2024 edition (#18129)
This commit is contained in:
parent
e67b35743a
commit
9ae698fe30
1082 changed files with 4211 additions and 3300 deletions
|
@ -10,19 +10,19 @@ use itertools::Itertools;
|
|||
use regex::Regex;
|
||||
|
||||
use ruff_formatter::printer::SourceMapGeneration;
|
||||
use ruff_python_ast::{str::Quote, AnyStringFlags, StringFlags};
|
||||
use ruff_python_ast::{AnyStringFlags, StringFlags, str::Quote};
|
||||
use ruff_python_parser::ParseOptions;
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use {
|
||||
ruff_formatter::{write, FormatOptions, IndentStyle, LineWidth, Printed},
|
||||
ruff_python_trivia::{is_python_whitespace, PythonWhitespace},
|
||||
ruff_formatter::{FormatOptions, IndentStyle, LineWidth, Printed, write},
|
||||
ruff_python_trivia::{PythonWhitespace, is_python_whitespace},
|
||||
ruff_text_size::{Ranged, TextLen, TextRange, TextSize},
|
||||
};
|
||||
|
||||
use super::NormalizedString;
|
||||
use crate::preview::is_no_chaperone_for_escaped_quote_in_triple_quoted_docstring_enabled;
|
||||
use crate::string::StringQuotes;
|
||||
use crate::{prelude::*, DocstringCodeLineWidth, FormatModuleError};
|
||||
use crate::{DocstringCodeLineWidth, FormatModuleError, prelude::*};
|
||||
|
||||
/// Format a docstring by trimming whitespace and adjusting the indentation.
|
||||
///
|
||||
|
@ -1796,7 +1796,7 @@ impl Indentation {
|
|||
}),
|
||||
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
}
|
||||
Self::Mixed { .. } => return None,
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use itertools::Itertools;
|
||||
use ruff_formatter::{format_args, write, FormatContext};
|
||||
use ruff_formatter::{FormatContext, format_args, write};
|
||||
use ruff_python_ast::str::{Quote, TripleQuotes};
|
||||
use ruff_python_ast::str_prefix::{
|
||||
AnyStringPrefix, ByteStringPrefix, FStringPrefix, StringLiteralPrefix,
|
||||
|
@ -16,10 +16,11 @@ use crate::other::f_string_element::FormatFStringExpressionElement;
|
|||
use crate::prelude::*;
|
||||
use crate::string::docstring::needs_chaperone_space;
|
||||
use crate::string::normalize::{
|
||||
is_fstring_with_quoted_debug_expression, is_fstring_with_quoted_format_spec_and_debug,
|
||||
is_fstring_with_triple_quoted_literal_expression_containing_quotes, QuoteMetadata,
|
||||
QuoteMetadata, is_fstring_with_quoted_debug_expression,
|
||||
is_fstring_with_quoted_format_spec_and_debug,
|
||||
is_fstring_with_triple_quoted_literal_expression_containing_quotes,
|
||||
};
|
||||
use crate::string::{normalize_string, StringLikeExtensions, StringNormalizer, StringQuotes};
|
||||
use crate::string::{StringLikeExtensions, StringNormalizer, StringQuotes, normalize_string};
|
||||
|
||||
/// Formats any implicitly concatenated string. This could be any valid combination
|
||||
/// of string, bytes or f-string literals.
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
use memchr::memchr2;
|
||||
pub(crate) use normalize::{normalize_string, NormalizedString, StringNormalizer};
|
||||
use ruff_python_ast::str::{Quote, TripleQuotes};
|
||||
pub(crate) use normalize::{NormalizedString, StringNormalizer, normalize_string};
|
||||
use ruff_python_ast::StringLikePart;
|
||||
use ruff_python_ast::str::{Quote, TripleQuotes};
|
||||
use ruff_python_ast::{
|
||||
self as ast,
|
||||
self as ast, AnyStringFlags, StringFlags,
|
||||
str_prefix::{AnyStringPrefix, StringLiteralPrefix},
|
||||
AnyStringFlags, StringFlags,
|
||||
};
|
||||
use ruff_source_file::LineRanges;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::QuoteStyle;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub(crate) mod docstring;
|
||||
pub(crate) mod implicit;
|
||||
|
|
|
@ -5,16 +5,16 @@ use std::iter::FusedIterator;
|
|||
use ruff_formatter::FormatContext;
|
||||
use ruff_python_ast::visitor::source_order::SourceOrderVisitor;
|
||||
use ruff_python_ast::{
|
||||
str::{Quote, TripleQuotes},
|
||||
AnyStringFlags, BytesLiteral, FString, FStringElement, FStringElements, FStringFlags,
|
||||
StringFlags, StringLikePart, StringLiteral,
|
||||
str::{Quote, TripleQuotes},
|
||||
};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSlice};
|
||||
|
||||
use crate::QuoteStyle;
|
||||
use crate::context::FStringState;
|
||||
use crate::prelude::*;
|
||||
use crate::string::StringQuotes;
|
||||
use crate::QuoteStyle;
|
||||
|
||||
pub(crate) struct StringNormalizer<'a, 'src> {
|
||||
preferred_quote_style: Option<QuoteStyle>,
|
||||
|
@ -1057,9 +1057,9 @@ mod tests {
|
|||
use std::borrow::Cow;
|
||||
|
||||
use ruff_python_ast::{
|
||||
AnyStringFlags,
|
||||
str::{Quote, TripleQuotes},
|
||||
str_prefix::{AnyStringPrefix, ByteStringPrefix},
|
||||
AnyStringFlags,
|
||||
};
|
||||
|
||||
use crate::string::normalize_string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue