summaryrefslogtreecommitdiff
path: root/rustlings/exercises/06_move_semantics/move_semantics5.rs
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-09-18 16:41:38 -0500
committerHunter Kvalevog <hunter@kvog.sh>2026-09-18 16:41:38 -0500
commit867bf72e8a144fb66f8eecc1f1cd948bf874fa64 (patch)
treed6a3187503288ba315d38c5693edba221f037cfd /rustlings/exercises/06_move_semantics/move_semantics5.rs
parent177787395f4179e8510adfba52e211b151774372 (diff)
rustlings: complete 06
Diffstat (limited to 'rustlings/exercises/06_move_semantics/move_semantics5.rs')
-rw-r--r--rustlings/exercises/06_move_semantics/move_semantics5.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/rustlings/exercises/06_move_semantics/move_semantics5.rs b/rustlings/exercises/06_move_semantics/move_semantics5.rs
index cd0dafd..78d8c77 100644
--- a/rustlings/exercises/06_move_semantics/move_semantics5.rs
+++ b/rustlings/exercises/06_move_semantics/move_semantics5.rs
@@ -4,12 +4,12 @@
// removing references (the character `&`).
// Shouldn't take ownership
-fn get_char(data: String) -> char {
+fn get_char(data: &String) -> char {
data.chars().last().unwrap()
}
// Should take ownership
-fn string_uppercase(mut data: &String) {
+fn string_uppercase(mut data: String) {
data = data.to_uppercase();
println!("{data}");
@@ -18,7 +18,7 @@ fn string_uppercase(mut data: &String) {
fn main() {
let data = "Rust is great!".to_string();
- get_char(data);
+ get_char(&data);
- string_uppercase(&data);
+ string_uppercase(data);
}