mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-18 09:31:09 +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
|
@ -190,7 +190,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn indentation() {
|
||||
let contents = r#"x = 1"#;
|
||||
let contents = r"x = 1";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -198,10 +198,10 @@ mod tests {
|
|||
&Indentation::default()
|
||||
);
|
||||
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
if True:
|
||||
pass
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -209,10 +209,10 @@ if True:
|
|||
&Indentation(" ".to_string())
|
||||
);
|
||||
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
if True:
|
||||
pass
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -220,10 +220,10 @@ if True:
|
|||
&Indentation(" ".to_string())
|
||||
);
|
||||
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
if True:
|
||||
pass
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -232,13 +232,13 @@ if True:
|
|||
);
|
||||
|
||||
// TODO(charlie): Should non-significant whitespace be detected?
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
x = (
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
)
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -247,11 +247,11 @@ x = (
|
|||
);
|
||||
|
||||
// formfeed indent, see `detect_indention` comment.
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
class FormFeedIndent:
|
||||
def __init__(self, a=[]):
|
||||
print(a)
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -262,7 +262,7 @@ class FormFeedIndent:
|
|||
|
||||
#[test]
|
||||
fn quote() {
|
||||
let contents = r#"x = 1"#;
|
||||
let contents = r"x = 1";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -270,7 +270,7 @@ class FormFeedIndent:
|
|||
Quote::default()
|
||||
);
|
||||
|
||||
let contents = r#"x = '1'"#;
|
||||
let contents = r"x = '1'";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -278,7 +278,7 @@ class FormFeedIndent:
|
|||
Quote::Single
|
||||
);
|
||||
|
||||
let contents = r#"x = f'1'"#;
|
||||
let contents = r"x = f'1'";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
@ -373,9 +373,9 @@ a = f"v"
|
|||
Quote::Double
|
||||
);
|
||||
|
||||
let contents = r#"
|
||||
let contents = r"
|
||||
f'''Module docstring.'''
|
||||
"#;
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let tokens: Vec<_> = lex(contents, Mode::Module).collect();
|
||||
assert_eq!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue