mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-10 11:33:30 +02:00
Clean up and unify exercises
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
// lifetimes3.rs
|
||||
//
|
||||
// Lifetimes are also needed when structs hold references.
|
||||
//
|
||||
// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
struct Book {
|
||||
author: &str,
|
||||
@@ -13,7 +8,10 @@ struct Book {
|
||||
fn main() {
|
||||
let name = String::from("Jill Smith");
|
||||
let title = String::from("Fish Flying");
|
||||
let book = Book { author: &name, title: &title };
|
||||
let book = Book {
|
||||
author: &name,
|
||||
title: &title,
|
||||
};
|
||||
|
||||
println!("{} by {}", book.title, book.author);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user