Variations in rust code.Is it OS or --version(s)?

Ryan Levick tutorial vids. Lovin' em. Ryans on Windows machine with 'VM' into Ubuntu. I'm on GhostBSD,latest version. rustc 1.55.0. cargo 1.55.0. I'm struggling to figure this out. Rust compiler not happy. Line 14 reads as it should but doesn't jive here. That's the one and only 'error' compiler pointing out. I've been editting this for a while now only creating more errors.
Also,notice lines 4,5,6. No ':''s. That differs,too, If i put those into line(s),more errors.
Disregard line 3. main.rs reads as such;

mod print;

fn main() {
   print::run();
}

This works. Have already printed some output to 'pp.db' using this set up. hello world to be exact. Any ideas as to how i can get line 14 in compliance? i just keep buggering up the code.


In line 14, : Error is a hind from IDE, not the real code. Drop it, and all should be fine.

3 Likes

To expand on @Cerber-Ursi's comment, those greyed out type annotations after let mut arguments (line 4), let key (line 5), and Err(err: Error) (line 14) are actually not part of his code.

If the rust-analyzer plugin can infer the type of a variable it'll automatically draw type annotations, and in this case the err variable has type Error.

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.