Rust 2018 idioms (#2007)

* Add `#![warn]`s

* `cargo fix`

* Fix the `cargo fix` (fixception?)
This commit is contained in:
marc0246 2022-09-29 09:57:35 +02:00 committed by GitHub
parent 9d0a205c20
commit 3a83767924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 149 additions and 148 deletions

View File

@ -295,7 +295,7 @@ where
/// that uses it in exclusive mode will fail. You can still submit this buffer for non-exclusive
/// accesses (ie. reads).
#[inline]
pub fn read(&self) -> Result<ReadLock<T, A>, ReadLockError> {
pub fn read(&self) -> Result<ReadLock<'_, T, A>, ReadLockError> {
let mut state = self.inner.state();
let buffer_range = self.inner().offset..self.inner().offset + self.size();
@ -336,7 +336,7 @@ where
/// After this function successfully locks the buffer, any attempt to submit a command buffer
/// that uses it and any attempt to call `read()` will return an error.
#[inline]
pub fn write(&self) -> Result<WriteLock<T, A>, WriteLockError> {
pub fn write(&self) -> Result<WriteLock<'_, T, A>, WriteLockError> {
let mut state = self.inner.state();
let buffer_range = self.inner().offset..self.inner().offset + self.size();
@ -371,7 +371,7 @@ where
A: Send + Sync,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
BufferInner {
buffer: &self.inner,
offset: 0,
@ -450,7 +450,7 @@ where
#[derive(Debug)]
pub struct ReadLock<'a, T, A>
where
T: BufferContents + ?Sized + 'a,
T: BufferContents + ?Sized,
A: MemoryPoolAlloc,
{
inner: &'a CpuAccessibleBuffer<T, A>,
@ -492,7 +492,7 @@ where
#[derive(Debug)]
pub struct WriteLock<'a, T, A>
where
T: BufferContents + ?Sized + 'a,
T: BufferContents + ?Sized,
A: MemoryPoolAlloc,
{
inner: &'a CpuAccessibleBuffer<T, A>,
@ -559,7 +559,7 @@ impl Error for ReadLockError {}
impl Display for ReadLockError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -588,7 +588,7 @@ impl Error for WriteLockError {}
impl Display for WriteLockError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -419,7 +419,7 @@ where
// `cur_buf_mutex` must be an active lock of `self.current_buffer`.
fn reset_buf(
&self,
cur_buf_mutex: &mut MutexGuard<Option<Arc<ActualBuffer<A>>>>,
cur_buf_mutex: &mut MutexGuard<'_, Option<Arc<ActualBuffer<A>>>>,
capacity: DeviceSize,
) -> Result<(), DeviceMemoryError> {
let size = match (size_of::<T>() as DeviceSize).checked_mul(capacity) {
@ -478,7 +478,7 @@ where
//
fn try_next_impl<I>(
&self,
cur_buf_mutex: &mut MutexGuard<Option<Arc<ActualBuffer<A>>>>,
cur_buf_mutex: &mut MutexGuard<'_, Option<Arc<ActualBuffer<A>>>>,
data: I,
) -> Result<CpuBufferPoolChunk<T, A>, I::IntoIter>
where
@ -688,7 +688,7 @@ where
A: MemoryPool,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
BufferInner {
buffer: &self.buffer.inner,
offset: self.index * size_of::<T>() as DeviceSize + self.align_offset,
@ -810,7 +810,7 @@ where
A: MemoryPool,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
self.chunk.inner()
}

View File

@ -493,7 +493,7 @@ where
A: Send + Sync,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
BufferInner {
buffer: &self.inner,
offset: 0,
@ -573,7 +573,7 @@ impl Error for DeviceLocalBufferCreationError {
impl Display for DeviceLocalBufferCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::DeviceMemoryAllocationError(err) => err.fmt(f),
Self::CommandBufferBeginError(err) => err.fmt(f),

View File

@ -213,7 +213,7 @@ where
T: Send + Sync + ?Sized,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
let inner = self.resource.inner();
BufferInner {
buffer: inner.buffer,

View File

@ -446,7 +446,7 @@ impl UnsafeBuffer {
Ok(())
}
pub(crate) fn state(&self) -> MutexGuard<BufferState> {
pub(crate) fn state(&self) -> MutexGuard<'_, BufferState> {
self.state.lock()
}
@ -601,7 +601,7 @@ impl Error for BufferCreationError {
impl Display for BufferCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::AllocError(_) => write!(f, "allocating memory failed"),
Self::RequirementNotMet {

View File

@ -24,7 +24,7 @@ use std::{
/// See also `TypedBufferAccess`.
pub unsafe trait BufferAccess: DeviceOwned + Send + Sync {
/// Returns the inner information about this buffer.
fn inner(&self) -> BufferInner;
fn inner(&self) -> BufferInner<'_>;
/// Returns the size of the buffer in bytes.
fn size(&self) -> DeviceSize;
@ -142,7 +142,7 @@ where
T::Target: BufferAccess,
{
#[inline]
fn inner(&self) -> BufferInner {
fn inner(&self) -> BufferInner<'_> {
(**self).inner()
}
@ -175,7 +175,7 @@ where
}
impl Debug for dyn BufferAccess {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_struct("dyn BufferAccess")
.field("inner", &self.inner())
.finish()
@ -214,7 +214,7 @@ impl Error for BufferDeviceAddressError {}
impl Display for BufferDeviceAddressError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,

View File

@ -370,7 +370,7 @@ impl Error for BufferViewCreationError {
impl Display for BufferViewCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(
f,

View File

@ -543,7 +543,7 @@ impl Error for CommandBufferBeginError {
impl Display for CommandBufferBeginError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),
@ -686,7 +686,7 @@ impl Error for BuildError {
}
impl Display for BuildError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "out of memory"),
Self::RenderPassActive => {
@ -712,7 +712,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// Returns the binding/setting state.
#[inline]
pub fn state(&self) -> CommandBufferState {
pub fn state(&self) -> CommandBufferState<'_> {
self.inner.state()
}
}

View File

@ -607,7 +607,7 @@ impl SyncCommandBufferBuilder {
/// Starts the process of binding descriptor sets. Returns an intermediate struct which can be
/// used to add the sets.
#[inline]
pub fn bind_descriptor_sets(&mut self) -> SyncCommandBufferBuilderBindDescriptorSets {
pub fn bind_descriptor_sets(&mut self) -> SyncCommandBufferBuilderBindDescriptorSets<'_> {
SyncCommandBufferBuilderBindDescriptorSets {
builder: self,
descriptor_sets: SmallVec::new(),
@ -693,7 +693,7 @@ impl SyncCommandBufferBuilder {
/// Starts the process of binding vertex buffers. Returns an intermediate struct which can be
/// used to add the buffers.
#[inline]
pub fn bind_vertex_buffers(&mut self) -> SyncCommandBufferBuilderBindVertexBuffer {
pub fn bind_vertex_buffers(&mut self) -> SyncCommandBufferBuilderBindVertexBuffer<'_> {
SyncCommandBufferBuilderBindVertexBuffer {
builder: self,
inner: UnsafeCommandBufferBuilderBindVertexBuffer::new(),
@ -1270,7 +1270,7 @@ impl error::Error for BindPushError {
impl Display for BindPushError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,

View File

@ -324,7 +324,7 @@ impl Error for DebugUtilsError {}
impl Display for DebugUtilsError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,

View File

@ -2881,7 +2881,7 @@ impl Error for SetDynamicStateError {}
impl Display for SetDynamicStateError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,

View File

@ -286,7 +286,7 @@ impl Error for CopyError {
impl Display for CopyError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::SyncCommandBufferBuilderError(_) => write!(f, "a SyncCommandBufferBuilderError"),
@ -611,7 +611,7 @@ pub enum CopyErrorResource {
impl Display for CopyErrorResource {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::Source => write!(f, "source"),
Self::Destination => write!(f, "destination"),

View File

@ -2471,7 +2471,7 @@ impl Error for PipelineExecutionError {
impl Display for PipelineExecutionError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::SyncCommandBufferBuilderError(_) => write!(f, "a SyncCommandBufferBuilderError"),
@ -2735,7 +2735,7 @@ impl Error for DescriptorResourceInvalidError {
impl Display for DescriptorResourceInvalidError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::ImageViewFormatMismatch { provided, required } => write!(
f,

View File

@ -669,7 +669,7 @@ impl SyncCommandBufferBuilder {
impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdBeginQuery` on the builder.
#[inline]
pub unsafe fn begin_query(&mut self, query: Query, flags: QueryControlFlags) {
pub unsafe fn begin_query(&mut self, query: Query<'_>, flags: QueryControlFlags) {
let fns = self.device.fns();
let flags = if flags.precise {
ash::vk::QueryControlFlags::PRECISE
@ -686,14 +686,14 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdEndQuery` on the builder.
#[inline]
pub unsafe fn end_query(&mut self, query: Query) {
pub unsafe fn end_query(&mut self, query: Query<'_>) {
let fns = self.device.fns();
(fns.v1_0.cmd_end_query)(self.handle, query.pool().internal_object(), query.index());
}
/// Calls `vkCmdWriteTimestamp` on the builder.
#[inline]
pub unsafe fn write_timestamp(&mut self, query: Query, stage: PipelineStage) {
pub unsafe fn write_timestamp(&mut self, query: Query<'_>, stage: PipelineStage) {
let fns = self.device.fns();
(fns.v1_0.cmd_write_timestamp)(
self.handle,
@ -707,7 +707,7 @@ impl UnsafeCommandBufferBuilder {
#[inline]
pub unsafe fn copy_query_pool_results<D, T>(
&mut self,
queries: QueriesRange,
queries: QueriesRange<'_>,
destination: &D,
stride: DeviceSize,
flags: QueryResultFlags,
@ -737,7 +737,7 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdResetQueryPool` on the builder.
#[inline]
pub unsafe fn reset_query_pool(&mut self, queries: QueriesRange) {
pub unsafe fn reset_query_pool(&mut self, queries: QueriesRange<'_>) {
let range = queries.range();
let fns = self.device.fns();
(fns.v1_0.cmd_reset_query_pool)(
@ -806,7 +806,7 @@ impl Error for QueryError {}
impl Display for QueryError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::SyncCommandBufferBuilderError(_) => write!(
f,

View File

@ -2827,7 +2827,7 @@ impl Error for RenderPassError {
impl Display for RenderPassError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::SyncCommandBufferBuilderError(_) => write!(f, "a SyncCommandBufferBuilderError"),

View File

@ -395,7 +395,7 @@ impl SyncCommandBufferBuilder {
/// Starts the process of executing secondary command buffers. Returns an intermediate struct
/// which can be used to add the command buffers.
#[inline]
pub unsafe fn execute_commands(&mut self) -> SyncCommandBufferBuilderExecuteCommands {
pub unsafe fn execute_commands(&mut self) -> SyncCommandBufferBuilderExecuteCommands<'_> {
SyncCommandBufferBuilderExecuteCommands {
builder: self,
inner: Vec::new(),
@ -711,7 +711,7 @@ impl Error for ExecuteCommandsError {
impl Display for ExecuteCommandsError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::SyncCommandBufferBuilderError(_) => write!(f, "a SyncCommandBufferBuilderError"),

View File

@ -384,7 +384,7 @@ impl Error for UnsafeCommandPoolCreationError {
impl Display for UnsafeCommandPoolCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory",),
Self::QueueFamilyIndexOutOfRange {
@ -533,7 +533,7 @@ impl Error for CommandPoolTrimError {}
impl Display for CommandPoolTrimError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,

View File

@ -174,7 +174,7 @@ impl SyncCommandBufferBuilder {
/// Returns the binding/setting state.
#[inline]
pub fn state(&self) -> CommandBufferState {
pub fn state(&self) -> CommandBufferState<'_> {
CommandBufferState {
current_state: &self.current_state,
}
@ -862,7 +862,7 @@ unsafe impl DeviceOwned for SyncCommandBufferBuilder {
impl Debug for SyncCommandBufferBuilder {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
Debug::fmt(&self.inner, f)
}
}
@ -885,7 +885,7 @@ impl Error for SyncCommandBufferBuilderError {}
impl Display for SyncCommandBufferBuilderError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
SyncCommandBufferBuilderError::Conflict { .. } => write!(f, "unsolvable conflict"),
SyncCommandBufferBuilderError::ExecError(err) => Display::fmt(err, f),

View File

@ -520,7 +520,7 @@ pub(super) trait Command: Send + Sync {
}
impl Debug for dyn Command {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.write_str(self.name())
}
}

View File

@ -154,7 +154,7 @@ pub unsafe trait PrimaryCommandBuffer: DeviceOwned + Send + Sync {
}
impl Debug for dyn PrimaryCommandBuffer {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
Debug::fmt(self.inner(), f)
}
}
@ -559,7 +559,7 @@ impl Error for CommandBufferExecError {
impl Display for CommandBufferExecError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -520,7 +520,7 @@ impl Error for DescriptorSetLayoutCreationError {}
impl Display for DescriptorSetLayoutCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => {
write!(f, "out of memory")
@ -802,7 +802,7 @@ impl Error for DescriptorRequirementsNotMet {}
impl Display for DescriptorRequirementsNotMet {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::DescriptorType { required, obtained } => write!(
f,

View File

@ -507,7 +507,7 @@ impl Error for DescriptorSetCreationError {
impl Display for DescriptorSetCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::DescriptorSetUpdateError(_) => {
write!(f, "an error occurred while updating the descriptor set")

View File

@ -430,7 +430,7 @@ impl Error for DescriptorPoolAllocError {}
impl Display for DescriptorPoolAllocError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -118,7 +118,7 @@ unsafe impl VulkanObject for UnsafeDescriptorSet {
}
impl Debug for UnsafeDescriptorSet {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(f, "<Vulkan descriptor set {:?}>", self.handle)
}
}

View File

@ -950,7 +950,7 @@ impl Error for DescriptorSetUpdateError {
impl Display for DescriptorSetUpdateError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::ArrayIndexOutOfBounds {
binding,

View File

@ -28,7 +28,7 @@ impl Error for FeatureRestrictionError {}
impl Display for FeatureRestrictionError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"a restriction for the feature {} was not met: {}",
@ -51,7 +51,7 @@ pub enum FeatureRestriction {
impl Display for FeatureRestriction {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
FeatureRestriction::NotSupported => {
write!(f, "not supported by the physical device")

View File

@ -781,7 +781,7 @@ impl Error for DeviceCreationError {}
impl Display for DeviceCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::InitializationFailed => {
write!(
@ -971,7 +971,7 @@ impl Error for MemoryFdPropertiesError {}
impl Display for MemoryFdPropertiesError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OutOfHostMemory => write!(f, "no memory available on the host"),

View File

@ -2443,13 +2443,13 @@ impl From<ash::vk::ConformanceVersion> for ConformanceVersion {
}
impl Debug for ConformanceVersion {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
}
}
impl Display for ConformanceVersion {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), FmtError> {
Debug::fmt(self, formatter)
}
}
@ -2663,7 +2663,7 @@ impl Error for PhysicalDeviceError {
impl Display for PhysicalDeviceError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::VulkanError(_) => write!(
f,

View File

@ -83,7 +83,7 @@ impl Queue {
/// Locks the queue, making it possible to perform operations on the queue, such as submissions.
#[inline]
pub fn lock(&self) -> QueueGuard {
pub fn lock(&self) -> QueueGuard<'_> {
QueueGuard {
queue: self,
state: self.state.lock(),
@ -1097,7 +1097,7 @@ impl Error for QueueError {
impl Display for QueueError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::VulkanError(_) => write!(f, "a runtime error occurred",),

View File

@ -26,7 +26,7 @@ impl Error for ExtensionRestrictionError {}
impl Display for ExtensionRestrictionError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"a restriction for the extension {} was not met: {}",
@ -49,7 +49,7 @@ pub enum ExtensionRestriction {
impl Display for ExtensionRestriction {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
ExtensionRestriction::NotSupported => {
write!(f, "not supported by the loader or physical device")

View File

@ -567,7 +567,7 @@ where
A: MemoryPoolAlloc,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
ImageInner {
image: &self.image,
first_layer: 0,

View File

@ -319,7 +319,7 @@ where
A: MemoryPoolAlloc,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
ImageInner {
image: &self.image,
first_layer: 0,
@ -403,7 +403,7 @@ where
A: MemoryPoolAlloc,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
self.image.inner()
}
@ -465,7 +465,7 @@ impl Error for ImmutableImageCreationError {
impl Display for ImmutableImageCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::ImageCreationError(err) => err.fmt(f),
Self::DeviceMemoryAllocationError(err) => err.fmt(f),

View File

@ -266,7 +266,7 @@ where
A: MemoryPool,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
ImageInner {
image: &self.image,
first_layer: 0,

View File

@ -61,7 +61,7 @@ where
}
#[inline]
fn my_image(&self) -> ImageInner {
fn my_image(&self) -> ImageInner<'_> {
self.swapchain.raw_image(self.image_index).unwrap()
}
@ -87,7 +87,7 @@ where
W: Send + Sync,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
self.my_image()
}

View File

@ -1451,7 +1451,7 @@ impl UnsafeImage {
}
#[inline]
pub(crate) fn state(&self) -> MutexGuard<ImageState> {
pub(crate) fn state(&self) -> MutexGuard<'_, ImageState> {
self.state.lock()
}
@ -2008,7 +2008,7 @@ impl Error for ImageCreationError {
impl Display for ImageCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::AllocError(_) => write!(f, "allocating memory failed"),

View File

@ -25,7 +25,7 @@ use std::{
/// Trait for types that represent the way a GPU can access an image.
pub unsafe trait ImageAccess: DeviceOwned + Send + Sync {
/// Returns the inner unsafe image object used by this image.
fn inner(&self) -> ImageInner;
fn inner(&self) -> ImageInner<'_>;
/// Returns the dimensions of the image.
#[inline]
@ -230,7 +230,7 @@ pub struct ImageInner<'a> {
}
impl Debug for dyn ImageAccess {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_struct("dyn ImageAccess")
.field("inner", &self.inner())
.finish()
@ -275,7 +275,7 @@ where
I: ImageAccess,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
self.image.inner()
}
@ -332,7 +332,7 @@ where
T::Target: ImageAccess,
{
#[inline]
fn inner(&self) -> ImageInner {
fn inner(&self) -> ImageInner<'_> {
(**self).inner()
}

View File

@ -995,7 +995,7 @@ impl Error for ImageViewCreationError {
impl Display for ImageViewCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(
f,

View File

@ -54,7 +54,7 @@ use std::{
sync::Arc,
};
pub(super) type UserCallback = Arc<dyn Fn(&Message) + RefUnwindSafe + Send + Sync>;
pub(super) type UserCallback = Arc<dyn Fn(&Message<'_>) + RefUnwindSafe + Send + Sync>;
/// Registration of a callback called by validation layers.
///
@ -190,7 +190,7 @@ impl Drop for DebugUtilsMessenger {
}
impl Debug for DebugUtilsMessenger {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let Self {
handle,
instance,
@ -255,7 +255,7 @@ impl Error for DebugUtilsMessengerCreationError {}
impl Display for DebugUtilsMessengerCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::RequirementNotMet {
required_for,
@ -336,7 +336,7 @@ impl DebugUtilsMessengerCreateInfo {
}
impl Debug for DebugUtilsMessengerCreateInfo {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let Self {
message_severity,
message_type,
@ -452,9 +452,10 @@ mod tests {
..DebugUtilsMessengerCreateInfo::user_callback(Arc::new(|_| {}))
},
)
};
}
.unwrap();
thread::spawn(move || {
let _ = callback;
drop(callback);
});
}
}

View File

@ -595,7 +595,7 @@ impl Hash for Instance {
}
impl Debug for Instance {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let Self {
handle,
fns,
@ -755,7 +755,7 @@ impl Error for InstanceCreationError {
impl Display for InstanceCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::InitializationFailed => write!(f, "initialization failed"),

View File

@ -62,7 +62,7 @@
//!
//#![warn(missing_docs)] // TODO: activate
#![warn(rust_2018_idioms, rust_2021_compatibility)]
// These lints are a bit too pedantic, so they're disabled here.
#![allow(
clippy::collapsible_else_if,
@ -151,7 +151,7 @@ impl Error for OomError {}
impl Display for OomError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -180,7 +180,7 @@ include!(concat!(env!("OUT_DIR"), "/errors.rs"));
impl Error for VulkanError {}
impl Display for VulkanError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
VulkanError::OutOfHostMemory => write!(
f,
@ -325,7 +325,7 @@ impl RequiresOneOf {
impl Display for RequiresOneOf {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let mut members_written = 0;
if let Some(version) = self.api_version {

View File

@ -274,7 +274,7 @@ where
impl Debug for dyn Loader {
#[inline]
fn fmt(&self, _f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), FmtError> {
Ok(())
}
}
@ -378,7 +378,7 @@ impl Error for LoadingError {
impl Display for LoadingError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -70,7 +70,7 @@ impl DeviceMemory {
/// image does not belong to `device`.
pub fn allocate(
device: Arc<Device>,
mut allocate_info: MemoryAllocateInfo,
mut allocate_info: MemoryAllocateInfo<'_>,
) -> Result<Self, DeviceMemoryError> {
Self::validate(&device, &mut allocate_info, None)?;
let handle = unsafe { Self::create(&device, &allocate_info, None)? };
@ -106,7 +106,7 @@ impl DeviceMemory {
/// image does not belong to `device`.
pub unsafe fn import(
device: Arc<Device>,
mut allocate_info: MemoryAllocateInfo,
mut allocate_info: MemoryAllocateInfo<'_>,
mut import_info: MemoryImportInfo,
) -> Result<Self, DeviceMemoryError> {
Self::validate(&device, &mut allocate_info, Some(&mut import_info))?;
@ -132,7 +132,7 @@ impl DeviceMemory {
fn validate(
device: &Device,
allocate_info: &mut MemoryAllocateInfo,
allocate_info: &mut MemoryAllocateInfo<'_>,
import_info: Option<&mut MemoryImportInfo>,
) -> Result<(), DeviceMemoryError> {
let &mut MemoryAllocateInfo {
@ -355,7 +355,7 @@ impl DeviceMemory {
unsafe fn create(
device: &Device,
allocate_info: &MemoryAllocateInfo,
allocate_info: &MemoryAllocateInfo<'_>,
import_info: Option<MemoryImportInfo>,
) -> Result<ash::vk::DeviceMemory, DeviceMemoryError> {
let &MemoryAllocateInfo {
@ -983,7 +983,7 @@ impl Error for DeviceMemoryError {
impl Display for DeviceMemoryError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::TooManyObjects => {
@ -1473,7 +1473,7 @@ impl Error for MemoryMapError {
impl Display for MemoryMapError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::MemoryMapFailed => write!(f, "memory map failed"),

View File

@ -80,7 +80,7 @@ pub(crate) fn alloc_dedicated_with_exportable_fd<F>(
requirements: &MemoryRequirements,
_layout: AllocLayout,
map: MappingRequirement,
dedicated_allocation: DedicatedAllocation,
dedicated_allocation: DedicatedAllocation<'_>,
filter: F,
) -> Result<PotentialDedicatedAllocation<StandardMemoryPoolAlloc>, DeviceMemoryError>
where
@ -181,7 +181,7 @@ pub unsafe trait MemoryPool: DeviceOwned {
requirements: &MemoryRequirements,
layout: AllocLayout,
map: MappingRequirement,
dedicated_allocation: Option<DedicatedAllocation>,
dedicated_allocation: Option<DedicatedAllocation<'_>>,
filter: F,
) -> Result<PotentialDedicatedAllocation<Self::Alloc>, DeviceMemoryError>
where

View File

@ -70,7 +70,7 @@ impl ComputePipeline {
/// to add dynamic buffers or immutable samplers.
pub fn new<Css, F>(
device: Arc<Device>,
shader: EntryPoint,
shader: EntryPoint<'_>,
specialization_constants: &Css,
cache: Option<Arc<PipelineCache>>,
func: F,
@ -117,7 +117,7 @@ impl ComputePipeline {
/// uses.
pub fn with_pipeline_layout<Css>(
device: Arc<Device>,
shader: EntryPoint,
shader: EntryPoint<'_>,
specialization_constants: &Css,
layout: Arc<PipelineLayout>,
cache: Option<Arc<PipelineCache>>,
@ -158,7 +158,7 @@ impl ComputePipeline {
/// superset of what the shader expects.
pub unsafe fn with_unchecked_pipeline_layout<Css>(
device: Arc<Device>,
shader: EntryPoint,
shader: EntryPoint<'_>,
specialization_constants: &Css,
layout: Arc<PipelineLayout>,
cache: Option<Arc<PipelineCache>>,
@ -274,7 +274,7 @@ impl Pipeline for ComputePipeline {
impl Debug for ComputePipeline {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(f, "<Vulkan compute pipeline {:?}>", self.handle)
}
}
@ -344,7 +344,7 @@ impl Error for ComputePipelineCreationError {
impl Display for ComputePipelineCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -169,7 +169,7 @@ where
F: FnOnce(&mut [DescriptorSetLayoutCreateInfo]),
{
let (set_layout_create_infos, push_constant_ranges) = {
let stages: SmallVec<[&EntryPoint; 5]> = [
let stages: SmallVec<[&EntryPoint<'_>; 5]> = [
self.vertex_shader.as_ref().map(|s| &s.0),
self.tessellation_shaders.as_ref().map(|s| &s.control.0),
self.tessellation_shaders.as_ref().map(|s| &s.evaluation.0),

View File

@ -212,7 +212,7 @@ impl Error for GraphicsPipelineCreationError {
impl Display for GraphicsPipelineCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::RequirementNotMet {
required_for,

View File

@ -266,7 +266,7 @@ unsafe impl DeviceOwned for GraphicsPipeline {
impl Debug for GraphicsPipeline {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(f, "<Vulkan graphics pipeline {:?}>", self.handle)
}
}

View File

@ -34,7 +34,7 @@ struct VertexBuffer {
}
impl Debug for VertexBuffer {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_struct("VertexBuffer")
.field("stride", &self.stride)
.field("input_rate", &self.input_rate)

View File

@ -104,7 +104,7 @@ impl Error for IncompatibleVertexDefinitionError {}
impl Display for IncompatibleVertexDefinitionError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
IncompatibleVertexDefinitionError::MissingAttribute { .. } => {
write!(f, "an attribute is missing",)

View File

@ -833,7 +833,7 @@ impl Error for PipelineLayoutCreationError {
impl Display for PipelineLayoutCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available"),
@ -1007,7 +1007,7 @@ impl Error for PipelineLayoutSupersetError {
impl Display for PipelineLayoutSupersetError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
PipelineLayoutSupersetError::DescriptorRequirementsNotMet { set_num, binding_num, .. } => write!(
f,

View File

@ -142,7 +142,7 @@ impl QueryPool {
/// Returns a reference to a single query slot, or `None` if the index is out of range.
#[inline]
pub fn query(&self, index: u32) -> Option<Query> {
pub fn query(&self, index: u32) -> Option<Query<'_>> {
if index < self.query_count {
Some(Query { pool: self, index })
} else {
@ -156,7 +156,7 @@ impl QueryPool {
///
/// Panics if the range is empty.
#[inline]
pub fn queries_range(&self, range: Range<u32>) -> Option<QueriesRange> {
pub fn queries_range(&self, range: Range<u32>) -> Option<QueriesRange<'_>> {
assert!(!range.is_empty());
if range.end <= self.query_count {
@ -259,7 +259,7 @@ impl Error for QueryPoolCreationError {
impl Display for QueryPoolCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -472,7 +472,7 @@ impl Error for GetResultsError {
impl Display for GetResultsError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::DeviceLost => write!(f, "the connection to the device has been lost"),

View File

@ -585,7 +585,7 @@ where
K: Ord + Clone,
V: Eq + Clone,
{
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_map().entries(self.iter()).finish()
}
}

View File

@ -1588,7 +1588,7 @@ impl Error for RenderPassCreationError {
impl Display for RenderPassCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available",),

View File

@ -606,7 +606,7 @@ impl Error for FramebufferCreationError {
impl Display for FramebufferCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(
f,

View File

@ -868,7 +868,7 @@ impl Error for SamplerCreationError {
impl Display for SamplerCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::TooManyObjects => write!(f, "too many simultaneous sampler objects",),
@ -1476,7 +1476,7 @@ pub enum SamplerImageViewIncompatibleError {
impl Error for SamplerImageViewIncompatibleError {}
impl Display for SamplerImageViewIncompatibleError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::BorderColorFormatNotCompatible => write!(f, "the sampler has a border color with a numeric type different from the image view"),
Self::BorderColorOpaqueBlackNotIdentitySwizzled => write!(f, "the sampler has an opaque black border color, but the image view is not identity swizzled"),

View File

@ -568,7 +568,7 @@ impl Error for SamplerYcbcrConversionCreationError {
impl Display for SamplerYcbcrConversionCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available"),

View File

@ -307,7 +307,7 @@ impl Error for ShaderCreationError {
}
impl Display for ShaderCreationError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::SpirvCapabilityNotSupported { capability, .. } => write!(
@ -352,7 +352,7 @@ pub enum ShaderSupportError {
impl Error for ShaderSupportError {}
impl Display for ShaderSupportError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::NotSupportedByVulkan => write!(f, "not supported by Vulkan"),
Self::RequirementsNotMet(requirements) => write!(
@ -688,7 +688,7 @@ pub enum DescriptorRequirementsIncompatible {
impl Error for DescriptorRequirementsIncompatible {}
impl Display for DescriptorRequirementsIncompatible {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
DescriptorRequirementsIncompatible::DescriptorType => write!(
f,
@ -1024,7 +1024,7 @@ impl Error for ShaderInterfaceMismatchError {}
impl Display for ShaderInterfaceMismatchError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -396,7 +396,7 @@ impl Spirv {
/// - Panics if `id` is not defined in this module. This can in theory only happpen if you are
/// mixing `Id`s from different modules.
#[inline]
pub fn id(&self, id: Id) -> IdInfo {
pub fn id(&self, id: Id) -> IdInfo<'_> {
IdInfo {
data_indices: &self.ids[&id],
instructions: &self.instructions,
@ -571,7 +571,7 @@ impl From<Id> for u32 {
}
impl Display for Id {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(f, "%{}", self.0)
}
}

View File

@ -1359,7 +1359,7 @@ unsafe impl<W> VulkanObject for Surface<W> {
impl<W> Debug for Surface<W> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let Self {
handle,
instance,
@ -1427,7 +1427,7 @@ impl Error for SurfaceCreationError {
impl Display for SurfaceCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
SurfaceCreationError::OomError(_) => write!(f, "not enough memory available"),

View File

@ -908,7 +908,7 @@ impl<W> Hash for Swapchain<W> {
impl<W> Debug for Swapchain<W> {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
let Self {
handle,
device,
@ -962,7 +962,7 @@ pub unsafe trait SwapchainAbstract:
VulkanObject<Object = ash::vk::SwapchainKHR> + DeviceOwned + Debug + Send + Sync
{
/// Returns one of the images that belongs to this swapchain.
fn raw_image(&self, index: u32) -> Option<ImageInner>;
fn raw_image(&self, index: u32) -> Option<ImageInner<'_>>;
/// Returns the number of images of the swapchain.
fn image_count(&self) -> u32;
@ -991,7 +991,7 @@ where
W: Send + Sync,
{
#[inline]
fn raw_image(&self, image_index: u32) -> Option<ImageInner> {
fn raw_image(&self, image_index: u32) -> Option<ImageInner<'_>> {
self.images.get(image_index as usize).map(|i| ImageInner {
image: &i.image,
first_layer: 0,
@ -1277,7 +1277,7 @@ impl Error for SwapchainCreationError {
impl Display for SwapchainCreationError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(_) => write!(f, "not enough memory available",),
Self::DeviceLost => write!(f, "the device was lost",),
@ -1469,7 +1469,7 @@ impl Error for FullScreenExclusiveError {
impl Display for FullScreenExclusiveError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -1838,7 +1838,7 @@ impl Error for AcquireError {
impl Display for AcquireError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -1937,7 +1937,7 @@ impl Error for PresentWaitError {
impl Display for PresentWaitError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match *self {
Self::OomError(e) => write!(f, "{}", e),
Self::DeviceLost => write!(f, "the connection to the device has been lost"),

View File

@ -598,7 +598,7 @@ impl Error for FenceError {
}
impl Display for FenceError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),
Self::DeviceLost => write!(f, "the device was lost"),

View File

@ -206,7 +206,7 @@ where
// Implementation of `flush`. You must lock the state and pass the mutex guard here.
fn flush_impl(
&self,
state: &mut MutexGuard<FenceSignalFutureState<F>>,
state: &mut MutexGuard<'_, FenceSignalFutureState<F>>,
) -> Result<(), FlushError> {
unsafe {
// In this function we temporarily replace the current state with `Poisoned` at the

View File

@ -413,7 +413,7 @@ impl Error for AccessError {}
impl Display for AccessError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -454,7 +454,7 @@ impl Error for AccessCheckError {}
impl Display for AccessCheckError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",
@ -517,7 +517,7 @@ impl Error for FlushError {
impl Display for FlushError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"{}",

View File

@ -516,7 +516,7 @@ impl Error for SemaphoreError {
}
impl Display for SemaphoreError {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
Self::OomError(_) => write!(f, "not enough memory available"),

View File

@ -99,13 +99,13 @@ impl FromStr for Version {
}
impl Debug for Version {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
}
}
impl Display for Version {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), FmtError> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), FmtError> {
Debug::fmt(self, formatter)
}
}