You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-16 22:27:34 +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:
@ -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:
|
<https://play.rust-lang.org/> and update the types to make it compile:
|
||||||
|
|
||||||
```rust,should_panic
|
```rust,should_panic
|
||||||
// TODO: remove this when you're done with your implementation.
|
|
||||||
#![allow(unused_variables, dead_code)]
|
|
||||||
|
|
||||||
{{#include book-library.rs:setup}}
|
{{#include book-library.rs:setup}}
|
||||||
|
|
||||||
|
@ -104,8 +104,10 @@ fn main() {
|
|||||||
let library = Library::new();
|
let library = Library::new();
|
||||||
|
|
||||||
//println!("Our library is empty: {}", library.is_empty());
|
//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.add_book(Book::new("Alice's Adventures in Wonderland", 1865));
|
||||||
//
|
//
|
||||||
//library.print_books();
|
//library.print_books();
|
||||||
@ -116,6 +118,9 @@ fn main() {
|
|||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//println!("Our library has {} books", library.len());
|
//println!("Our library has {} books", library.len());
|
||||||
|
for book in library.books {
|
||||||
|
println!("{book}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ANCHOR_END: main
|
// ANCHOR_END: main
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user