| commit | ab91445c1dcc617219f130e60da480ea4f015ba2 | [log] [tgz] |
|---|---|---|
| author | David Tolnay <dtolnay@gmail.com> | Mon May 04 00:21:37 2020 -0700 |
| committer | David Tolnay <dtolnay@gmail.com> | Mon May 04 00:31:28 2020 -0700 |
| tree | b32ac17f3c6d00ba0e8ddb8fe2a7b24673f72261 | |
| parent | 96a826b8f09f4064642aaca2d125a9d2e4554267 [diff] [blame] |
Check type name duplication more compactly
diff --git a/syntax/set.rs b/syntax/set.rs index ca816cf..688d1c0 100644 --- a/syntax/set.rs +++ b/syntax/set.rs
@@ -18,10 +18,12 @@ } } - pub fn insert(&mut self, value: &'a T) { - if self.set.insert(value) { + pub fn insert(&mut self, value: &'a T) -> bool { + let new = self.set.insert(value); + if new { self.vec.push(value); } + new } pub fn contains(&self, value: &T) -> bool {