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:
konsti 2023-11-17 00:12:46 +01:00 committed by GitHub
parent 6d5d079a18
commit 14e65afdc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 1124 additions and 1054 deletions

View file

@ -1973,9 +1973,9 @@ def f(arg=%timeit a = b):
#[test]
fn tet_too_low_dedent() {
let tokens: Vec<_> = lex(
r#"if True:
"if True:
pass
pass"#,
pass",
Mode::Module,
)
.collect();
@ -2198,10 +2198,10 @@ f"{(lambda x:{x})}"
assert_eq!(lex_fstring_error(r#"f"""{""""#), UnclosedLbrace);
assert_eq!(lex_fstring_error(r#"f""#), UnterminatedString);
assert_eq!(lex_fstring_error(r#"f'"#), UnterminatedString);
assert_eq!(lex_fstring_error(r"f'"), UnterminatedString);
assert_eq!(lex_fstring_error(r#"f""""#), UnterminatedTripleQuotedString);
assert_eq!(lex_fstring_error(r#"f'''"#), UnterminatedTripleQuotedString);
assert_eq!(lex_fstring_error(r"f'''"), UnterminatedTripleQuotedString);
assert_eq!(
lex_fstring_error(r#"f"""""#),
UnterminatedTripleQuotedString

View file

@ -741,12 +741,12 @@ array[3:5, *indexes_to_select]
#[test]
fn test_try() {
let parse_ast = parse_suite(
r#"try:
r"try:
raise ValueError(1)
except TypeError as e:
print(f'caught {type(e)}')
except OSError as e:
print(f'caught {type(e)}')"#,
print(f'caught {type(e)}')",
"<test>",
)
.unwrap();
@ -865,7 +865,7 @@ x = type = 1
#[test]
fn numeric_literals() {
let source = r#"x = 123456789
let source = r"x = 123456789
x = 123456
x = .1
x = 1.
@ -883,14 +883,14 @@ x = 0O777
x = 0.000000006
x = 10000
x = 133333
"#;
";
insta::assert_debug_snapshot!(parse_suite(source, "<test>").unwrap());
}
#[test]
fn numeric_literals_attribute_access() {
let source = r#"x = .1.is_integer()
let source = r"x = .1.is_integer()
x = 1. .imag
x = 1E+1.imag
x = 1E-1.real
@ -910,7 +910,7 @@ if 10 .real:
y = 100[no]
y = 100(no)
"#;
";
assert_debug_snapshot!(parse_suite(source, "<test>").unwrap());
}
@ -1173,9 +1173,9 @@ match x:
#[test]
fn test_variadic_generics() {
let parse_ast = parse_suite(
r#"
r"
def args_to_tuple(*args: *Ts) -> Tuple[*Ts]: ...
"#,
",
"<test>",
)
.unwrap();
@ -1185,7 +1185,7 @@ def args_to_tuple(*args: *Ts) -> Tuple[*Ts]: ...
#[test]
fn decorator_ranges() {
let parse_ast = parse_suite(
r#"
r"
@my_decorator
def test():
pass
@ -1193,7 +1193,7 @@ def test():
@class_decorator
class Abcd:
pass
"#
"
.trim(),
"<test>",
)
@ -1280,10 +1280,10 @@ foo.bar[0].baz[2].egg??
#[test]
fn test_ipython_escape_command_parse_error() {
let source = r#"
let source = r"
a = 1
%timeit a == 1
"#
"
.trim();
let lxr = lexer::lex_starts_at(source, Mode::Ipython, TextSize::default());
let parse_err = parse_tokens(lxr, source, Mode::Module, "<test>").unwrap_err();