mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
github actions: use stable clippy (#577)
This commit is contained in:
parent
05db806e15
commit
dd07674b59
9 changed files with 21 additions and 26 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -83,11 +83,6 @@ jobs:
|
|||
run: cargo +nightly fmt --all -- --check
|
||||
|
||||
# type complexity must be ignored because we use huge templates for queries
|
||||
# -A clippy::manual-strip: strip_prefix support was added in 1.45. we want to support earlier rust versions
|
||||
- name: Run clippy
|
||||
run: >
|
||||
cargo +nightly clippy
|
||||
--all-targets
|
||||
--all-features
|
||||
--
|
||||
-D warnings
|
||||
-A clippy::type_complexity
|
||||
run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::type_complexity -A clippy::manual-strip
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{io::Cursor, path::Path, sync::Arc};
|
|||
/// A source of audio data
|
||||
#[derive(Clone)]
|
||||
pub struct AudioSource {
|
||||
pub bytes: Arc<Vec<u8>>,
|
||||
pub bytes: Arc<[u8]>,
|
||||
}
|
||||
|
||||
impl AsRef<[u8]> for AudioSource {
|
||||
|
@ -21,7 +21,7 @@ pub struct Mp3Loader;
|
|||
impl AssetLoader<AudioSource> for Mp3Loader {
|
||||
fn from_bytes(&self, _asset_path: &Path, bytes: Vec<u8>) -> Result<AudioSource> {
|
||||
Ok(AudioSource {
|
||||
bytes: Arc::new(bytes),
|
||||
bytes: bytes.into(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ pub enum RenderCommand {
|
|||
SetBindGroup {
|
||||
index: u32,
|
||||
bind_group: BindGroupId,
|
||||
dynamic_uniform_indices: Option<Arc<Vec<u32>>>,
|
||||
dynamic_uniform_indices: Option<Arc<[u32]>>,
|
||||
},
|
||||
DrawIndexed {
|
||||
indices: Range<u32>,
|
||||
|
|
|
@ -55,7 +55,7 @@ impl RenderGraph {
|
|||
let node_id = self.get_node_id(&label)?;
|
||||
self.nodes
|
||||
.get(&node_id)
|
||||
.ok_or_else(|| RenderGraphError::InvalidNode(label))
|
||||
.ok_or(RenderGraphError::InvalidNode(label))
|
||||
}
|
||||
|
||||
pub fn get_node_state_mut(
|
||||
|
@ -66,7 +66,7 @@ impl RenderGraph {
|
|||
let node_id = self.get_node_id(&label)?;
|
||||
self.nodes
|
||||
.get_mut(&node_id)
|
||||
.ok_or_else(|| RenderGraphError::InvalidNode(label))
|
||||
.ok_or(RenderGraphError::InvalidNode(label))
|
||||
}
|
||||
|
||||
pub fn get_node_id(&self, label: impl Into<NodeLabel>) -> Result<NodeId, RenderGraphError> {
|
||||
|
@ -77,7 +77,7 @@ impl RenderGraph {
|
|||
.node_names
|
||||
.get(name)
|
||||
.cloned()
|
||||
.ok_or_else(|| RenderGraphError::InvalidNode(label)),
|
||||
.ok_or(RenderGraphError::InvalidNode(label)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ impl Edges {
|
|||
false
|
||||
}
|
||||
})
|
||||
.ok_or_else(|| RenderGraphError::UnconnectedNodeInputSlot {
|
||||
.ok_or(RenderGraphError::UnconnectedNodeInputSlot {
|
||||
input_slot: index,
|
||||
node: self.id,
|
||||
})
|
||||
|
@ -97,7 +97,7 @@ impl Edges {
|
|||
false
|
||||
}
|
||||
})
|
||||
.ok_or_else(|| RenderGraphError::UnconnectedNodeOutputSlot {
|
||||
.ok_or(RenderGraphError::UnconnectedNodeOutputSlot {
|
||||
output_slot: index,
|
||||
node: self.id,
|
||||
})
|
||||
|
|
|
@ -59,7 +59,7 @@ impl ResourceSlots {
|
|||
let index = self.get_slot_index(&label)?;
|
||||
self.slots
|
||||
.get(index)
|
||||
.ok_or_else(|| RenderGraphError::InvalidNodeSlot(label))
|
||||
.ok_or(RenderGraphError::InvalidNodeSlot(label))
|
||||
}
|
||||
|
||||
pub fn get_slot_mut(
|
||||
|
@ -70,7 +70,7 @@ impl ResourceSlots {
|
|||
let index = self.get_slot_index(&label)?;
|
||||
self.slots
|
||||
.get_mut(index)
|
||||
.ok_or_else(|| RenderGraphError::InvalidNodeSlot(label))
|
||||
.ok_or(RenderGraphError::InvalidNodeSlot(label))
|
||||
}
|
||||
|
||||
pub fn get_slot_index(&self, label: impl Into<SlotLabel>) -> Result<usize, RenderGraphError> {
|
||||
|
@ -83,7 +83,7 @@ impl ResourceSlots {
|
|||
.enumerate()
|
||||
.find(|(_i, s)| s.info.name == *name)
|
||||
.map(|(i, _s)| i)
|
||||
.ok_or_else(|| RenderGraphError::InvalidNodeSlot(label)),
|
||||
.ok_or(RenderGraphError::InvalidNodeSlot(label)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
};
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_ecs::{HecsQuery, ReadOnlyFetch, Resources, World};
|
||||
use std::marker::PhantomData;
|
||||
use std::{marker::PhantomData, ops::Deref};
|
||||
|
||||
struct CameraInfo {
|
||||
name: String,
|
||||
|
@ -281,7 +281,7 @@ where
|
|||
*bind_group,
|
||||
dynamic_uniform_indices
|
||||
.as_ref()
|
||||
.map(|indices| indices.as_slice()),
|
||||
.map(|indices| indices.deref()),
|
||||
);
|
||||
draw_state.set_bind_group(*index, *bind_group);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ pub struct IndexedBindGroupEntry {
|
|||
#[derive(Clone, Eq, PartialEq, Debug)]
|
||||
pub struct BindGroup {
|
||||
pub id: BindGroupId,
|
||||
pub indexed_bindings: Arc<Vec<IndexedBindGroupEntry>>,
|
||||
pub dynamic_uniform_indices: Option<Arc<Vec<u32>>>,
|
||||
pub indexed_bindings: Arc<[IndexedBindGroupEntry]>,
|
||||
pub dynamic_uniform_indices: Option<Arc<[u32]>>,
|
||||
}
|
||||
|
||||
impl BindGroup {
|
||||
|
@ -94,11 +94,11 @@ impl BindGroupBuilder {
|
|||
self.indexed_bindings.sort_by_key(|i| i.index);
|
||||
BindGroup {
|
||||
id: BindGroupId(self.hasher.finish()),
|
||||
indexed_bindings: Arc::new(self.indexed_bindings),
|
||||
indexed_bindings: self.indexed_bindings.into(),
|
||||
dynamic_uniform_indices: if self.dynamic_uniform_indices.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Arc::new(self.dynamic_uniform_indices))
|
||||
Some(self.dynamic_uniform_indices.into())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl SceneSpawner {
|
|||
let scenes = resources.get::<Assets<Scene>>().unwrap();
|
||||
let scene = scenes
|
||||
.get(&scene_handle)
|
||||
.ok_or_else(|| SceneSpawnError::NonExistentScene {
|
||||
.ok_or(SceneSpawnError::NonExistentScene {
|
||||
handle: scene_handle,
|
||||
})?;
|
||||
|
||||
|
@ -108,7 +108,7 @@ impl SceneSpawner {
|
|||
for component in scene_entity.components.iter() {
|
||||
let component_registration = component_registry
|
||||
.get_with_name(&component.type_name)
|
||||
.ok_or_else(|| SceneSpawnError::UnregisteredComponent {
|
||||
.ok_or(SceneSpawnError::UnregisteredComponent {
|
||||
type_name: component.type_name.to_string(),
|
||||
})?;
|
||||
if world.has_component_type(entity, component_registration.ty) {
|
||||
|
|
Loading…
Reference in a new issue