Skip to content

Commit

Permalink
enable clippy std/alloc import lints
Browse files Browse the repository at this point in the history
  • Loading branch information
i509VCB committed Dec 20, 2022
1 parent 7dc4884 commit 5b3c4e4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ash/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use core::ptr;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

#[cfg(feature = "loaded")]
use alloc::sync::Arc;
#[cfg(feature = "loaded")]
use libloading::Library;
#[cfg(feature = "loaded")]
use std::ffi::OsStr;
#[cfg(feature = "loaded")]
use std::sync::Arc;

/// Holds the Vulkan functions independent of a particular instance
#[derive(Clone)]
Expand Down Expand Up @@ -350,6 +350,9 @@ impl core::fmt::Display for MissingEntryPoint {
write!(f, "Cannot load `vkGetInstanceProcAddr` symbol from library")
}
}
// At the moment clippy falsely lints reexports that are unstable.
// This was fixed in https://github.com/rust-lang/rust-clippy/commit/5b0f46a9d90ed2c7d26b2760dddee7399b379612
#[allow(clippy::std_instead_of_core)]
#[cfg(feature = "std")]
impl std::error::Error for MissingEntryPoint {}

Expand All @@ -361,8 +364,11 @@ extern "system" {

#[cfg(feature = "loaded")]
mod loaded {
// At the moment clippy falsely lints reexports that are unstable.
// This was fixed in https://github.com/rust-lang/rust-clippy/commit/5b0f46a9d90ed2c7d26b2760dddee7399b379612
#![allow(clippy::std_instead_of_core)]
use core::fmt;
use std::error::Error;
use std::fmt;

use super::*;

Expand Down
6 changes: 5 additions & 1 deletion ash/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#![deny(clippy::use_self)]
#![warn(trivial_casts, trivial_numeric_casts)]
#![warn(
clippy::std_instead_of_core,
clippy::std_instead_of_alloc,
clippy::alloc_instead_of_core
)]
#![allow(
clippy::too_many_arguments,
clippy::missing_safety_doc,
Expand Down Expand Up @@ -44,7 +49,6 @@
//! `no_std` environment with `alloc`.
//! * **linked**: Link the Vulkan loader at compile time.

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

Expand Down
3 changes: 3 additions & 0 deletions ash/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ pub(crate) fn debug_flags<Value: Into<u64> + Copy>(
/// The FFI prelude for ash.
///
/// The types exported by this module should only be needed until ash's MSRV is raised to 1.64.
// At the moment clippy falsely lints reexports that are unstable.
// This was fixed in https://github.com/rust-lang/rust-clippy/commit/5b0f46a9d90ed2c7d26b2760dddee7399b379612
#[allow(clippy::std_instead_of_core)]
#[cfg(feature = "std")]
mod ffi_prelude {
pub use std::ffi::CStr;
Expand Down
1 change: 1 addition & 0 deletions ash/src/vk/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ impl Result {
#[doc = "An unknown error has occurred, due to an implementation or application bug"]
pub const ERROR_UNKNOWN: Self = Self(-13);
}
#[allow(clippy::std_instead_of_core)]
#[cfg(feature = "std")]
impl ::std::error::Error for Result {}
impl fmt::Display for Result {
Expand Down
3 changes: 3 additions & 0 deletions generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,9 @@ pub fn generate_result(ident: Ident, enum_: &vk_parse::Enums) -> TokenStream {
});

quote! {
// At the moment clippy falsely lints reexports that are unstable.
// This was fixed in https://github.com/rust-lang/rust-clippy/commit/5b0f46a9d90ed2c7d26b2760dddee7399b379612
#[allow(clippy::std_instead_of_core)]
#[cfg(feature = "std")]
impl ::std::error::Error for #ident {}
impl fmt::Display for #ident {
Expand Down

0 comments on commit 5b3c4e4

Please sign in to comment.