docs(SIM114): fix typo in python code (#2833)

This commit is contained in:
Florian Best 2023-02-13 00:35:29 +01:00 committed by GitHub
parent 46c184600f
commit 749d197119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 26 deletions

View File

@ -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;

View File

@ -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")
```

View File

@ -19,6 +19,6 @@ elif x = 2:
Use instead:
```python
if x = 1 or x = 2
if x = 1 or x = 2:
print("Hello")
```
```