Skip to content

Commit

Permalink
Remove unnecessary error type
Browse files Browse the repository at this point in the history
InstanceError::LoadError was never constructed.
  • Loading branch information
Ralith committed Jul 31, 2021
1 parent 14bec37 commit e17fff4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
24 changes: 2 additions & 22 deletions ash/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use crate::instance::Instance;
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use std::error::Error;
use std::ffi::CStr;
use std::fmt;
use std::mem;
use std::os::raw::c_char;
use std::os::raw::c_void;
Expand Down Expand Up @@ -123,16 +121,15 @@ impl<L> EntryCustom<L> {
&self,
create_info: &vk::InstanceCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> Result<Instance, InstanceError> {
) -> VkResult<Instance> {
let mut instance = mem::zeroed();
self.entry_fn_1_0
.create_instance(
create_info,
allocation_callbacks.as_raw_ptr(),
&mut instance,
)
.result()
.map_err(InstanceError::VkError)?;
.result()?;
Ok(Instance::load(&self.static_fn, instance))
}

Expand Down Expand Up @@ -211,23 +208,6 @@ impl<L> EntryCustom<L> {
}
}

#[derive(Clone, Debug)]
pub enum InstanceError {
LoadError(Vec<&'static str>),
VkError(vk::Result),
}

impl fmt::Display for InstanceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
InstanceError::LoadError(e) => write!(f, "{}", e.join("; ")),
InstanceError::VkError(e) => write!(f, "{}", e),
}
}
}

impl Error for InstanceError {}

impl vk::StaticFn {
pub fn load_checked<F>(mut _f: F) -> Result<Self, MissingEntryPoint>
where
Expand Down
2 changes: 1 addition & 1 deletion ash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//! function names into function pointers.

pub use crate::device::Device;
pub use crate::entry::{EntryCustom, InstanceError};
pub use crate::entry::EntryCustom;
#[cfg(feature = "loaded")]
pub use crate::entry_libloading::{LoadingError, RuntimeLoadedEntry};
#[cfg(feature = "linked")]
Expand Down

0 comments on commit e17fff4

Please sign in to comment.