rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.75k stars 211 forks source link

"Chapter 4.6 Debugging" has some unclear explanations #255

Open MRGRAVITY817 opened 3 years ago

MRGRAVITY817 commented 3 years ago

Where in the docs did you come across this?

  1. In "Add logging to our game of life" section, there's no instruction which to put this code.
    
    #![allow(unused_variables)]
    fn main() {
    extern crate web_sys;

// A macro to provide println!(..)-style syntax for console.log logging. macro_rules! log { ( $( $t:tt ) ) => { web_sys::console::log_1(&format!( $( $t ) ).into()); } } }

2. And also this seems like a snippet from git history, which is uneasy to read.

diff --git a/src/lib.rs b/src/lib.rs index f757641..a30e107 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -123,6 +122,14 @@ impl Universe { let cell = self.cells[idx]; let live_neighbors = self.live_neighbor_count(row, col);



**How could we improve it?**