From 60a6f9e836ffe4631956735751a060e4d6583f7d Mon Sep 17 00:00:00 2001 From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:31:22 +0200 Subject: [PATCH] Fix code examples --- .../newtype-pattern/semantic-confusion.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md b/src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md index 428525fb..9c66acba 100644 --- a/src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md +++ b/src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md @@ -23,7 +23,7 @@ login(password, username); The newtype pattern can prevent this class of errors at compile time: -```rust +```rust,compile_fail pub struct Username(String); pub struct Password(String); # struct LoginError; @@ -52,9 +52,9 @@ login(password, username); // 🛠️❌ is of paramount importance, consider using a struct with named fields as input: ```rust - pub struct LoginArguments { - pub username: &str, - pub password: &str, + pub struct LoginArguments<'a> { + pub username: &'a str, + pub password: &'a str, } # fn login(i: LoginArguments) {} # let password = "password";