Check formatting in CI (#2442)

* Check formatting in CI

* Fix existing fomatting inconsistencies

* Update PR template
This commit is contained in:
marc0246 2024-01-03 09:45:14 +01:00 committed by GitHub
parent 7788847b04
commit cf31f4e059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 27 additions and 23 deletions

View File

@ -2,13 +2,13 @@
2. [ ] Make sure that the changes are covered by unit-tests. 2. [ ] Make sure that the changes are covered by unit-tests.
3. [ ] Run `cargo fmt` on the changes. 3. [ ] Run `cargo +nightly fmt` on the changes.
4. [ ] Please put changelog entries **in the description of this Pull Request** 4. [ ] Please put changelog entries **in the description of this Pull Request**
if knowledge of this change could be valuable to users. No need to put the if knowledge of this change could be valuable to users. No need to put the
entries to the changelog directly, they will be transferred to the changelog entries to the changelog directly, they will be transferred to the changelog
file by maintainers right after the Pull Request merge. file by maintainers right after the Pull Request merge.
Please remove any items from the template below that are not applicable. Please remove any items from the template below that are not applicable.
5. [ ] Describe in common words what is the purpose of this change, related 5. [ ] Describe in common words what is the purpose of this change, related
@ -18,7 +18,7 @@ Changelog:
```markdown ```markdown
### Public dependency updates ### Public dependency updates
- [some_crate](https://crates.io/crates/some_crate) 1.0 - [some_crate](https://crates.io/crates/some_crate) 1.0
### Breaking changes ### Breaking changes
Changes to `Foo`: Changes to `Foo`:
- Renamed to `Bar`. - Renamed to `Bar`.

View File

@ -51,3 +51,11 @@ jobs:
run: | run: |
cd examples cd examples
cargo build --verbose cargo build --verbose
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check formatting
run: |
rustup toolchain install nightly --component rustfmt
cargo +nightly fmt --check

View File

@ -1,2 +1,2 @@
# imports_granularity = "Crate" imports_granularity = "Crate"
# group_imports = "One" group_imports = "One"

View File

@ -1,3 +1,4 @@
use super::LightingVertex;
use std::sync::Arc; use std::sync::Arc;
use vulkano::{ use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer}, buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
@ -31,8 +32,6 @@ use vulkano::{
render_pass::Subpass, render_pass::Subpass,
}; };
use super::LightingVertex;
/// Allows applying an ambient lighting to a scene. /// Allows applying an ambient lighting to a scene.
pub struct AmbientLightingSystem { pub struct AmbientLightingSystem {
gfx_queue: Arc<Queue>, gfx_queue: Arc<Queue>,

View File

@ -1,3 +1,4 @@
use super::LightingVertex;
use cgmath::Vector3; use cgmath::Vector3;
use std::sync::Arc; use std::sync::Arc;
use vulkano::{ use vulkano::{
@ -32,8 +33,6 @@ use vulkano::{
render_pass::Subpass, render_pass::Subpass,
}; };
use super::LightingVertex;
/// Allows applying a directional light source to a scene. /// Allows applying a directional light source to a scene.
pub struct DirectionalLightingSystem { pub struct DirectionalLightingSystem {
gfx_queue: Arc<Queue>, gfx_queue: Arc<Queue>,

View File

@ -3,9 +3,8 @@
// The main code is in the `system` module, while the other modules implement the different kinds // The main code is in the `system` module, while the other modules implement the different kinds
// of lighting sources. // of lighting sources.
use vulkano::{buffer::BufferContents, pipeline::graphics::vertex_input::Vertex};
pub use self::system::{FrameSystem, Pass}; pub use self::system::{FrameSystem, Pass};
use vulkano::{buffer::BufferContents, pipeline::graphics::vertex_input::Vertex};
mod ambient_lighting_system; mod ambient_lighting_system;
mod directional_lighting_system; mod directional_lighting_system;

View File

@ -1,3 +1,4 @@
use super::LightingVertex;
use cgmath::{Matrix4, Vector3}; use cgmath::{Matrix4, Vector3};
use std::sync::Arc; use std::sync::Arc;
use vulkano::{ use vulkano::{
@ -32,8 +33,6 @@ use vulkano::{
render_pass::Subpass, render_pass::Subpass,
}; };
use super::LightingVertex;
pub struct PointLightingSystem { pub struct PointLightingSystem {
gfx_queue: Arc<Queue>, gfx_queue: Arc<Queue>,
vertex_buffer: Subbuffer<[LightingVertex]>, vertex_buffer: Subbuffer<[LightingVertex]>,

View File

@ -24,7 +24,6 @@ use std::{
sync::Arc, sync::Arc,
thread, thread,
}; };
#[cfg(feature = "macros")] #[cfg(feature = "macros")]
pub use vulkano_macros::BufferContents; pub use vulkano_macros::BufferContents;

View File

@ -152,6 +152,7 @@
pub use ash::vk::Handle; pub use ash::vk::Handle;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
pub use extensions::ExtensionProperties;
pub use half; pub use half;
pub use library::{LoadingError, VulkanLibrary}; pub use library::{LoadingError, VulkanLibrary};
use std::{ use std::{
@ -162,7 +163,7 @@ use std::{
ops::Deref, ops::Deref,
sync::Arc, sync::Arc,
}; };
pub use {extensions::ExtensionProperties, version::Version}; pub use version::Version;
#[macro_use] #[macro_use]
mod tests; mod tests;

View File

@ -999,4 +999,8 @@ macro_rules! try_opt {
}; };
} }
pub(crate) use {impl_id_counter, try_opt, vulkan_bitflags, vulkan_bitflags_enum, vulkan_enum}; pub(crate) use impl_id_counter;
pub(crate) use try_opt;
pub(crate) use vulkan_bitflags;
pub(crate) use vulkan_bitflags_enum;
pub(crate) use vulkan_enum;

View File

@ -158,7 +158,6 @@ mod tests {
use crate::format::Format; use crate::format::Format;
#[allow(deprecated)] #[allow(deprecated)]
use crate::pipeline::graphics::vertex_input::Vertex; use crate::pipeline::graphics::vertex_input::Vertex;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
#[test] #[test]

View File

@ -105,9 +105,7 @@ impl VertexMemberInfo {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::format::Format; use crate::{format::Format, pipeline::graphics::vertex_input::Vertex};
use crate::pipeline::graphics::vertex_input::Vertex;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
#[test] #[test]

View File

@ -1534,8 +1534,7 @@ unsafe fn get_metal_layer_ios(ui_view: *mut c_void) -> IOSMetalLayer {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
unsafe fn get_metal_layer_macos(ns_view: *mut c_void) -> *mut Object { unsafe fn get_metal_layer_macos(ns_view: *mut c_void) -> *mut Object {
use core_graphics_types::base::CGFloat; use core_graphics_types::base::CGFloat;
use objc::runtime::YES; use objc::runtime::{BOOL, NO, YES};
use objc::runtime::{BOOL, NO};
let view: *mut Object = ns_view.cast(); let view: *mut Object = ns_view.cast();
let main_layer: *mut Object = msg_send![view, layer]; let main_layer: *mut Object = msg_send![view, layer];

View File

@ -33,8 +33,8 @@ use crate::{
VulkanObject, VulkanObject,
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use std::fs::File;
use std::{ use std::{
fs::File,
future::Future, future::Future,
mem::MaybeUninit, mem::MaybeUninit,
num::NonZeroU64, num::NonZeroU64,