2 ms·
Rust has a cool feature where all examples in doc comments are automatically run as part of running the tests of the package (`cargo test`). So when your CI is
by Arnavion 8y ago
Rust has a cool feature where all examples in doc comments are automatically run as part of running the tests of the package (`cargo test`). So when your CI is running tests it's also testing your examples.
There's even some built-in magic to make it nicer. Like if the example needs some code to compile but which would otherwise distract from the point of the example, that code can be prefixed with # and will be hidden in the generated docs.