chiark
/
gitweb
/
~ian
/
hippotat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7acb178
)
reporter: introduce TooManyWarnings
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 15 Aug 2021 23:57:23 +0000
(
00:57
+0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 15 Aug 2021 23:57:23 +0000
(
00:57
+0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/reporter.rs
patch
|
blob
|
history
diff --git
a/src/reporter.rs
b/src/reporter.rs
index 4f72c355bdfb86ea6cb7dcd6f39fa7f721a65527..6f4fb0d4cb17f073391dc171aea8d7e4520b015e 100644
(file)
--- a/
src/reporter.rs
+++ b/
src/reporter.rs
@@
-204,12
+204,14
@@
pub struct Warnings {
pub warnings: Vec<String>,
}
+#[derive(Debug,Error)]
+#[error("too many warnings")]
+pub struct TooManyWarnings;
+
impl Warnings {
- #[throws(
AE
)]
+ #[throws(
TooManyWarnings
)]
pub fn add(&mut self, e: &dyn Display) {
- if self.warnings.len() >= MAX_WARNINGS {
- throw!(anyhow!("too many warnings"))
- }
+ if self.warnings.len() >= MAX_WARNINGS { throw!(TooManyWarnings) }
self.warnings.push(e.to_string());
}
}