Auto merge of #138532 - matthiaskrgr:rollup-mgcynqu, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #138283 (Enforce type of const param correctly in MIR typeck) - #138439 (feat: check ARG_MAX on Unix platforms) - #138502 (resolve: Avoid some unstable iteration) - #138514 (Remove fake borrows of refs that are converted into non-refs in `MakeByMoveBody`) - #138524 (Mark myself as unavailable for reviews temporarily) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4d30011f6c
21 changed files with 394 additions and 49 deletions
|
@ -259,6 +259,12 @@ impl<V: Eq + Hash> UnordSet<V> {
|
|||
self.inner.is_empty()
|
||||
}
|
||||
|
||||
/// If the set has only one element, returns it, otherwise returns `None`.
|
||||
#[inline]
|
||||
pub fn get_only(&self) -> Option<&V> {
|
||||
if self.inner.len() == 1 { self.inner.iter().next() } else { None }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn insert(&mut self, v: V) -> bool {
|
||||
self.inner.insert(v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue