aboutsummaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-05 10:09:38 +0100
committerGitHub <[email protected]>2019-10-05 10:09:38 +0100
commitdbf869b4d2dac09df17609edf6e67c1611b71dc5 (patch)
tree8ca4f0a4865acc8b67798951e3a5c76cb5a6956c /docs/user
parentcce32719cf140550350c84aa7f006080615a31d6 (diff)
parente06ad80d49f63c0c18a6447f39415a9ce900d9fa (diff)
Merge #1952
1952: Create an assist for applying De Morgan's Law r=matklad a=cronokirby Fixes #1807 This assist can transform expressions of the form `!x || !y` into `!(x && y)`. This also works with `&&`. This assist will only trigger if the cursor is on the central logical operator. The main limitation of this current implementation is that both operands need to be an explicit negation, either of the form `!x`, or `x != y`. More operands could be accepted, but this would complicate the implementation quite a bit. Co-authored-by: Lúcás Meier <[email protected]>
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/features.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/user/features.md b/docs/user/features.md
index eb81cba26..0ce8f577b 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -166,6 +166,20 @@ impl Foo for S {
166} 166}
167``` 167```
168 168
169- Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws)
170
171```rust
172// before:
173fn example(x: bool) -> bool {
174 !x || !x
175}
176
177// after:
178fn example(x: bool) -> bool {
179 !(x && x)
180}
181```
182
169- Import path 183- Import path
170 184
171```rust 185```rust