Skip to content

Commit 6118228

Browse files
committed
Annotate Report and ReportBuilder with #[must_use]
This ensures that one doesn't forget to call `.finish()` or `.eprint()`
1 parent 7c988a6 commit 6118228

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ impl<S: Span> Label<S> {
169169
}
170170

171171
/// A type representing a diagnostic that is ready to be written to output.
172+
#[must_use = "call `.print()` or `.eprint()` to print the report"]
172173
pub struct Report<'a, S: Span = Range<usize>> {
173174
kind: ReportKind<'a>,
174175
code: Option<String>,
@@ -252,6 +253,7 @@ impl fmt::Display for ReportKind<'_> {
252253
}
253254

254255
/// A type used to build a [`Report`].
256+
#[must_use = "call `.finish()` to obtain a `Report`"]
255257
pub struct ReportBuilder<'a, S: Span> {
256258
kind: ReportKind<'a>,
257259
code: Option<String>,

0 commit comments

Comments
 (0)