From fe8ec1c045af7a41492d0df6d271f1ce56afb51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=BAc=C3=A1s=20Meier?= Date: Fri, 4 Oct 2019 11:03:35 +0200 Subject: [#1807] Add entry in docs/user/features --- docs/user/features.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs') diff --git a/docs/user/features.md b/docs/user/features.md index eb81cba26..f89d8c489 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -166,6 +166,20 @@ impl Foo for S { } ``` +- Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws) + +```rust +// before: +fn example(x: bool) -> bool { + !x || !x +} + +// after: +fn example(x: bool) -> bool { + !(x && !x) +} +``` + - Import path ```rust -- cgit v1.2.3 From e06ad80d49f63c0c18a6447f39415a9ce900d9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=BAc=C3=A1s=20Meier?= Date: Fri, 4 Oct 2019 12:45:22 +0200 Subject: Fix typo about De Morgan's law assist --- docs/user/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/user/features.md b/docs/user/features.md index f89d8c489..0ce8f577b 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -176,7 +176,7 @@ fn example(x: bool) -> bool { // after: fn example(x: bool) -> bool { - !(x && !x) + !(x && x) } ``` -- cgit v1.2.3