Skip to content

Commit

Permalink
Rust 1.73 (#8007)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Oct 23, 2023
1 parent d6a4283 commit 2c2ebf9
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ jobs:
- uses: actions/checkout@v4
- name: "Install nightly Rust toolchain"
# Only pinned to make caching work, update freely
run: rustup toolchain install nightly-2023-06-08
run: rustup toolchain install nightly-2023-10-15
- uses: Swatinem/rust-cache@v2
- name: "Install cargo-udeps"
uses: taiki-e/install-action@cargo-udeps
- name: "Run cargo-udeps"
run: cargo +nightly-2023-06-08 udeps
run: cargo +nightly-2023-10-15 udeps

python-package:
name: "python package"
Expand Down
2 changes: 1 addition & 1 deletion crates/flake8_to_ruff/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub(crate) fn collect_per_file_ignores(
for pair in pairs {
per_file_ignores
.entry(pair.pattern)
.or_insert_with(Vec::new)
.or_default()
.push(pair.prefix);
}
per_file_ignores
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ pub fn collect_per_file_ignores(pairs: Vec<PatternPrefixPair>) -> Vec<PerFileIgn
for pair in pairs {
per_file_ignores
.entry(pair.pattern)
.or_insert_with(Vec::new)
.or_default()
.push(pair.prefix);
}
per_file_ignores
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_formatter/src/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ where

/// Adds a new entry to the join output.
pub fn entry(&mut self, entry: &dyn Format<Context>) -> &mut Self {
self.result = self.result.and_then(|_| {
self.result = self.result.and_then(|()| {
if let Some(with) = &self.with {
if self.has_elements {
with.fmt(self.fmt)?;
Expand Down Expand Up @@ -2519,7 +2519,7 @@ impl<'a, 'buf, Context> FillBuilder<'a, 'buf, Context> {
separator: &dyn Format<Context>,
entry: &dyn Format<Context>,
) -> &mut Self {
self.result = self.result.and_then(|_| {
self.result = self.result.and_then(|()| {
if self.empty {
self.empty = false;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ pub(crate) fn missing_whitespace_around_operator(
context: &mut LogicalLinesContext,
) {
let mut tokens = line.tokens().iter().peekable();
let first_token = tokens.by_ref().find_map(|token| {
let kind = token.kind();
(!kind.is_trivia()).then_some(token)
});
let first_token = tokens.by_ref().find(|token| !token.kind().is_trivia());
let Some(mut prev_token) = first_token else {
return;
};
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_notebook/src/notebook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Notebook {
{
let trailing_newline = reader.seek(SeekFrom::End(-1)).is_ok_and(|_| {
let mut buf = [0; 1];
reader.read_exact(&mut buf).is_ok_and(|_| buf[0] == b'\n')
reader.read_exact(&mut buf).is_ok_and(|()| buf[0] == b'\n')
});
reader.rewind()?;
let mut raw_notebook: RawNotebook = match serde_json::from_reader(reader.by_ref()) {
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_python_semantic/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl<'a> SemanticModel<'a> {
pub fn add_delayed_annotation(&mut self, binding_id: BindingId, annotation_id: BindingId) {
self.delayed_annotations
.entry(binding_id)
.or_insert_with(Vec::new)
.or_default()
.push(annotation_id);
}

Expand All @@ -1173,7 +1173,7 @@ impl<'a> SemanticModel<'a> {
pub fn add_rebinding_scope(&mut self, binding_id: BindingId, scope_id: ScopeId) {
self.rebinding_scopes
.entry(binding_id)
.or_insert_with(Vec::new)
.or_default()
.push(scope_id);
}

Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_workspace/src/options_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ impl<'fmt, 'buf> DisplayVisitor<'fmt, 'buf> {

impl Visit for DisplayVisitor<'_, '_> {
fn record_set(&mut self, name: &str, _: OptionSet) {
self.result = self.result.and_then(|_| writeln!(self.f, "{name}"));
self.result = self.result.and_then(|()| writeln!(self.f, "{name}"));
}

fn record_field(&mut self, name: &str, field: OptionField) {
self.result = self.result.and_then(|_| {
self.result = self.result.and_then(|()| {
write!(self.f, "{name}")?;

if field.deprecated.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.72"
channel = "1.73"

0 comments on commit 2c2ebf9

Please sign in to comment.