Skip to content

Commit

Permalink
Make other_buffer_safely more Rust-style
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-frankau committed Jul 14, 2019
1 parent c92152b commit a5aee9c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rust_src/src/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1915,13 +1915,13 @@ pub fn other_buffer(
// visibility of buffers, and doesn't evaluate any frame predicates.
#[no_mangle]
pub extern "C" fn other_buffer_safely(buffer: LispObject) -> LispObject {
for buf in LiveBufferIter::new().map(|x| x.into()) {
if candidate_buffer(buf, buffer) {
return buf;
}
let found = LiveBufferIter::new()
.map(|x| x.into())
.find(|buf| candidate_buffer(*buf, buffer));
match found {
Some(buf) => buf,
None => get_scratch_buf(),
}

get_scratch_buf()
}

include!(concat!(env!("OUT_DIR"), "/buffers_exports.rs"));

0 comments on commit a5aee9c

Please sign in to comment.