Skip to content

Commit 6a1e555

Browse files
authored
Upgrade to Rust 1.78 (#11260)
1 parent 349a4cf commit 6a1e555

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+67
-549
lines changed

clippy.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@ doc-valid-idents = [
33
"CodeQL",
44
"IPython",
55
"NumPy",
6+
"LibCST",
7+
"SCREAMING_SNAKE_CASE",
8+
"SQLAlchemy",
9+
"McCabe",
10+
"FastAPI",
611
"..",
712
]

crates/ruff/src/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ pub struct CheckCommand {
338338
/// The name of the file when passing it through stdin.
339339
#[arg(long, help_heading = "Miscellaneous")]
340340
pub stdin_filename: Option<PathBuf>,
341-
/// List of mappings from file extension to language (one of ["python", "ipynb", "pyi"]). For
341+
/// List of mappings from file extension to language (one of `python`, `ipynb`, `pyi`). For
342342
/// example, to treat `.ipy` files as IPython notebooks, use `--extension ipy:ipynb`.
343343
#[arg(long, value_delimiter = ',')]
344344
pub extension: Option<Vec<ExtensionPair>>,
@@ -466,7 +466,7 @@ pub struct FormatCommand {
466466
/// The name of the file when passing it through stdin.
467467
#[arg(long, help_heading = "Miscellaneous")]
468468
pub stdin_filename: Option<PathBuf>,
469-
/// List of mappings from file extension to language (one of ["python", "ipynb", "pyi"]). For
469+
/// List of mappings from file extension to language (one of `python`, `ipynb`, `pyi`). For
470470
/// example, to treat `.ipy` files as IPython notebooks, use `--extension ipy:ipynb`.
471471
#[arg(long, value_delimiter = ',')]
472472
pub extension: Option<Vec<ExtensionPair>>,

crates/ruff_formatter/src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub struct RemoveSoftLinesBuffer<'a, Context> {
344344

345345
/// Caches the interned elements after the soft line breaks have been removed.
346346
///
347-
/// The `key` is the [Interned] element as it has been passed to [Self::write_element] or the child of another
347+
/// The `key` is the [Interned] element as it has been passed to [`Self::write_element`] or the child of another
348348
/// [Interned] element. The `value` is the matching document of the key where all soft line breaks have been removed.
349349
///
350350
/// It's fine to not snapshot the cache. The worst that can happen is that it holds on interned elements

crates/ruff_formatter/src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ pub enum FormatError {
1818
InvalidDocument(InvalidDocumentError),
1919

2020
/// Formatting failed because some content encountered a situation where a layout
21-
/// choice by an enclosing [crate::Format] resulted in a poor layout for a child [crate::Format].
21+
/// choice by an enclosing [`crate::Format`] resulted in a poor layout for a child [`crate::Format`].
2222
///
23-
/// It's up to an enclosing [crate::Format] to handle the error and pick another layout.
24-
/// This error should not be raised if there's no outer [crate::Format] handling the poor layout error,
23+
/// It's up to an enclosing [`crate::Format`] to handle the error and pick another layout.
24+
/// This error should not be raised if there's no outer [`crate::Format`] handling the poor layout error,
2525
/// avoiding that formatting of the whole document fails.
2626
PoorLayout,
2727
}

crates/ruff_formatter/src/format_element.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use ruff_text_size::TextSize;
1919
/// Use the helper functions like [`crate::builders::space`], [`crate::builders::soft_line_break`] etc. defined in this file to create elements.
2020
#[derive(Clone, Eq, PartialEq)]
2121
pub enum FormatElement {
22-
/// A space token, see [crate::builders::space] for documentation.
22+
/// A space token, see [`crate::builders::space`] for documentation.
2323
Space,
2424

25-
/// A new line, see [crate::builders::soft_line_break], [crate::builders::hard_line_break], and [crate::builders::soft_line_break_or_space] for documentation.
25+
/// A new line, see [`crate::builders::soft_line_break`], [`crate::builders::hard_line_break`], and [`crate::builders::soft_line_break_or_space`] for documentation.
2626
Line(LineMode),
2727

2828
/// Forces the parent group to print in expanded mode.
@@ -108,13 +108,13 @@ impl std::fmt::Debug for FormatElement {
108108

109109
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
110110
pub enum LineMode {
111-
/// See [crate::builders::soft_line_break_or_space] for documentation.
111+
/// See [`crate::builders::soft_line_break_or_space`] for documentation.
112112
SoftOrSpace,
113-
/// See [crate::builders::soft_line_break] for documentation.
113+
/// See [`crate::builders::soft_line_break`] for documentation.
114114
Soft,
115-
/// See [crate::builders::hard_line_break] for documentation.
115+
/// See [`crate::builders::hard_line_break`] for documentation.
116116
Hard,
117-
/// See [crate::builders::empty_line] for documentation.
117+
/// See [`crate::builders::empty_line`] for documentation.
118118
Empty,
119119
}
120120

crates/ruff_formatter/src/format_element/tag.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ use std::num::NonZeroU8;
99
/// will be applied to all elements in between the start/end tags.
1010
#[derive(Clone, Debug, Eq, PartialEq)]
1111
pub enum Tag {
12-
/// Indents the content one level deeper, see [crate::builders::indent] for documentation and examples.
12+
/// Indents the content one level deeper, see [`crate::builders::indent`] for documentation and examples.
1313
StartIndent,
1414
EndIndent,
1515

16-
/// Variant of [TagKind::Indent] that indents content by a number of spaces. For example, `Align(2)`
16+
/// Variant of [`TagKind::Indent`] that indents content by a number of spaces. For example, `Align(2)`
1717
/// indents any content following a line break by an additional two spaces.
1818
///
19-
/// Nesting (Aligns)[TagKind::Align] has the effect that all except the most inner align are handled as (Indent)[TagKind::Indent].
19+
/// Nesting (Aligns)[`TagKind::Align`] has the effect that all except the most inner align are handled as (Indent)[`TagKind::Indent`].
2020
StartAlign(Align),
2121
EndAlign,
2222

@@ -29,7 +29,7 @@ pub enum Tag {
2929
/// - on a single line: Omitting `LineMode::Soft` line breaks and printing spaces for `LineMode::SoftOrSpace`
3030
/// - on multiple lines: Printing all line breaks
3131
///
32-
/// See [crate::builders::group] for documentation and examples.
32+
/// See [`crate::builders::group`] for documentation and examples.
3333
StartGroup(Group),
3434
EndGroup,
3535

@@ -44,22 +44,22 @@ pub enum Tag {
4444
EndConditionalGroup,
4545

4646
/// Allows to specify content that gets printed depending on whatever the enclosing group
47-
/// is printed on a single line or multiple lines. See [crate::builders::if_group_breaks] for examples.
47+
/// is printed on a single line or multiple lines. See [`crate::builders::if_group_breaks`] for examples.
4848
StartConditionalContent(Condition),
4949
EndConditionalContent,
5050

51-
/// Optimized version of [Tag::StartConditionalContent] for the case where some content
51+
/// Optimized version of [`Tag::StartConditionalContent`] for the case where some content
5252
/// should be indented if the specified group breaks.
5353
StartIndentIfGroupBreaks(GroupId),
5454
EndIndentIfGroupBreaks,
5555

5656
/// Concatenates multiple elements together with a given separator printed in either
5757
/// flat or expanded mode to fill the print width. Expect that the content is a list of alternating
58-
/// [element, separator] See [crate::Formatter::fill].
58+
/// [element, separator] See [`crate::Formatter::fill`].
5959
StartFill,
6060
EndFill,
6161

62-
/// Entry inside of a [Tag::StartFill]
62+
/// Entry inside of a [`Tag::StartFill`]
6363
StartEntry,
6464
EndEntry,
6565

@@ -77,7 +77,7 @@ pub enum Tag {
7777
/// Special semantic element marking the content with a label.
7878
/// This does not directly influence how the content will be printed.
7979
///
80-
/// See [crate::builders::labelled] for documentation.
80+
/// See [`crate::builders::labelled`] for documentation.
8181
StartLabelled(LabelId),
8282
EndLabelled,
8383

crates/ruff_formatter/src/printer/queue.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -189,27 +189,6 @@ impl<'a, 'print> Queue<'a> for FitsQueue<'a, 'print> {
189189
}
190190
}
191191

192-
/// Iterator that calls [`Queue::pop`] until it reaches the end of the document.
193-
///
194-
/// The iterator traverses into the content of any [`FormatElement::Interned`].
195-
pub(super) struct QueueIterator<'a, 'q, Q: Queue<'a>> {
196-
queue: &'q mut Q,
197-
lifetime: PhantomData<&'a ()>,
198-
}
199-
200-
impl<'a, Q> Iterator for QueueIterator<'a, '_, Q>
201-
where
202-
Q: Queue<'a>,
203-
{
204-
type Item = &'a FormatElement;
205-
206-
fn next(&mut self) -> Option<Self::Item> {
207-
self.queue.pop()
208-
}
209-
}
210-
211-
impl<'a, Q> FusedIterator for QueueIterator<'a, '_, Q> where Q: Queue<'a> {}
212-
213192
pub(super) struct QueueContentIterator<'a, 'q, Q: Queue<'a>> {
214193
queue: &'q mut Q,
215194
kind: TagKind,

crates/ruff_formatter/src/printer/stack.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ pub(super) trait Stack<T> {
88

99
/// Returns the last element if any
1010
fn top(&self) -> Option<&T>;
11-
12-
/// Returns `true` if the stack is empty
13-
fn is_empty(&self) -> bool;
1411
}
1512

1613
impl<T> Stack<T> for Vec<T> {
@@ -25,10 +22,6 @@ impl<T> Stack<T> for Vec<T> {
2522
fn top(&self) -> Option<&T> {
2623
self.last()
2724
}
28-
29-
fn is_empty(&self) -> bool {
30-
self.is_empty()
31-
}
3225
}
3326

3427
/// A Stack that is stacked on top of another stack. Guarantees that the underlying stack remains unchanged.
@@ -80,10 +73,6 @@ where
8073
.last()
8174
.or_else(|| self.original.as_slice().last())
8275
}
83-
84-
fn is_empty(&self) -> bool {
85-
self.stack.is_empty() && self.original.len() == 0
86-
}
8776
}
8877

8978
#[cfg(test)]

crates/ruff_linter/src/directives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub(crate) struct TodoComment<'a> {
273273
pub(crate) directive: TodoDirective<'a>,
274274
/// The comment's actual [`TextRange`].
275275
pub(crate) range: TextRange,
276-
/// The comment range's position in [`Indexer`].comment_ranges()
276+
/// The comment range's position in [`Indexer::comment_ranges`]
277277
pub(crate) range_index: usize,
278278
}
279279

crates/ruff_linter/src/line_width.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl CacheKey for LineLength {
5656
pub enum ParseLineWidthError {
5757
/// The string could not be parsed as a valid [u16]
5858
ParseError(ParseIntError),
59-
/// The [u16] value of the string is not a valid [LineLength]
59+
/// The [u16] value of the string is not a valid [`LineLength`]
6060
TryFromIntError(LineLengthFromIntError),
6161
}
6262

0 commit comments

Comments
 (0)