From 1f654ee7295e82824c24027bccfe01cd484ec6f9 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 17 Jun 2024 07:15:10 +0100 Subject: [PATCH] Upgrade to Rust 1.79 (#11875) --- Cargo.toml | 2 +- crates/red_knot/src/module.rs | 2 +- crates/ruff_linter/src/registry/rule_set.rs | 11 +++++++---- crates/ruff_python_formatter/src/other/parameters.rs | 2 -- crates/ruff_text_size/src/size.rs | 1 - rust-toolchain.toml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 672a0683a75db..59f52a41c8c63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ imperative = { version = "1.0.4" } indexmap = { version = "2.2.6" } indicatif = { version = "0.17.8" } indoc = { version = "2.0.4" } -insta = { version = "1.35.1", feature = ["filters", "glob"] } +insta = { version = "1.35.1" } insta-cmd = { version = "0.6.0" } is-macro = { version = "0.3.5" } is-wsl = { version = "0.4.0" } diff --git a/crates/red_knot/src/module.rs b/crates/red_knot/src/module.rs index 9050aaebbf112..820648b08451b 100644 --- a/crates/red_knot/src/module.rs +++ b/crates/red_knot/src/module.rs @@ -932,7 +932,7 @@ mod tests { // Luckily this crate will fail to build if this file isn't available at build time. const TYPESHED_ZIP_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/zipped_typeshed.zip")); - assert!(!TYPESHED_ZIP_BYTES.is_empty()); + let mut typeshed_zip_archive = ZipArchive::new(Cursor::new(TYPESHED_ZIP_BYTES))?; let path_to_functools = Path::new("stdlib").join("functools.pyi"); diff --git a/crates/ruff_linter/src/registry/rule_set.rs b/crates/ruff_linter/src/registry/rule_set.rs index 7889ed81b5977..103906118af3a 100644 --- a/crates/ruff_linter/src/registry/rule_set.rs +++ b/crates/ruff_linter/src/registry/rule_set.rs @@ -1,8 +1,10 @@ -use crate::registry::Rule; -use ruff_macros::CacheKey; use std::fmt::{Debug, Display, Formatter}; use std::iter::FusedIterator; +use ruff_macros::CacheKey; + +use crate::registry::Rule; + const RULESET_SIZE: usize = 14; /// A set of [`Rule`]s. @@ -367,7 +369,7 @@ impl Iterator for RuleSetIterator { let rule_value = self.index * RuleSet::SLICE_BITS + bit; // SAFETY: RuleSet guarantees that only valid rules are stored in the set. #[allow(unsafe_code)] - return Some(unsafe { std::mem::transmute(rule_value) }); + return Some(unsafe { std::mem::transmute::(rule_value) }); } self.index += 1; @@ -387,9 +389,10 @@ impl FusedIterator for RuleSetIterator {} #[cfg(test)] mod tests { - use crate::registry::{Rule, RuleSet}; use strum::IntoEnumIterator; + use crate::registry::{Rule, RuleSet}; + /// Tests that the set can contain all rules #[test] fn test_all_rules() { diff --git a/crates/ruff_python_formatter/src/other/parameters.rs b/crates/ruff_python_formatter/src/other/parameters.rs index 6368e86f4e389..7515ede0a0cc2 100644 --- a/crates/ruff_python_formatter/src/other/parameters.rs +++ b/crates/ruff_python_formatter/src/other/parameters.rs @@ -1,5 +1,3 @@ -use std::usize; - use ruff_formatter::{format_args, write, FormatRuleWithOptions}; use ruff_python_ast::Parameters; use ruff_python_ast::{AnyNodeRef, AstNode}; diff --git a/crates/ruff_text_size/src/size.rs b/crates/ruff_text_size/src/size.rs index e6d9a2dcbe1f9..1b597698d3f26 100644 --- a/crates/ruff_text_size/src/size.rs +++ b/crates/ruff_text_size/src/size.rs @@ -5,7 +5,6 @@ use { fmt, iter, num::TryFromIntError, ops::{Add, AddAssign, Sub, SubAssign}, - u32, }, }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 744175d523f9a..c6e4d7d5031fa 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.78" +channel = "1.79"