From fb57f21ec115953dce7a5ad6b358feed394a470f Mon Sep 17 00:00:00 2001 From: Jaxel Rojas Date: Wed, 10 Mar 2021 08:40:13 -0400 Subject: [PATCH] Fix syntax error on code snippet (#246) * Fix syntax error on code snippet * Added comma to struct definition on code snippet * cargo fmt, remove ignore flag Co-authored-by: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com> --- anti_patterns/deref.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/anti_patterns/deref.md b/anti_patterns/deref.md index 3c5d8a7f..c6c65426 100644 --- a/anti_patterns/deref.md +++ b/anti_patterns/deref.md @@ -25,7 +25,7 @@ public static void main(String[] args) { We can use the deref polymorphism anti-pattern to do so: -```rust,ignore +```rust use std::ops::Deref; struct Foo {} @@ -34,11 +34,10 @@ impl Foo { fn m(&self) { //.. } - } struct Bar { - f: Foo + f: Foo, } impl Deref for Bar { @@ -49,7 +48,7 @@ impl Deref for Bar { } fn main() { - let b = Bar { Foo {} }; + let b = Bar { f: Foo {} }; b.m(); } ```