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

[Merged by Bors] - Prepare for upcoming rustlang by fixing upcoming clippy warnings #6376

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/asset_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ mod test {

fn create_dir_and_file(file: impl AsRef<Path>) -> tempfile::TempDir {
let asset_dir = tempfile::tempdir().unwrap();
std::fs::write(asset_dir.path().join(file), &[]).unwrap();
std::fs::write(asset_dir.path().join(file), []).unwrap();
asset_dir
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_audio/src/audio_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn play_queued_audio_system<Source: Asset + Decodable>(
mut sinks: ResMut<Assets<AudioSink>>,
) {
if let Some(audio_sources) = audio_sources {
audio_output.try_play_queued(&*audio_sources, &mut *audio, &mut *sinks);
audio_output.try_play_queued(&*audio_sources, &mut *audio, &mut sinks);
};
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl<'a, 'b> BundleInserter<'a, 'b> {
// redundant copies
let move_result = self
.table
.move_to_superset_unchecked(result.table_row, *new_table);
.move_to_superset_unchecked(result.table_row, new_table);
let new_location = new_archetype.allocate(entity, move_result.new_row);
self.entities.meta[entity.id as usize].location = new_location;

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/world/world_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'w, T> Deref for WorldBorrowMut<'w, T> {

impl<'w, T> DerefMut for WorldBorrowMut<'w, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut *self.value
&mut self.value
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ fn load_node(
gltf_node: &gltf::Node,
world_builder: &mut WorldChildBuilder,
load_context: &mut LoadContext,
buffer_data: &[Vec<u8>],
_buffer_data: &[Vec<u8>],
targrub marked this conversation as resolved.
Show resolved Hide resolved
node_index_to_entity_map: &mut HashMap<usize, Entity>,
entity_to_skin_index_map: &mut HashMap<Entity, usize>,
active_camera_found: &mut bool,
Expand Down Expand Up @@ -893,7 +893,7 @@ fn load_node(
&child,
parent,
load_context,
buffer_data,
_buffer_data,
node_index_to_entity_map,
entity_to_skin_index_map,
active_camera_found,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_render/src/extract_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn extract_resource<R: ExtractResource>(
) {
if let Some(mut target_resource) = target_resource {
if main_resource.is_changed() {
*target_resource = R::extract_resource(&*main_resource);
*target_resource = R::extract_resource(&main_resource);
}
} else {
#[cfg(debug_assertions)]
Expand All @@ -60,6 +60,6 @@ pub fn extract_resource<R: ExtractResource>(
std::any::type_name::<R>()
);
}
commands.insert_resource(R::extract_resource(&*main_resource));
commands.insert_resource(R::extract_resource(&main_resource));
}
}
2 changes: 1 addition & 1 deletion crates/bevy_render/src/mesh/mesh/skinning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ impl From<Vec<Mat4>> for SkinnedMeshInverseBindposes {
impl Deref for SkinnedMeshInverseBindposes {
type Target = [Mat4];
fn deref(&self) -> &Self::Target {
&*self.0
&self.0
}
}
2 changes: 1 addition & 1 deletion crates/bevy_scene/src/scene_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl AssetLoader for SceneLoader {
Box::pin(async move {
let mut deserializer = ron::de::Deserializer::from_bytes(bytes)?;
let scene_deserializer = SceneDeserializer {
type_registry: &*self.type_registry.read(),
type_registry: &self.type_registry.read(),
};
let scene = scene_deserializer.deserialize(&mut deserializer)?;
load_context.set_default_asset(LoadedAsset::new(scene));
Expand Down
6 changes: 2 additions & 4 deletions crates/bevy_scene/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ impl<'a> Serialize for ComponentsSerializer<'a> {
{
let mut state = serializer.serialize_seq(Some(self.components.len()))?;
for component in self.components {
state.serialize_element(&ReflectSerializer::new(
&**component,
&*self.registry.read(),
))?;
state
.serialize_element(&ReflectSerializer::new(&**component, &self.registry.read()))?;
}
state.end()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_tasks/src/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl TaskPool {
// This is guaranteed because we drive all the futures spawned onto the Scope
// to completion in this function. However, rust has no way of knowing this so we
// transmute the lifetimes to 'env here to appease the compiler as it is unable to validate safety.
let executor: &async_executor::Executor = &*self.executor;
let executor: &async_executor::Executor = &self.executor;
let executor: &'env async_executor::Executor = unsafe { mem::transmute(executor) };
let task_scope_executor = &async_executor::Executor::default();
let task_scope_executor: &'env async_executor::Executor =
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_text/src/text2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ pub fn update_text2d_layout(
scale_factor,
text.alignment,
text_bounds,
&mut *font_atlas_set_storage,
&mut *texture_atlases,
&mut *textures,
&mut font_atlas_set_storage,
&mut texture_atlases,
&mut textures,
text_settings.as_ref(),
YAxisOrientation::BottomToTop,
) {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/flex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ pub fn flex_node_system(
let scale_factor = logical_to_physical_factor * ui_scale.scale;

if scale_factor_events.iter().next_back().is_some() || ui_scale.is_changed() {
update_changed(&mut *flex_surface, scale_factor, full_node_query);
update_changed(&mut flex_surface, scale_factor, full_node_query);
} else {
update_changed(&mut *flex_surface, scale_factor, node_query);
update_changed(&mut flex_surface, scale_factor, node_query);
}

fn update_changed<F: ReadOnlyWorldQuery>(
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ pub fn text_system(
scale_factor,
text.alignment,
node_size,
&mut *font_atlas_set_storage,
&mut *texture_atlases,
&mut *textures,
&mut font_atlas_set_storage,
&mut texture_atlases,
&mut textures,
text_settings.as_ref(),
YAxisOrientation::TopToBottom,
) {
Expand Down
2 changes: 1 addition & 1 deletion examples/games/contributors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ fn contributors() -> Result<Contributors, LoadContributorsError> {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").map_err(LoadContributorsError::Var)?;

let mut cmd = std::process::Command::new("git")
.args(&["--no-pager", "log", "--pretty=format:%an"])
.args(["--no-pager", "log", "--pretty=format:%an"])
.current_dir(manifest_dir)
.stdout(Stdio::piped())
.spawn()
Expand Down