1
0
Fork 0
forked from wry/wry

autocommit 2022-03-29 15:40:59 CEST

This commit is contained in:
Julian Orth 2022-03-29 15:40:59 +02:00
parent 6ebf731aea
commit 9842264fad
39 changed files with 121 additions and 92 deletions

View file

@ -65,7 +65,7 @@ impl OutBufferSwapchain {
pub fn commit(&mut self) {
if self.cur.write_pos > 0 {
let new = self.free.pop().unwrap_or_else(|| Default::default());
let new = self.free.pop().unwrap_or_default();
let old = mem::replace(&mut self.cur, new);
self.pending.push_back(old);
}

View file

@ -224,7 +224,7 @@ impl<T> NodeRef<T> {
{
unsafe {
let data = self.data.as_ref();
let other = peer(&data).get();
let other = peer(data).get();
if other.as_ref().data.is_some() {
other.as_ref().rc.fetch_add(1);
Some(NodeRef { data: other })

View file

@ -5,7 +5,7 @@ use uapi::c::c_int;
use uapi::{c, Errno};
static ERRORS: Lazy<&'static [Option<&'static str>]> = Lazy::new(|| {
static MSGS: &'static [(c::c_int, &'static str)] = &[
static MSGS: &[(c::c_int, &str)] = &[
(c::EWOULDBLOCK, "Operation would block"),
(c::ENOTSUP, "Not supported"),
(c::EHWPOISON, "Memory page has hardware error"),

5
src/utils/rc_eq.rs Normal file
View file

@ -0,0 +1,5 @@
use std::rc::Rc;
pub fn rc_eq<T: ?Sized>(a: &Rc<T>, b: &Rc<T>) -> bool {
Rc::as_ptr(a) as *const u8 == Rc::as_ptr(b) as *const u8
}