1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-12-22 22:51:12 +02:00

Be more consistent about tests vs. main (#2644)

The content slides all use `fn main`, with the exception of the testing
segment. But with this change, where it makes sense exercises use tests
instead, and not both tests and `fn main`.

A small change in `book.js` supports running tests when a code sample
does not have `fn main` but does have `#[test]`, so these work
naturally.

Fixes #1581.
This commit is contained in:
Dustin J. Mitchell
2025-02-18 15:13:16 -05:00
committed by GitHub
parent 699c5137c7
commit 44a79741ff
38 changed files with 138 additions and 144 deletions

View File

@@ -7,7 +7,7 @@ minutes: 20
We will create a few utility functions for 3-dimensional geometry, representing
a point as `[f64;3]`. It is up to you to determine the function signatures.
```rust,compile_fail
```rust,compile_fail,editable
// Calculate the magnitude of a vector by summing the squares of its coordinates
// and taking the square root. Use the `sqrt()` method to calculate the square
// root, like `v.sqrt()`.