ruff/crates
konsti aafde6db28
Remove some indexing (#6728)
**Summary** A common pattern in the code used to be
```rust
if statements.len() != 1 {
    return;
}
use_single_entry(statements[0])?;
```
which can be better expressed as
```rust
let [statement] = statements else {
    return;
};
use_single_entry(statements)?;
```

Direct indexing can cause panics if you don't manually take care of
checking the length, while matching (such as if-let or let-else) can
never panic.

This isn't a complete refactor, i've just removed some of the obvious
cases. I've specifically looked for `.len() != 1` and fixed those.

**Test Plan** No functional changes
2023-08-21 16:56:15 +02:00
..
flake8_to_ruff Bump version to 0.0.285 (#6660) 2023-08-17 15:46:28 -05:00
ruff Remove some indexing (#6728) 2023-08-21 16:56:15 +02:00
ruff_benchmark Refactor SourceKind to store file content (#6640) 2023-08-18 13:45:38 +00:00
ruff_cache Error on zero tab width (#6429) 2023-08-08 16:51:37 -04:00
ruff_cli Remove some indexing (#6728) 2023-08-21 16:56:15 +02:00
ruff_dev Use a faster diffing library for the formatter ecosystem checks (#6497) 2023-08-11 15:51:54 +02:00
ruff_diagnostics
ruff_formatter ruff_formatter crate doc comment fixes (#6677) 2023-08-19 17:42:02 +01:00
ruff_index
ruff_macros
ruff_python_ast Make Parameters an optional field on ExprLambda (#6669) 2023-08-18 15:34:54 +00:00
ruff_python_codegen Make Parameters an optional field on ExprLambda (#6669) 2023-08-18 15:34:54 +00:00
ruff_python_formatter Remove unnecessary LibCST usage in key-in-dict (#6727) 2023-08-21 10:32:09 -04:00
ruff_python_index Remove some extraneous newlines in Cargo.toml (#6577) 2023-08-14 23:39:41 +00:00
ruff_python_literal Add support for nested replacements inside format specifications (#6616) 2023-08-17 09:07:30 -05:00
ruff_python_parser Make Parameters an optional field on ExprLambda (#6669) 2023-08-18 15:34:54 +00:00
ruff_python_resolver
ruff_python_semantic Add BranchId to the model snapshot (#6706) 2023-08-20 15:35:49 +00:00
ruff_python_stdlib
ruff_python_trivia Add support for multi-character operator tokens to SimpleTokenizer (#6563) 2023-08-16 09:09:19 -04:00
ruff_shrinking Implement Ranged on more structs (#6639) 2023-08-17 11:22:39 -04:00
ruff_source_file
ruff_text_size
ruff_wasm Set a default on PythonVersion (#6446) 2023-08-09 15:19:27 +00:00