mirror of https://github.com/astral-sh/ruff
docs(SIM114): fix typo in python code (#2833)
This commit is contained in:
parent
46c184600f
commit
749d197119
|
|
@ -126,7 +126,7 @@ define_violation!(
|
|||
///
|
||||
/// Use instead:
|
||||
/// ```python
|
||||
/// if x = 1 or x = 2
|
||||
/// if x = 1 or x = 2:
|
||||
/// print("Hello")
|
||||
/// ```
|
||||
pub struct IfWithSameArms;
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
# combine-if-conditions (SIM114)
|
||||
|
||||
Derived from the **flake8-simplify** linter.
|
||||
|
||||
### What it does
|
||||
Checks if consecutive `if` branches have the same body.
|
||||
|
||||
### Why is this bad?
|
||||
These branches can be combine using the python `or` statement
|
||||
|
||||
### Example
|
||||
```python
|
||||
if x = 1:
|
||||
print("Hello")
|
||||
elif x = 2:
|
||||
print("Hello")
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```python
|
||||
if x = 1 or x = 2
|
||||
print("Hello")
|
||||
```
|
||||
|
|
@ -19,6 +19,6 @@ elif x = 2:
|
|||
|
||||
Use instead:
|
||||
```python
|
||||
if x = 1 or x = 2
|
||||
if x = 1 or x = 2:
|
||||
print("Hello")
|
||||
```
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue