ruff/crates
GiGaGon 059e90a98f
[refurb] Make example error out-of-the-box (FURB122) (#19297)
## Summary

Part of #18972

This PR makes [for-loop-writes
(FURB122)](https://docs.astral.sh/ruff/rules/for-loop-writes/#for-loop-writes-furb122)'s
example error out-of-the-box. I also had to re-name the second case's
variables to get both to raise at the same time, I suspect because of
limitations in ruff's current semantic model. New names subject to
bikeshedding, I just went with the least effort `_b` for binary suffix.

[Old example](https://play.ruff.rs/19e8e47a-8058-4013-aef5-e9b5eab65962)
```py
with Path("file").open("w") as f:
    for line in lines:
        f.write(line)

with Path("file").open("wb") as f:
    for line in lines:
        f.write(line.encode())
```

[New example](https://play.ruff.rs/e96b00e5-3c63-47c3-996d-dace420dd711)
```py
from pathlib import Path

with Path("file").open("w") as f:
    for line in lines:
        f.write(line)

with Path("file").open("wb") as f_b:
    for line_b in lines_b:
        f_b.write(line_b.encode())
```

The "Use instead" section was also modified similarly.

## Test Plan

<!-- How was it tested? -->

N/A, no functionality/tests affected
2025-07-14 11:24:16 -05:00
..
ruff Update Rust crate toml to 0.9.0 (#19320) 2025-07-14 13:11:10 +05:30
ruff_annotate_snippets Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_benchmark [ty] Re-enable multithreaded pydantic benchmark (#19176) 2025-07-07 14:28:15 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db [ty] Fix server version (#19284) 2025-07-14 09:06:34 +02:00
ruff_dev Auto-generate environment variable references for ty (#19205) 2025-07-08 10:48:31 -04:00
ruff_diagnostics Combine OldDiagnostic and Diagnostic (#19053) 2025-07-03 13:01:09 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_index Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
ruff_linter [refurb] Make example error out-of-the-box (FURB122) (#19297) 2025-07-14 11:24:16 -05:00
ruff_macros [ty] Merge ty_macros into ruff_macros (#19229) 2025-07-09 11:28:21 +00:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata
ruff_python_ast [ty] Use an interval map for scopes by expression (#19025) 2025-07-14 13:50:58 +02:00
ruff_python_ast_integration_tests [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
ruff_python_codegen Fix f-string interpolation escaping (#18882) 2025-06-25 10:04:15 +02:00
ruff_python_formatter Update pre-commit dependencies (#19162) 2025-07-07 04:07:44 +00:00
ruff_python_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_literal Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_parser [ty] add support for nonlocal statements 2025-07-11 09:44:54 -07:00
ruff_python_semantic [flake8-return] Fix false-positive for variables used inside nested functions in RET504 (#18433) 2025-07-10 16:10:22 -04:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Treat ty: comments as pragma comments (#18532) 2025-06-07 16:02:43 +02:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Render Azure, JSON, and JSON lines output with the new diagnostics (#19133) 2025-07-11 15:04:46 -04:00
ruff_source_file [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
ruff_text_size [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
ruff_wasm Bump 0.12.3 (#19279) 2025-07-11 09:07:50 -04:00
ruff_workspace Fix description of the format.skip-magic-trailing-comma example (#19095) 2025-07-03 10:39:59 -04:00
ty [ty] Use python version and path from Python extension (#19012) 2025-07-14 09:47:27 +00:00
ty_ide [ty] Fix handling of metaclasses in object.<CURSOR> completions 2025-07-14 08:24:23 -04:00
ty_project [ty] Use python version and path from Python extension (#19012) 2025-07-14 09:47:27 +00:00
ty_python_semantic [ty] Fix handling of metaclasses in object.<CURSOR> completions 2025-07-14 08:24:23 -04:00
ty_server [ty] Add virtual files to the only project database (#19322) 2025-07-14 20:17:51 +05:30
ty_static [ty] Merge ty_macros into ruff_macros (#19229) 2025-07-09 11:28:21 +00:00
ty_test [ty] Make check_file a salsa query (#19255) 2025-07-10 18:46:56 +05:30
ty_vendored [ty] List all enum members (#19283) 2025-07-14 13:18:17 +02:00
ty_wasm [ty] Fix server version (#19284) 2025-07-14 09:06:34 +02:00