diff --git a/.clippy.toml b/.clippy.toml index 492e05c..7846a3e 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.34" +msrv = "1.47" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2f9368..3981185 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: matrix: # When updating this, the reminder to update the minimum supported # Rust version in Cargo.toml and .clippy.toml. - rust: ['1.34'] + rust: ['1.47'] steps: - uses: actions/checkout@v3 - name: Install Rust diff --git a/Cargo.toml b/Cargo.toml index 4621f01..0e1eb68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ name = "polling" version = "2.3.0" authors = ["Stjepan Glavina "] edition = "2018" -rust-version = "1.34" +rust-version = "1.47" description = "Portable interface to epoll, kqueue, event ports, and wepoll" license = "Apache-2.0 OR MIT" repository = "https://github.com/smol-rs/polling" diff --git a/src/epoll.rs b/src/epoll.rs index 8465131..59b7fc3 100644 --- a/src/epoll.rs +++ b/src/epoll.rs @@ -279,7 +279,7 @@ fn write_flags() -> libc::c_int { /// A list of reported I/O events. pub struct Events { - list: Box<[libc::epoll_event]>, + list: Box<[libc::epoll_event; 1024]>, len: usize, } @@ -289,7 +289,7 @@ impl Events { /// Creates an empty list. pub fn new() -> Events { let ev = libc::epoll_event { events: 0, u64: 0 }; - let list = vec![ev; 1000].into_boxed_slice(); + let list = Box::new([ev; 1024]); let len = 0; Events { list, len } } diff --git a/src/kqueue.rs b/src/kqueue.rs index d6c3d89..3536b53 100644 --- a/src/kqueue.rs +++ b/src/kqueue.rs @@ -204,7 +204,7 @@ impl Drop for Poller { /// A list of reported I/O events. pub struct Events { - list: Box<[libc::kevent]>, + list: Box<[libc::kevent; 1024]>, len: usize, } @@ -221,7 +221,7 @@ impl Events { data: 0, udata: 0 as _, }; - let list = vec![ev; 1000].into_boxed_slice(); + let list = Box::new([ev; 1024]); let len = 0; Events { list, len } } diff --git a/src/port.rs b/src/port.rs index a759768..cecabdc 100644 --- a/src/port.rs +++ b/src/port.rs @@ -179,7 +179,7 @@ fn write_flags() -> libc::c_short { /// A list of reported I/O events. pub struct Events { - list: Box<[libc::port_event]>, + list: Box<[libc::port_event; 1024]>, len: usize, } @@ -195,7 +195,7 @@ impl Events { portev_object: 0, portev_user: 0 as _, }; - let list = vec![ev; 1000].into_boxed_slice(); + let list = Box::new([ev; 1024]); let len = 0; Events { list, len } } diff --git a/src/wepoll.rs b/src/wepoll.rs index 998f726..5b1ba75 100644 --- a/src/wepoll.rs +++ b/src/wepoll.rs @@ -200,7 +200,7 @@ const WRITE_FLAGS: u32 = we::EPOLLOUT | we::EPOLLHUP | we::EPOLLERR; /// A list of reported I/O events. pub struct Events { - list: Box<[we::epoll_event]>, + list: Box<[we::epoll_event; 1024]>, len: usize, } @@ -213,10 +213,8 @@ impl Events { events: 0, data: we::epoll_data { u64_: 0 }, }; - Events { - list: vec![ev; 1000].into_boxed_slice(), - len: 0, - } + let list = Box::new([ev; 1024]); + Events { list, len: 0 } } /// Iterates over I/O events.