mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-24 08:32:57 +02:00
Remove silenced warnings in book-library exercise (#388)
* Update book-library.md * Update book-library.rs * Apply suggestions from code review Expanding the variable makes it ever-so-slightly easier to read. --------- Co-authored-by: Martin Geisler <mgeisler@google.com>
This commit is contained in:
parent
1821a3fd12
commit
c22b35e426
@ -18,8 +18,6 @@ Use this to create a library application. Copy the code below to
|
||||
<https://play.rust-lang.org/> and update the types to make it compile:
|
||||
|
||||
```rust,should_panic
|
||||
// TODO: remove this when you're done with your implementation.
|
||||
#![allow(unused_variables, dead_code)]
|
||||
|
||||
{{#include book-library.rs:setup}}
|
||||
|
||||
|
@ -104,8 +104,10 @@ fn main() {
|
||||
let library = Library::new();
|
||||
|
||||
//println!("Our library is empty: {}", library.is_empty());
|
||||
//
|
||||
//library.add_book(Book::new("Lord of the Rings", 1954));
|
||||
|
||||
let favorite_book = Book::new("Lord of the Rings", 1954);
|
||||
println!("Our favorite book {favorite_book} should go in the library");
|
||||
//library.add_book(favorite_book);
|
||||
//library.add_book(Book::new("Alice's Adventures in Wonderland", 1865));
|
||||
//
|
||||
//library.print_books();
|
||||
@ -116,6 +118,9 @@ fn main() {
|
||||
//}
|
||||
//
|
||||
//println!("Our library has {} books", library.len());
|
||||
for book in library.books {
|
||||
println!("{book}");
|
||||
}
|
||||
}
|
||||
// ANCHOR_END: main
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user