summaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-07-10 13:47:33 +0200
committermo8it <mo8it@proton.me>2024-07-10 13:47:33 +0200
commit59d6b852afd81385020f2b59ab95c85af6229763 (patch)
tree5fe5404405b245706c1850e906c1ac8a6b7d2c79 /exercises
parente512928df57d84bd09a1d630fdafa68a1eef928d (diff)
move_semantics5: Move `main` to the end
Diffstat (limited to 'exercises')
-rw-r--r--exercises/06_move_semantics/move_semantics5.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/exercises/06_move_semantics/move_semantics5.rs b/exercises/06_move_semantics/move_semantics5.rs
index fc59338..cd0dafd 100644
--- a/exercises/06_move_semantics/move_semantics5.rs
+++ b/exercises/06_move_semantics/move_semantics5.rs
@@ -3,14 +3,6 @@
// TODO: Fix the compiler errors without changing anything except adding or
// removing references (the character `&`).
-fn main() {
- let data = "Rust is great!".to_string();
-
- get_char(data);
-
- string_uppercase(&data);
-}
-
// Shouldn't take ownership
fn get_char(data: String) -> char {
data.chars().last().unwrap()
@@ -22,3 +14,11 @@ fn string_uppercase(mut data: &String) {
println!("{data}");
}
+
+fn main() {
+ let data = "Rust is great!".to_string();
+
+ get_char(data);
+
+ string_uppercase(&data);
+}