ruff/crates/ruff_linter/src
Vasco Schiavo b302d89da3
[flake8-simplify] add fix safety section (SIM110) (#18114)
The PR add the `fix safety` section for rule `SIM110` (#15584 )

### Unsafe Fix Example

```python
def predicate(item):
    global called
    called += 1
    if called == 1:
    # after first call we change the method
        def new_predicate(_): return False
        globals()['predicate'] = new_predicate
    return True

def foo():
    for item in range(10):
        if predicate(item):
            return True
    return False

def foo_gen():
    return any(predicate(item) for item in range(10))

called = 0
print(foo())      # true – returns immediately on first call

called = 0
print(foo_gen())  # false – second call uses new `predicate`
```

### Note

I notice that
[here](46be305ad2/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs (L60))
we have two rules, `SIM110` & `SIM111`. The second one seems not anymore
active. Should I delete `SIM111`?
2025-05-19 16:38:08 -04:00
..
checkers Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
comments Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
cst Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
docstrings Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
fix Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
importer Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
message Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
registry Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
rules [flake8-simplify] add fix safety section (SIM110) (#18114) 2025-05-19 16:38:08 -04:00
settings Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
snapshots [semantic-syntax-tests] IrrefutableCasePattern, SingleStarredAssignment, WriteToDebug, InvalidExpression (#17748) 2025-05-09 14:54:05 -04:00
codes.rs Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
directives.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
doc_lines.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
fs.rs Escape template filenames in glob patterns (#16407) 2025-03-03 09:29:58 -05:00
lib.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
line_width.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
linter.rs Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
locator.rs Split SourceLocation into LineColumn and SourceLocation (#17587) 2025-04-27 11:27:33 +01:00
logging.rs Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
noqa.rs Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
package.rs Detect empty implicit namespace packages (#14236) 2024-11-09 22:03:34 -05:00
packaging.rs
preview.rs [isort] Check full module path against project root(s) when categorizing first-party (#16565) 2025-05-05 11:40:01 -05:00
pyproject_toml.rs Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
registry.rs Sort linters alphabetically (#16168) 2025-02-14 22:05:08 +01:00
renamer.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
rule_redirects.rs [flake8-bandit] Move unsafe-markup-use from RUF035 to S704 (#15957) 2025-03-13 15:37:37 +01:00
rule_selector.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
source_kind.rs Update MSRV to 1.85 and toolchain to 1.87 (#18126) 2025-05-16 09:19:55 +02:00
test.rs Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
text_helpers.rs
upstream_categories.rs