()
| 3 | fn modify_string(s: &mut String) {} |
| 4 | |
| 5 | fn borrowing() { |
| 6 | println!("Multiple borrows to an immutable string."); |
| 7 | { |
| 8 | let owned_string = String::from("Hello"); |
| 9 | |
| 10 | let borrow = &owned_string; |
| 11 | borrow_string(&owned_string); |
| 12 | borrow_string(borrow); |
| 13 | } |
| 14 | |
| 15 | let mut mutable_string = String::from("World"); |
| 16 | |
| 17 | if mutable_string.is_empty() { |
| 18 | mutable_string.push_str("Hello there."); |
| 19 | } else { |
| 20 | println!("The string is not empty."); |
| 21 | modify_string(&mut mutable_string); |
| 22 | } |
| 23 | |
| 24 | println!("'{}'", mutable_string); |
| 25 | } |
nothing calls this directly
no test coverage detected