From 65ab75f7d9298bad26a301bc0828e3e33d50d187 Mon Sep 17 00:00:00 2001 From: Teddy Waweru <57697272+teddywaweru@users.noreply.github.com> Date: Fri, 27 Jan 2023 23:58:29 +0300 Subject: [PATCH] Update ownershp.md Added as_str() method to Q1, & removed answer that did not seem relevant to the question. --- solutions/ownership/ownership.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/solutions/ownership/ownership.md b/solutions/ownership/ownership.md index 3c3f06b..1237fc0 100644 --- a/solutions/ownership/ownership.md +++ b/solutions/ownership/ownership.md @@ -23,11 +23,10 @@ fn main() { println!("{},{}",x,y); } ``` - ```rust fn main() { - let x = 10; - let y = x; + let x = String::from("hello, world"); + let y = x.as_str(); println!("{},{}",x,y); } ```