mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-30 23:27:27 +00:00
Use Rust 1.76 (#9897)
This commit is contained in:
parent
eb2784c495
commit
688177ff6a
6 changed files with 24 additions and 25 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2277,7 +2277,6 @@ dependencies = [
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"static_assertions",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -21,8 +21,7 @@ impl<'a> LineSuffixes<'a> {
|
||||||
/// Takes all the pending line suffixes.
|
/// Takes all the pending line suffixes.
|
||||||
pub(super) fn take_pending<'l>(
|
pub(super) fn take_pending<'l>(
|
||||||
&'l mut self,
|
&'l mut self,
|
||||||
) -> impl Iterator<Item = LineSuffixEntry<'a>> + DoubleEndedIterator + 'l + ExactSizeIterator
|
) -> impl DoubleEndedIterator<Item = LineSuffixEntry<'a>> + 'l + ExactSizeIterator {
|
||||||
{
|
|
||||||
self.suffixes.drain(..)
|
self.suffixes.drain(..)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ once_cell = { workspace = true }
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true, optional = true }
|
||||||
smallvec = { workspace = true }
|
smallvec = { workspace = true }
|
||||||
static_assertions = { workspace = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = { workspace = true }
|
insta = { workspace = true }
|
||||||
|
|
|
@ -3880,18 +3880,22 @@ impl Ranged for crate::nodes::ParameterWithDefault {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(test)]
|
||||||
mod size_assertions {
|
mod tests {
|
||||||
use static_assertions::assert_eq_size;
|
|
||||||
|
|
||||||
#[allow(clippy::wildcard_imports)]
|
#[allow(clippy::wildcard_imports)]
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
assert_eq_size!(Stmt, [u8; 144]);
|
#[test]
|
||||||
assert_eq_size!(StmtFunctionDef, [u8; 144]);
|
#[cfg(target_pointer_width = "64")]
|
||||||
assert_eq_size!(StmtClassDef, [u8; 104]);
|
fn size() {
|
||||||
assert_eq_size!(StmtTry, [u8; 112]);
|
assert!(std::mem::size_of::<Stmt>() <= 144);
|
||||||
assert_eq_size!(Expr, [u8; 80]);
|
assert!(std::mem::size_of::<StmtFunctionDef>() <= 144);
|
||||||
assert_eq_size!(Pattern, [u8; 96]);
|
assert!(std::mem::size_of::<StmtClassDef>() <= 104);
|
||||||
assert_eq_size!(Mod, [u8; 32]);
|
assert!(std::mem::size_of::<StmtTry>() <= 112);
|
||||||
|
// 80 for Rustc < 1.76
|
||||||
|
assert!(matches!(std::mem::size_of::<Expr>(), 72 | 80));
|
||||||
|
// 96 for Rustc < 1.76
|
||||||
|
assert!(matches!(std::mem::size_of::<Pattern>(), 88 | 96));
|
||||||
|
assert!(std::mem::size_of::<Mod>() <= 32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,21 +560,19 @@ impl From<ExprSlice> for ParenthesizedExpr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
|
||||||
mod size_assertions {
|
|
||||||
use static_assertions::assert_eq_size;
|
|
||||||
|
|
||||||
use crate::parser::ParenthesizedExpr;
|
|
||||||
|
|
||||||
assert_eq_size!(ParenthesizedExpr, [u8; 88]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use insta::assert_debug_snapshot;
|
use insta::assert_debug_snapshot;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[cfg(target_pointer_width = "64")]
|
||||||
|
#[test]
|
||||||
|
fn size_assertions() {
|
||||||
|
// 80 with Rustc >= 1.76, 88 with Rustc < 1.76
|
||||||
|
assert!(matches!(std::mem::size_of::<ParenthesizedExpr>(), 80 | 88));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_empty() {
|
fn test_parse_empty() {
|
||||||
let parse_ast = parse_suite("").unwrap();
|
let parse_ast = parse_suite("").unwrap();
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.75"
|
channel = "1.76"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue