Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's easy to forget to mount a mock to a server, even though the docs call this out. This commit tags the `Mock` struct with [`#[must_use]`][reference], so that Rust itself can warn users when they forget to mount their mocks. The help string Here's the warning emitted: ``` warning: unused `Mock` that must be used --> examples\must_use.rs:9:5 | 9 | Mock::given(method("GET")).respond_with(response.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `Mock`s have to be mounted or registered with a `MockServer` to become effective = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 9 | let _ = Mock::given(method("GET")).respond_with(response.clone()); | +++++++ ``` [reference]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
- Loading branch information