From 35caf14f306cd361db4d61761991e69dc597a448 Mon Sep 17 00:00:00 2001 From: dcodes <101001810+dcodesdev@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:24:30 +0300 Subject: [PATCH] Fix: Long comments caused a UI bug (#64) --- challenges/ownership/description.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/challenges/ownership/description.md b/challenges/ownership/description.md index 6dc1cfe..2ad8e9d 100644 --- a/challenges/ownership/description.md +++ b/challenges/ownership/description.md @@ -12,7 +12,8 @@ In Rust, each value has a variable that's called its **owner**. There can only b ```rust { - let s = String::from("hello"); // s is the owner of the String + // s is the owner of the String + let s = String::from("hello"); } // s goes out of scope and "hello" is dropped ``` @@ -30,11 +31,13 @@ You can create multiple **immutable references** to a value, but you cannot have fn main() { let s1 = String::from("hello"); - let len = calculate_length(&s1); // borrow s1 as immutable + // Borrow s1 as immutable + let len = calculate_length(&s1); println!("The length of '{}' is {}.", s1, len); } -fn calculate_length(s: &String) -> usize { // s is an immutable reference to a String +// s is an immutable reference to a String +fn calculate_length(s: &String) -> usize { s.len() } ```