Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nightly clippy warning #185

Merged
merged 2 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions src/loop_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,21 @@ mod tests {
#[cfg(unix)]
#[test]
fn insert_bad_source() {
use std::os::unix::io::FromRawFd;
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsFd, FromRawFd, OwnedFd};

struct LeakedFd(ManuallyDrop<OwnedFd>);

impl AsFd for LeakedFd {
fn as_fd(&self) -> std::os::unix::prelude::BorrowedFd<'_> {
self.0.as_fd()
}
}

let event_loop = EventLoop::<()>::try_new().unwrap();
let fd = unsafe { std::os::unix::io::OwnedFd::from_raw_fd(420) };
let fd = LeakedFd(ManuallyDrop::new(unsafe {
std::os::unix::io::OwnedFd::from_raw_fd(420)
}));
let ret = event_loop.handle().insert_source(
crate::sources::generic::Generic::new(fd, Interest::READ, Mode::Level),
|_, _, _| Ok(PostAction::Continue),
Expand Down
4 changes: 2 additions & 2 deletions src/sources/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ impl<T> Scheduler<T> {
/// Sends the given future to the executor associated to this scheduler
///
/// Returns an error if the the executor not longer exists.
pub fn schedule<Fut: 'static>(&self, future: Fut) -> Result<(), ExecutorDestroyed>
pub fn schedule<Fut>(&self, future: Fut) -> Result<(), ExecutorDestroyed>
where
Fut: Future<Output = T>,
Fut: Future<Output = T> + 'static,
T: 'static,
{
/// Store this future's result in the executor.
Expand Down
Loading