From 749d197119085abd9b9e43a24776171468f25fce Mon Sep 17 00:00:00 2001 From: Florian Best Date: Mon, 13 Feb 2023 00:35:29 +0100 Subject: [PATCH] docs(SIM114): fix typo in python code (#2833) --- .../src/rules/flake8_simplify/rules/ast_if.rs | 2 +- docs/rules/combine-if-conditions.md | 23 ------------------- docs/rules/if-with-same-arms.md | 4 ++-- 3 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 docs/rules/combine-if-conditions.md diff --git a/crates/ruff/src/rules/flake8_simplify/rules/ast_if.rs b/crates/ruff/src/rules/flake8_simplify/rules/ast_if.rs index 9f682c3c65..e1a9d2b6b1 100644 --- a/crates/ruff/src/rules/flake8_simplify/rules/ast_if.rs +++ b/crates/ruff/src/rules/flake8_simplify/rules/ast_if.rs @@ -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; diff --git a/docs/rules/combine-if-conditions.md b/docs/rules/combine-if-conditions.md deleted file mode 100644 index f3805a7f0b..0000000000 --- a/docs/rules/combine-if-conditions.md +++ /dev/null @@ -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") -``` \ No newline at end of file diff --git a/docs/rules/if-with-same-arms.md b/docs/rules/if-with-same-arms.md index 10a62afdc4..dc8ad20380 100644 --- a/docs/rules/if-with-same-arms.md +++ b/docs/rules/if-with-same-arms.md @@ -19,6 +19,6 @@ elif x = 2: Use instead: ```python -if x = 1 or x = 2 +if x = 1 or x = 2: print("Hello") -``` \ No newline at end of file +```