Skip to content

Commit

Permalink
Fix: Long comments caused a UI bug (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodesdev authored Dec 9, 2024
1 parent 5aa1958 commit 35caf14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions challenges/ownership/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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()
}
```
Expand Down

0 comments on commit 35caf14

Please sign in to comment.