diff options
Diffstat (limited to 'src/docs/branches_sharing_code.txt')
| -rw-r--r-- | src/docs/branches_sharing_code.txt | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/docs/branches_sharing_code.txt b/src/docs/branches_sharing_code.txt deleted file mode 100644 index 79be6124798..00000000000 --- a/src/docs/branches_sharing_code.txt +++ /dev/null @@ -1,32 +0,0 @@ -### What it does -Checks if the `if` and `else` block contain shared code that can be -moved out of the blocks. - -### Why is this bad? -Duplicate code is less maintainable. - -### Known problems -* The lint doesn't check if the moved expressions modify values that are being used in - the if condition. The suggestion can in that case modify the behavior of the program. - See [rust-clippy#7452](https://github.com/rust-lang/rust-clippy/issues/7452) - -### Example -``` -let foo = if … { - println!("Hello World"); - 13 -} else { - println!("Hello World"); - 42 -}; -``` - -Use instead: -``` -println!("Hello World"); -let foo = if … { - 13 -} else { - 42 -}; -``` \ No newline at end of file |
