Skip to content

Missing information about installation in a documentation page #417

@Xuanmizhen

Description

@Xuanmizhen

I'm a beginner. I got confused when try to run the code in this page:
https://docs.rs/linfa-linear/latest/linfa_linear/struct.LinearRegression.html
After adding need crates (linfa, linfa-datasets, and linfa-linear), I compiled the code, and I got this:

 % cargo build
   Compiling rsml v0.1.0 (/Users/myname/my/path/rsml)
error[E0425]: cannot find function `diabetes` in crate `linfa_datasets`
 --> src/main.rs:6:35
  |
6 |     let dataset = linfa_datasets::diabetes();
  |                                   ^^^^^^^^ not found in `linfa_datasets`

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

I hoped that the Rust compiler would give me some help if the path to the function diabetes was wrong. However, it didn't. After checking the source code, I found that the function is actually under a feature! I did this:

 % cargo add linfa-datasets --features diabetes

And then the code compiled and worked properly. I hope that this information (the feature diabetes in linfa-datasets) should be given explicitly in the document (mentioned above: https://docs.rs/linfa-linear/latest/linfa_linear/struct.LinearRegression.html).

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