mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:34:40 +00:00
Upgrade Rust toolchain to 1.83 (#14677)
This commit is contained in:
parent
a6402fb51e
commit
b63c2e126b
63 changed files with 127 additions and 127 deletions
|
@ -340,7 +340,7 @@ impl<'a, T> IntoIterator for LeadingDanglingTrailing<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Debug for LeadingDanglingTrailing<'a, T>
|
||||
impl<T> Debug for LeadingDanglingTrailing<'_, T>
|
||||
where
|
||||
T: Debug,
|
||||
{
|
||||
|
|
|
@ -221,7 +221,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ast, 'buf, B> Deref for WithNodeLevel<'ast, 'buf, B>
|
||||
impl<'ast, B> Deref for WithNodeLevel<'ast, '_, B>
|
||||
where
|
||||
B: Buffer<Context = PyFormatContext<'ast>>,
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ast, 'buf, B> DerefMut for WithNodeLevel<'ast, 'buf, B>
|
||||
impl<'ast, B> DerefMut for WithNodeLevel<'ast, '_, B>
|
||||
where
|
||||
B: Buffer<Context = PyFormatContext<'ast>>,
|
||||
{
|
||||
|
|
|
@ -881,7 +881,7 @@ impl Format<PyFormatContext<'_>> for Operand<'_> {
|
|||
fn fmt(&self, f: &mut Formatter<PyFormatContext<'_>>) -> FormatResult<()> {
|
||||
let expression = self.expression();
|
||||
|
||||
return if is_expression_parenthesized(
|
||||
if is_expression_parenthesized(
|
||||
expression.into(),
|
||||
f.context().comments().ranges(),
|
||||
f.context().source(),
|
||||
|
@ -1017,7 +1017,7 @@ impl Format<PyFormatContext<'_>> for Operand<'_> {
|
|||
Ok(())
|
||||
} else {
|
||||
expression.format().with_options(Parentheses::Never).fmt(f)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,9 +133,7 @@ impl FormatNodeRule<ExprTuple> for FormatExprTuple {
|
|||
// ```
|
||||
// In all other cases comments get assigned to a list element
|
||||
match elts.as_slice() {
|
||||
[] => {
|
||||
return empty_parenthesized("(", dangling, ")").fmt(f);
|
||||
}
|
||||
[] => empty_parenthesized("(", dangling, ")").fmt(f),
|
||||
[single] => match self.parentheses {
|
||||
TupleParentheses::Preserve if !is_parenthesized => {
|
||||
single.format().fmt(f)?;
|
||||
|
|
|
@ -14,7 +14,7 @@ pub(super) enum AnyExpressionYield<'a> {
|
|||
YieldFrom(&'a ExprYieldFrom),
|
||||
}
|
||||
|
||||
impl<'a> AnyExpressionYield<'a> {
|
||||
impl AnyExpressionYield<'_> {
|
||||
const fn is_yield_from(&self) -> bool {
|
||||
matches!(self, AnyExpressionYield::YieldFrom(_))
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@ impl<T, C> AsFormat<C> for &T
|
|||
where
|
||||
T: AsFormat<C>,
|
||||
{
|
||||
type Format<'a> = T::Format<'a> where Self: 'a;
|
||||
type Format<'a>
|
||||
= T::Format<'a>
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
AsFormat::format(&**self)
|
||||
|
|
|
@ -36,7 +36,7 @@ pub(crate) enum ClauseHeader<'a> {
|
|||
OrElse(ElseClause<'a>),
|
||||
}
|
||||
|
||||
impl<'a> ClauseHeader<'a> {
|
||||
impl ClauseHeader<'_> {
|
||||
/// The range from the clause keyword up to and including the final colon.
|
||||
pub(crate) fn range(self, source: &str) -> FormatResult<TextRange> {
|
||||
let keyword_range = self.first_keyword_range(source)?;
|
||||
|
|
|
@ -47,12 +47,10 @@ impl FormatRule<ExceptHandler, PyFormatContext<'_>> for FormatExceptHandler {
|
|||
}
|
||||
|
||||
impl<'ast> AsFormat<PyFormatContext<'ast>> for ExceptHandler {
|
||||
type Format<'a> = FormatRefWithRule<
|
||||
'a,
|
||||
ExceptHandler,
|
||||
FormatExceptHandler,
|
||||
PyFormatContext<'ast>,
|
||||
> where Self: 'a;
|
||||
type Format<'a>
|
||||
= FormatRefWithRule<'a, ExceptHandler, FormatExceptHandler, PyFormatContext<'ast>>
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
FormatRefWithRule::new(self, FormatExceptHandler::default())
|
||||
|
|
|
@ -267,7 +267,7 @@ struct DocstringLinePrinter<'ast, 'buf, 'fmt, 'src> {
|
|||
code_example: CodeExample<'src>,
|
||||
}
|
||||
|
||||
impl<'ast, 'buf, 'fmt, 'src> DocstringLinePrinter<'ast, 'buf, 'fmt, 'src> {
|
||||
impl<'src> DocstringLinePrinter<'_, '_, '_, 'src> {
|
||||
/// Print all of the lines in the given iterator to this
|
||||
/// printer's formatter.
|
||||
///
|
||||
|
@ -665,7 +665,7 @@ struct OutputDocstringLine<'src> {
|
|||
is_last: bool,
|
||||
}
|
||||
|
||||
impl<'src> OutputDocstringLine<'src> {
|
||||
impl OutputDocstringLine<'_> {
|
||||
/// Return this reformatted line, but with the given function applied to
|
||||
/// the text of the line.
|
||||
fn map(self, mut map: impl FnMut(&str) -> String) -> OutputDocstringLine<'static> {
|
||||
|
@ -1026,7 +1026,7 @@ impl<'src> CodeExampleRst<'src> {
|
|||
///
|
||||
/// [literal block]: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#literal-blocks
|
||||
/// [code block directive]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block
|
||||
fn new(original: InputDocstringLine<'src>) -> Option<CodeExampleRst> {
|
||||
fn new(original: InputDocstringLine<'src>) -> Option<CodeExampleRst<'src>> {
|
||||
let (opening_indent, rest) = indent_with_suffix(original.line);
|
||||
if rest.starts_with(".. ") {
|
||||
if let Some(litblock) = CodeExampleRst::new_code_block(original) {
|
||||
|
@ -1061,7 +1061,7 @@ impl<'src> CodeExampleRst<'src> {
|
|||
/// Attempts to create a new reStructuredText code example from a
|
||||
/// `code-block` or `sourcecode` directive. If one couldn't be found, then
|
||||
/// `None` is returned.
|
||||
fn new_code_block(original: InputDocstringLine<'src>) -> Option<CodeExampleRst> {
|
||||
fn new_code_block(original: InputDocstringLine<'src>) -> Option<CodeExampleRst<'src>> {
|
||||
// This regex attempts to parse the start of a reStructuredText code
|
||||
// block [directive]. From the reStructuredText spec:
|
||||
//
|
||||
|
|
|
@ -778,7 +778,7 @@ impl<'str> CharIndicesWithOffset<'str> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'str> Iterator for CharIndicesWithOffset<'str> {
|
||||
impl Iterator for CharIndicesWithOffset<'_> {
|
||||
type Item = (usize, char);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
|
|
@ -787,7 +787,7 @@ impl<'a> LogicalLinesIter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for LogicalLinesIter<'a> {
|
||||
impl Iterator for LogicalLinesIter<'_> {
|
||||
type Item = FormatResult<LogicalLine>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
@ -841,7 +841,7 @@ impl<'a> Iterator for LogicalLinesIter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> FusedIterator for LogicalLinesIter<'a> {}
|
||||
impl FusedIterator for LogicalLinesIter<'_> {}
|
||||
|
||||
/// A logical line or a comment (or form feed only) line
|
||||
struct LogicalLine {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue