There is a good reason for that: cargo test checks doctests too. If the method will break, the doctest will panic and the build will break. This is like more unit tests. This also serves as a proof that the documentation is correct, AKA "if it compiles, it works".
Started out teaching English at Embry-Riddle.
Graded 10,000 essays.
Lesson learned.
Became a mathematics teacher.
Discovered computing.
Never looked back.
Location
Houston TX
Education
Stetson University: B.A., M.A. in English; M.S. in mathematics
Interesting. I've done something similar in a Ruby project (don't remember which one -- I'm 79), by having a Rake task that makes the doc by running examples, then including the code and output into the doc.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There is a good reason for that: cargo test checks doctests too. If the method will break, the doctest will panic and the build will break. This is like more unit tests. This also serves as a proof that the documentation is correct, AKA "if it compiles, it works".
Interesting. I've done something similar in a Ruby project (don't remember which one -- I'm 79), by having a Rake task that makes the doc by running examples, then including the code and output into the doc.