1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-04 19:45:19 +02:00

Merge pull request #176 from google/testing

Fix Rustdoc comment.
This commit is contained in:
Martin Geisler 2023-01-17 17:32:39 +01:00 committed by GitHub
commit 0324cd2b27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
Rust has built-in support for documentation tests: Rust has built-in support for documentation tests:
```rust ```rust
/// Shorten string will trip the string to the given length. /// Shortens a string to the given length.
/// ///
/// ``` /// ```
/// use playground::shorten_string; /// use playground::shorten_string;
@ -17,4 +17,4 @@ pub fn shorten_string(s: &str, length: usize) -> &str {
* Code blocks in `///` comments are automatically seen as Rust code. * Code blocks in `///` comments are automatically seen as Rust code.
* The code will be compiled and executed as part of `cargo test`. * The code will be compiled and executed as part of `cargo test`.
* Test the above code on the [Rust Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c8ce535a3778218fed50c2b4c317d15d). * Test the above code on the [Rust Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0).