mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
Update to Rust 1.74 and use new clippy lints table (#8722)
Update to [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html) and use the new clippy lints table. The update itself introduced a new clippy lint about superfluous hashes in raw strings, which got removed. I moved our lint config from `rustflags` to the newly stabilized [workspace.lints](https://doc.rust-lang.org/stable/cargo/reference/workspaces.html#the-lints-table). One consequence is that we have to `unsafe_code = "warn"` instead of "forbid" because the latter now actually bans unsafe code: ``` error[E0453]: allow(unsafe_code) incompatible with previous forbid --> crates/ruff_source_file/src/newlines.rs:62:17 | 62 | #[allow(unsafe_code)] | ^^^^^^^^^^^ overruled by previous forbid | = note: `forbid` lint level was set on command line ``` --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
6d5d079a18
commit
14e65afdc6
71 changed files with 1124 additions and 1054 deletions
|
@ -171,7 +171,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn empty_file() {
|
||||
let locator = Locator::new(r#""#);
|
||||
let locator = Locator::new(r"");
|
||||
let diagnostics = create_diagnostics([]);
|
||||
let FixResult {
|
||||
code,
|
||||
|
@ -225,10 +225,10 @@ print("hello world")
|
|||
#[test]
|
||||
fn apply_one_replacement() {
|
||||
let locator = Locator::new(
|
||||
r#"
|
||||
r"
|
||||
class A(object):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
let diagnostics = create_diagnostics([Edit::replacement(
|
||||
|
@ -243,10 +243,10 @@ class A(object):
|
|||
} = apply_fixes(diagnostics.iter(), &locator);
|
||||
assert_eq!(
|
||||
code,
|
||||
r#"
|
||||
r"
|
||||
class A(Bar):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
assert_eq!(fixes.values().sum::<usize>(), 1);
|
||||
|
@ -262,10 +262,10 @@ class A(Bar):
|
|||
#[test]
|
||||
fn apply_one_removal() {
|
||||
let locator = Locator::new(
|
||||
r#"
|
||||
r"
|
||||
class A(object):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
let diagnostics = create_diagnostics([Edit::deletion(TextSize::new(7), TextSize::new(15))]);
|
||||
|
@ -276,10 +276,10 @@ class A(object):
|
|||
} = apply_fixes(diagnostics.iter(), &locator);
|
||||
assert_eq!(
|
||||
code,
|
||||
r#"
|
||||
r"
|
||||
class A:
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim()
|
||||
);
|
||||
assert_eq!(fixes.values().sum::<usize>(), 1);
|
||||
|
@ -295,10 +295,10 @@ class A:
|
|||
#[test]
|
||||
fn apply_two_removals() {
|
||||
let locator = Locator::new(
|
||||
r#"
|
||||
r"
|
||||
class A(object, object, object):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
let diagnostics = create_diagnostics([
|
||||
|
@ -313,10 +313,10 @@ class A(object, object, object):
|
|||
|
||||
assert_eq!(
|
||||
code,
|
||||
r#"
|
||||
r"
|
||||
class A(object):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim()
|
||||
);
|
||||
assert_eq!(fixes.values().sum::<usize>(), 2);
|
||||
|
@ -334,10 +334,10 @@ class A(object):
|
|||
#[test]
|
||||
fn ignore_overlapping_fixes() {
|
||||
let locator = Locator::new(
|
||||
r#"
|
||||
r"
|
||||
class A(object):
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
let diagnostics = create_diagnostics([
|
||||
|
@ -351,10 +351,10 @@ class A(object):
|
|||
} = apply_fixes(diagnostics.iter(), &locator);
|
||||
assert_eq!(
|
||||
code,
|
||||
r#"
|
||||
r"
|
||||
class A:
|
||||
...
|
||||
"#
|
||||
"
|
||||
.trim(),
|
||||
);
|
||||
assert_eq!(fixes.values().sum::<usize>(), 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue