kyclark / command-line-rust

Code for Command-Line Rust (O'Reilly, 2022, ISBN 9781098109417) https://learning.oreilly.com/library/view/command-line-rust/9781098109424/
MIT License
1.48k stars 243 forks source link

Chapter 13 solution no longer working #18

Closed kennethlove closed 7 months ago

kennethlove commented 7 months ago

https://github.com/kyclark/command-line-rust/blob/e977e5b1412bb3cd20737465d61f0baca05536d3/13_calr/src/lib.rs#L98

This line currently fails with an error message like:

error[E0277]: `&()` is not an iterator
   --> src/lib.rs:100:40
    |
100 |                     for lines in izip!(m1, m2, m3) {
    |                                  ------^^---------
    |                                  |     |
    |                                  |     `&()` is not an iterator
    |                                  required by a bound introduced by this call
    |
    = help: the trait `Iterator` is not implemented for `&()`
    = note: required for `&()` to implement `IntoIterator`
atc0005 commented 7 months ago

@kennethlove FWIW, this is what I get from running cargo run to build 13_calr (commit e977e5b1412bb3cd20737465d61f0baca05536d3) using Rust 1.74.1:

$ cargo run
warning: use of deprecated associated function `chrono::Local::today`: use `Local::now()` instead
  --> src\lib.rs:64:24
   |
64 |     let today = Local::today();
   |                        ^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead
   --> src\lib.rs:176:16
    |
176 |     NaiveDate::from_ymd(y, m, 1).pred()
    |                ^^^^^^^^

warning: use of deprecated method `chrono::NaiveDate::pred`: use `pred_opt()` instead
   --> src\lib.rs:176:34
    |
176 |     NaiveDate::from_ymd(y, m, 1).pred()
    |                                  ^^^^

warning: use of deprecated associated function `chrono::NaiveDate::from_ymd`: use `from_ymd_opt()` instead
   --> src\lib.rs:186:28
    |
186 |     let first = NaiveDate::from_ymd(year, month, 1);
    |                            ^^^^^^^^

warning: `calr` (lib) generated 4 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target\debug\calr.exe`
   February 2024
Su Mo Tu We Th Fr Sa
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29

It doesn't show well here, but the 6 has an inverted terminal foreground/background color to highlight it.

kennethlove commented 7 months ago

Yeah, ignore me :D A stray semicolon.