Skip to content
Myr

Improve rendering of inline code in macros documentation

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 8ce4560 · Browse files · 1 file+6 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−5 removed

  • other:+6 added−5 removed

1 file+6 added−5 removed

modified:src/macros.rs+6 added-5 removed
1/// Return early with an error.2///3/// This macro is equivalent to `return Err(`[`anyhow!($args...)`][anyhow!]`)`.3/// This macro is equivalent to4/// <code>return Err([anyhow!($args\...)][anyhow!])</code>.5///6/// The surrounding function's or closure's return value is required to be6/// `Result<_,`[`anyhow::Error`][crate::Error]`>`.7/// <code>Result&lt;_, [anyhow::Error][crate::Error]&gt;</code>.8///9/// [anyhow!]: crate::anyhow10///11/// # Example
57 unmodified lines
69macro_rules! __ensure {70 ($ensure:item) => {71 /// Return early with an error if a condition is not satisfied.72 ///72 /// This macro is equivalent to `if !$cond { return73 /// Err(`[`anyhow!($args...)`][anyhow!]`); }`.73 /// This macro is equivalent to74 /// <code>if !$cond { return Err([anyhow!($args\...)][anyhow!]); }</code>.75 ///76 /// The surrounding function's or closure's return value is required to be76 /// `Result<_,`[`anyhow::Error`][crate::Error]`>`.77 /// <code>Result&lt;_, [anyhow::Error][crate::Error]&gt;</code>.78 ///79 /// Analogously to `assert!`, `ensure!` takes a condition and exits the function80 /// if the condition fails. Unlike `assert!`, `ensure!` returns an `Error`81 /// rather than panicking.
161 unmodified lines