| commit | c86633d53c1150048cbcb2605403ffb227c853b4 | [log] [tgz] |
|---|---|---|
| author | David Tolnay <dtolnay@gmail.com> | Sat Oct 03 23:48:06 2020 -0700 |
| committer | David Tolnay <dtolnay@gmail.com> | Sat Oct 03 23:48:58 2020 -0700 |
| tree | a35e8a648ea2f213e4701550025af8928806ff63 | |
| parent | 762f0419749520a363c5c266923529d507d9f8b3 [diff] [blame] |
Generalize OrderedSet::contains method
diff --git a/syntax/set.rs b/syntax/set.rs index b553169..891df60 100644 --- a/syntax/set.rs +++ b/syntax/set.rs
@@ -1,3 +1,4 @@ +use std::borrow::Borrow; use std::collections::HashSet; use std::fmt::{self, Debug}; use std::hash::Hash; @@ -27,7 +28,11 @@ new } - pub fn contains(&self, value: &T) -> bool { + pub fn contains<Q>(&self, value: &Q) -> bool + where + &'a T: Borrow<Q>, + Q: ?Sized + Hash + Eq, + { self.set.contains(value) } }