Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/rustc_data_structures/src/sso/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ impl<T: Eq + Hash> SsoHashSet<T> {

/// Adds a value to the set.
///
/// If the set did not have this value present, `true` is returned.
/// Returns whether the value was newly inserted. That is:
///
/// If the set did have this value present, `false` is returned.
/// - If the set did not previously contain this value, `true` is returned.
/// - If the set already contained this value, `false` is returned.
#[inline]
pub fn insert(&mut self, elem: T) -> bool {
self.map.insert(elem, ()).is_none()
Expand Down
10 changes: 7 additions & 3 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,14 @@ impl<T> BTreeSet<T> {

/// Adds a value to the set.
///
/// If the set did not have an equal element present, `true` is returned.
/// Returns whether the value was newly inserted. That is:
///
/// If the set did have an equal element present, `false` is returned, and
/// the entry is not updated. See the [module-level documentation] for more.
/// - If the set did not previously contain an equal value, `true` is
/// returned.
/// - If the set already contained an equal value, `false` is returned, and
/// the entry is not updated.
///
/// See the [module-level documentation] for more.
///
/// [module-level documentation]: index.html#insert-and-complex-keys
///
Expand Down
5 changes: 3 additions & 2 deletions library/std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,10 @@ where

/// Adds a value to the set.
///
/// If the set did not have this value present, `true` is returned.
/// Returns whether the value was newly inserted. That is:
///
/// If the set did have this value present, `false` is returned.
/// - If the set did not previously contain this value, `true` is returned.
/// - If the set already contained this value, `false` is returned.
///
/// # Examples
///
Expand Down