Skip to content

Commit 4771ab6

Browse files
committed
Switch then(|| foo) to then_some(foo)
1 parent 0aca6a8 commit 4771ab6

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

parser/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn check_lalrpop(source: &str, generated: &str) {
1818
.lines()
1919
.find_map(|line| {
2020
let line = line.unwrap();
21-
line.starts_with(sha_prefix).then(|| line)
21+
line.starts_with(sha_prefix).then_some(line)
2222
})
2323
.expect("no sha3 line?");
2424
let expected_sha3_str = sha3_line.strip_prefix(sha_prefix).unwrap();

stdlib/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ mod array {
12711271

12721272
fn try_resizable_opt(&'a self) -> Option<Self::Resizable> {
12731273
let w = self.write();
1274-
(self.exports.load(atomic::Ordering::SeqCst) == 0).then(|| w)
1274+
(self.exports.load(atomic::Ordering::SeqCst) == 0).then_some(w)
12751275
}
12761276
}
12771277

vm/src/builtins/bytearray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ impl<'a> BufferResizeGuard<'a> for PyByteArray {
762762

763763
fn try_resizable_opt(&'a self) -> Option<Self::Resizable> {
764764
let w = self.inner.write();
765-
(self.exports.load(Ordering::SeqCst) == 0).then(|| w)
765+
(self.exports.load(Ordering::SeqCst) == 0).then_some(w)
766766
}
767767
}
768768

vm/src/object/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl WeakRefList {
251251
})
252252
}
253253
inner.ref_count -= 1;
254-
(inner.ref_count == 0).then(|| ptr)
254+
(inner.ref_count == 0).then_some(ptr)
255255
};
256256
if let Some(ptr) = to_dealloc {
257257
unsafe { WeakRefList::dealloc(ptr) }

vm/src/stdlib/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3374,7 +3374,7 @@ mod _io {
33743374

33753375
fn try_resizable_opt(&'a self) -> Option<Self::Resizable> {
33763376
let w = self.buffer.write();
3377-
(self.exports.load() == 0).then(|| w)
3377+
(self.exports.load() == 0).then_some(w)
33783378
}
33793379
}
33803380

0 commit comments

Comments
 (0)