Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e5b3cb5
Check empty SIMD vector in inline asm
Jan 9, 2025
339616b
compiletest: implement `needs-subprocess` directive
jieyouxu Jan 23, 2025
669f4bc
rustc-dev-guide: document `needs-subprocess` directive
jieyouxu Jan 23, 2025
eee72ba
tests: adjust `tests/ui/issues/issue-39175.rs`
jieyouxu Jan 23, 2025
c7f9c30
tests: move `tests/ui/issues/issue-39175.rs` under `suggestions/` and…
jieyouxu Jan 23, 2025
5f63f2d
tests: slightly cleanup `tests/ui/command/command-pre-exec.rs`
jieyouxu Jan 23, 2025
f9addad
tests: cleanup `tests/ui/command/command-argv0.rs`
jieyouxu Jan 23, 2025
bfc553e
tests: cleanup `tests/ui/command/command-exec.rs`
jieyouxu Jan 23, 2025
2632fdc
tests: cleanup `tests/ui/process/core-run-destroy.rs`
jieyouxu Jan 23, 2025
8322609
tests: cleanup `tests/ui/process/signal-exit-status.rs`
jieyouxu Jan 23, 2025
02c003b
tests: cleanup `tests/ui/process/issue-20091.rs`
jieyouxu Jan 23, 2025
635a06b
tests: cleanup `tests/ui/process/process-exit.rs`
jieyouxu Jan 23, 2025
a4a3aca
tests: cleanup `tests/ui/process/fds-are-cloexec.rs`
jieyouxu Jan 23, 2025
b617aae
tests: cleanup `tests/ui/process/process-panic-after-fork.rs`
jieyouxu Jan 23, 2025
c7c1e4d
tests: cleanup `tests/ui/process/issue-14456.rs`
jieyouxu Jan 23, 2025
7eaa6ec
tests: cleanup `tests/ui/process/try-wait.rs`
jieyouxu Jan 23, 2025
0cc392e
tests: cleanup `tests/ui/process/sigpipe-should-be-ignored.rs`
jieyouxu Jan 23, 2025
a5d72f4
tests: cleanup `tests/ui/panic-runtime/lto-unwind.rs`
jieyouxu Jan 23, 2025
bb36a40
tests: cleanup `tests/ui/panic-runtime/abort.rs`
jieyouxu Jan 23, 2025
1abb936
tests: cleanup `tests/ui/process/issue-13304.rs`
jieyouxu Jan 23, 2025
91bd545
tests: cleanup `tests/ui/panic-runtime/lto-abort.rs`
jieyouxu Jan 23, 2025
5c1e2ec
tests: cleanup `tests/ui/panic-runtime/abort-link-to-unwinding-crates…
jieyouxu Jan 23, 2025
4b743a7
tests: cleanup `tests/ui/command/command-setgroups.rs`
jieyouxu Jan 23, 2025
e00e10c
tests: cleanup `tests/ui/std/thread-sleep-ms.rs`
jieyouxu Jan 23, 2025
a11227b
tests: update `tests/ui/issues/issue-2190-1.rs`
jieyouxu Jan 23, 2025
8a0310a
tests: use `needs-subprocess` instead of `ignore-{wasm32,emscripten,s…
jieyouxu Jan 23, 2025
071ad37
tests: use `needs-threads` instead of `ignore-emscripten`
jieyouxu Jan 23, 2025
b2ad126
Make `Vec::pop_if` a bit more presentable
GrigorenkoPV Jan 23, 2025
56c9267
allow different sized load and store
mustartt Jan 24, 2025
8a6e06f
Exclude `mir::coverage` types from TypeFoldable/TypeVisitable
Zalathar Jan 22, 2025
ec6fc95
coverage: Remove some dead code from MC/DC branch mapping conversion
Zalathar Jan 21, 2025
ff48331
coverage: Make query `coverage_ids_info` return an Option
Zalathar Jan 22, 2025
52c1bfa
coverage: Simplify how counter terms are stored
Zalathar Jan 21, 2025
4b20a27
coverage: Replace `FrozenUnionFind` with a plain IndexVec
Zalathar Jan 20, 2025
2bdc67a
coverage: Treat the "merged node flow graph" as a plain data struct
Zalathar Jan 21, 2025
7f10ab2
coverage: Tweak FileCheck directives in a mir-opt test
Zalathar Jan 22, 2025
5122c06
Refactor Python linting and formatting in tidy
Kobzol Jan 23, 2025
cd7be92
Document Python formatting and linting in the rustc-dev-guide
Kobzol Jan 23, 2025
9a85104
Make virtualenv creation in tidy more robust
Kobzol Jan 23, 2025
0f334ec
Update Python 3 versions in tidy
Kobzol Jan 23, 2025
3c3961b
Doc difference between extend and extend_from_slice
hkBst Jan 24, 2025
7778aca
Rollup merge of #135295 - eyraudh:master, r=compiler-errors
matthiaskrgr Jan 24, 2025
e53ea39
Rollup merge of #135873 - Zalathar:be-prepared, r=oli-obk
matthiaskrgr Jan 24, 2025
8c7a2b0
Rollup merge of #135926 - jieyouxu:needs-subprocess-thread, r=oli-obk
matthiaskrgr Jan 24, 2025
6f8f35a
Rollup merge of #135950 - Kobzol:tidy-python-improvements, r=onur-ozkan
matthiaskrgr Jan 24, 2025
85b1d54
Rollup merge of #135956 - GrigorenkoPV:vec_pop_off, r=dtolnay
matthiaskrgr Jan 24, 2025
9b3d602
Rollup merge of #135966 - mustartt:fix-ppc-abi-test, r=workingjubilee
matthiaskrgr Jan 24, 2025
b511c13
Rollup merge of #135983 - hkBst:patch-13, r=jhpratt
matthiaskrgr Jan 24, 2025
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
Prev Previous commit
Next Next commit
Make Vec::pop_if a bit more presentable
  • Loading branch information
GrigorenkoPV committed Jan 23, 2025
commit b2ad126a55b3c92a0e09d1749565376c3424ac01
11 changes: 4 additions & 7 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2511,9 +2511,9 @@ impl<T, A: Allocator> Vec<T, A> {
}
}

/// Removes and returns the last element in a vector if the predicate
/// Removes and returns the last element from a vector if the predicate
/// returns `true`, or [`None`] if the predicate returns false or the vector
/// is empty.
/// is empty (the predicate will not be called in that case).
///
/// # Examples
///
Expand All @@ -2528,12 +2528,9 @@ impl<T, A: Allocator> Vec<T, A> {
/// assert_eq!(vec.pop_if(pred), None);
/// ```
#[unstable(feature = "vec_pop_if", issue = "122741")]
pub fn pop_if<F>(&mut self, f: F) -> Option<T>
where
F: FnOnce(&mut T) -> bool,
{
pub fn pop_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T> {
let last = self.last_mut()?;
if f(last) { self.pop() } else { None }
if predicate(last) { self.pop() } else { None }
}

/// Moves all the elements of `other` into `self`, leaving `other` empty.
Expand Down
Loading