Skip to content

Commit

Permalink
Fix unused import warnings on Windows (#2059)
Browse files Browse the repository at this point in the history
* Fix unused import warnings on Windows

* Fix typo and fix warnings with tests
  • Loading branch information
AustinJ235 authored Oct 30, 2022
1 parent 59a8c45 commit 22daa8c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
18 changes: 10 additions & 8 deletions vulkano/src/sync/fence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ use crate::{
};
use parking_lot::{Mutex, MutexGuard};
use smallvec::SmallVec;
#[cfg(unix)]
use std::fs::File;
use std::{
error::Error,
fmt::{Display, Error as FmtError, Formatter},
fs::File,
future::Future,
mem::MaybeUninit,
num::NonZeroU64,
pin::Pin,
ptr,
sync::{Arc, Weak},
task::{Context, Poll},
time::Duration,
};
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};

/// A two-state synchronization primitive that is signalled by the device and waited on by the host.
///
Expand Down Expand Up @@ -1067,8 +1068,10 @@ impl Fence {
// Check if we are done without blocking
match self.is_signaled() {
Err(e) => return Poll::Ready(Err(e)),
Ok(signalled) => if signalled {
return Poll::Ready(Ok(()))
Ok(signalled) => {
if signalled {
return Poll::Ready(Ok(()));
}
}
}

Expand All @@ -1093,8 +1096,7 @@ impl Drop for Fence {
}
}

impl Future for Fence
{
impl Future for Fence {
type Output = Result<(), OomError>;

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Expand Down
17 changes: 11 additions & 6 deletions vulkano/src/sync/future/fence_signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ use crate::{
DeviceSize, OomError,
};
use parking_lot::{Mutex, MutexGuard};
use std::{mem::replace, ops::Range, sync::Arc, time::Duration};
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::{
future::Future,
mem::replace,
ops::Range,
pin::Pin,
sync::Arc,
task::{Context, Poll},
time::Duration,
};

/// Builds a new fence signal future.
pub fn then_signal_fence<F>(future: F, behavior: FenceSignalFutureBehavior) -> FenceSignalFuture<F>
Expand Down Expand Up @@ -366,8 +371,8 @@ where
}

impl<F> Future for FenceSignalFuture<F>
where
F: GpuFuture,
where
F: GpuFuture,
{
type Output = Result<(), OomError>;

Expand Down
10 changes: 6 additions & 4 deletions vulkano/src/sync/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ use crate::{
OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject,
};
use parking_lot::{Mutex, MutexGuard};
#[cfg(unix)]
use std::fs::File;
use std::{
error::Error,
fmt::{Display, Error as FmtError, Formatter},
fs::File,
mem::MaybeUninit,
num::NonZeroU64,
ptr,
Expand Down Expand Up @@ -1635,13 +1636,14 @@ impl From<RequirementNotMet> for SemaphoreError {

#[cfg(test)]
mod tests {
use super::ExternalSemaphoreHandleType;
#[cfg(unix)]
use crate::{
device::{Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo},
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
sync::{ExternalSemaphoreHandleTypes, Semaphore, SemaphoreCreateInfo},
VulkanLibrary, VulkanObject,
sync::{ExternalSemaphoreHandleType, ExternalSemaphoreHandleTypes, SemaphoreCreateInfo},
VulkanLibrary,
};
use crate::{sync::Semaphore, VulkanObject};

#[test]
fn semaphore_create() {
Expand Down

0 comments on commit 22daa8c

Please sign in to comment.