Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github actions: use stable clippy #577

Merged
merged 1 commit into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions crates/bevy_audio/src/audio_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(),
})
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/src/render_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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> {
Expand All @@ -77,7 +77,7 @@ impl RenderGraph {
.node_names
.get(name)
.cloned()
.ok_or_else(|| RenderGraphError::InvalidNode(label)),
.ok_or(RenderGraphError::InvalidNode(label)),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_render/src/render_graph/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Edges {
false
}
})
.ok_or_else(|| RenderGraphError::UnconnectedNodeInputSlot {
.ok_or(RenderGraphError::UnconnectedNodeInputSlot {
input_slot: index,
node: self.id,
})
Expand All @@ -97,7 +97,7 @@ impl Edges {
false
}
})
.ok_or_else(|| RenderGraphError::UnconnectedNodeOutputSlot {
.ok_or(RenderGraphError::UnconnectedNodeOutputSlot {
output_slot: index,
node: self.id,
})
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/src/render_graph/node_slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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> {
Expand All @@ -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)),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_render/src/render_graph/nodes/pass_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_render/src/renderer/render_resource/bind_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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())
},
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_scene/src/scene_spawner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})?;

Expand All @@ -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) {
Expand Down