Skip to content

Commit f10ef49

Browse files
stepanchegfacebook-github-bot
authored andcommitted
set.pop without hashing
Reviewed By: perehonchuk Differential Revision: D63740501 fbshipit-source-id: 541404b87342f6452c025c27f5f164dc0da9dcc1
1 parent bfeebe5 commit f10ef49

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

starlark/src/values/types/set/methods.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,8 @@ pub(crate) fn set_methods(builder: &mut MethodsBuilder) {
291291
/// ```
292292
fn pop<'v>(this: Value<'v>) -> starlark::Result<Value<'v>> {
293293
let mut set = SetMut::from_value(this)?;
294-
let first = set.aref.iter_hashed().next();
295-
match first {
296-
Some(x) => {
297-
set.aref.remove_hashed(x.as_ref());
298-
Ok(x.into_key())
299-
}
294+
match set.aref.content.shift_remove_index(0) {
295+
Some(x) => Ok(x),
300296
None => Err(value_error!("pop from an empty set")),
301297
}
302298
}

0 commit comments

Comments
 (0)