Skip to content

c-cpp-book: ch12-closures partition solution doesn't compile #97

@DaividFrank

Description

@DaividFrank

When running the code in the provided solution here

You get the following error:

   Compiling playground v0.0.1 (/playground)
error[E0369]: cannot calculate the remainder of `&&{integer}` divided by `{integer}`
  --> src/main.rs:20:26
   |
20 |         .partition(|n| n % 2 == 0);
   |                        - ^ - {integer}
   |                        |
   |                        &&{integer}
   |
help: `%` can be used on `&{integer}` if you dereference the left-hand side
   |
20 |         .partition(|n| *n % 2 == 0);
   |                        +

For more information about this error, try `rustc --explain E0369`.
error: could not compile `playground` (bin "playground") due to 1 previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions