ruff/crates
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
..
ruff Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
ruff_annotate_snippets Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_benchmark [ty] Reduce size of the many-tuple-assignments benchmark (#18131) 2025-05-16 15:28:23 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
ruff_dev Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_diagnostics Inline DiagnosticKind into other diagnostic types (#18074) 2025-05-15 10:27:21 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_linter [flake8-simplify] add fix safety section (SIM110) (#18114) 2025-05-19 16:38:08 -04:00
ruff_macros Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
ruff_python_ast Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_ast_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_codegen Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02: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 Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_resolver Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_semantic Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
ruff_source_file Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_text_size Add rustfmt.toml file (#18197) 2025-05-19 11:40:58 -04:00
ruff_wasm Unify Message variants (#18051) 2025-05-19 13:34:04 -04:00
ruff_workspace Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty Default src.root to ['.', '<project_name>'] if the directory exists (#18141) 2025-05-19 18:11:27 +02:00
ty_ide [ty] Support typing.TypeAliasType (#18156) 2025-05-19 16:36:49 +02:00
ty_project [ty] Small LSP cleanups (#18201) 2025-05-19 17:08:59 +00:00
ty_python_semantic [ty] Promote literals when inferring class specializations from constructors (#18102) 2025-05-19 15:42:54 -04:00
ty_server [ty] Small LSP cleanups (#18201) 2025-05-19 17:08:59 +00:00
ty_test Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty_vendored Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty_wasm Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00