From db8aedd363f3b4b95fc1039685c56145f603def3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Mon, 12 Jul 2021 09:09:57 +0200 Subject: [PATCH] fmt after applying clippy fixes after toolchain update --- common/src/comp/inventory/item/mod.rs | 3 +- common/src/recipe.rs | 4 +- network/src/api.rs | 8 ++- network/src/metrics.rs | 4 +- server/src/sys/agent.rs | 30 +++------- voxygen/src/hud/bag.rs | 11 +--- voxygen/src/hud/chat.rs | 3 +- voxygen/src/hud/crafting.rs | 3 +- voxygen/src/hud/diary.rs | 18 ++---- voxygen/src/hud/settings_window/chat.rs | 6 +- voxygen/src/hud/settings_window/gameplay.rs | 36 ++++------- voxygen/src/hud/settings_window/interface.rs | 18 ++---- voxygen/src/hud/settings_window/sound.rs | 6 +- voxygen/src/hud/settings_window/video.rs | 63 +++++++------------- voxygen/src/hud/trade.rs | 4 +- voxygen/src/scene/figure/mod.rs | 4 +- voxygen/src/ui/graphic/mod.rs | 7 +-- 17 files changed, 78 insertions(+), 150 deletions(-) diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 22f6d0af04..41863f52be 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -781,8 +781,7 @@ impl Item { pub fn slots_mut(&mut self) -> &mut [InvSlot] { &mut self.slots } pub fn item_config_expect(&self) -> &ItemConfig { - self - .item_config + self.item_config .as_ref() .expect("Item was expected to have an ItemConfig") } diff --git a/common/src/recipe.rs b/common/src/recipe.rs index 86726d701a..8130e52ea0 100644 --- a/common/src/recipe.rs +++ b/common/src/recipe.rs @@ -124,9 +124,7 @@ impl assets::Compound for RecipeBook { spec: &(RawRecipeInput, u32), ) -> Result<(RecipeInput, u32), assets::Error> { let def = match &spec.0 { - RawRecipeInput::Item(name) => { - RecipeInput::Item(Arc::::load_cloned(name)?) - }, + RawRecipeInput::Item(name) => RecipeInput::Item(Arc::::load_cloned(name)?), RawRecipeInput::Tag(tag) => RecipeInput::Tag(*tag), }; Ok((def, spec.1)) diff --git a/network/src/api.rs b/network/src/api.rs index ea72c3d841..8a2b0dc09b 100644 --- a/network/src/api.rs +++ b/network/src/api.rs @@ -443,7 +443,13 @@ impl Network { /// [`ListenAddr`]: crate::api::ListenAddr #[instrument(name="network", skip(self), fields(p = %self.local_pid))] pub async fn connected(&self) -> Result { - let participant = self.connected_receiver.lock().await.recv().await.ok_or(NetworkError::NetworkClosed)?; + let participant = self + .connected_receiver + .lock() + .await + .recv() + .await + .ok_or(NetworkError::NetworkClosed)?; self.participant_disconnect_sender.lock().await.insert( participant.remote_pid, Arc::clone(&participant.a2s_disconnect_s), diff --git a/network/src/metrics.rs b/network/src/metrics.rs index 23f986fe20..3e160667fd 100644 --- a/network/src/metrics.rs +++ b/network/src/metrics.rs @@ -237,9 +237,7 @@ impl NetworkMetrics { let _ = self .channels_disconnected_total .remove_label_values(&[remote_p]); - let _ = self - .participants_bandwidth - .remove_label_values(&[remote_p]); + let _ = self.participants_bandwidth.remove_label_values(&[remote_p]); let _ = self.streams_opened_total.remove_label_values(&[remote_p]); let _ = self.streams_closed_total.remove_label_values(&[remote_p]); } diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 089eccbce6..f59609ee96 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -1820,13 +1820,9 @@ impl<'a> AgentData<'a> { Tactic::Sceptre => { self.handle_sceptre_attack(agent, controller, &attack_data, tgt_data, read_data) }, - Tactic::StoneGolem => self.handle_stone_golem_attack( - agent, - controller, - &attack_data, - tgt_data, - read_data, - ), + Tactic::StoneGolem => { + self.handle_stone_golem_attack(agent, controller, &attack_data, tgt_data, read_data) + }, Tactic::CircleCharge { radius, circle_time, @@ -1905,13 +1901,9 @@ impl<'a> AgentData<'a> { read_data, ), Tactic::Tornado => self.handle_tornado_attack(controller), - Tactic::Mindflayer => self.handle_mindflayer_attack( - agent, - controller, - &attack_data, - tgt_data, - read_data, - ), + Tactic::Mindflayer => { + self.handle_mindflayer_attack(agent, controller, &attack_data, tgt_data, read_data) + }, Tactic::BirdLargeFire => self.handle_birdlarge_fire_attack( agent, controller, @@ -1937,13 +1929,9 @@ impl<'a> AgentData<'a> { Tactic::Minotaur => { self.handle_minotaur_attack(agent, controller, &attack_data, tgt_data, read_data) }, - Tactic::ClayGolem => self.handle_clay_golem_attack( - agent, - controller, - &attack_data, - tgt_data, - read_data, - ), + Tactic::ClayGolem => { + self.handle_clay_golem_attack(agent, controller, &attack_data, tgt_data, read_data) + }, Tactic::TidalWarrior => self.handle_tidal_warrior_attack( agent, controller, diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 83ee78ee81..8c4dadecfd 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -767,14 +767,9 @@ impl<'a> Widget for Bag<'a> { .resize(STATS.len(), &mut ui.widget_id_generator()) }); // Stats - let combat_rating = combat_rating( - inventory, - self.health, - self.skill_set, - *self.body, - self.msm, - ) - .min(999.9); + let combat_rating = + combat_rating(inventory, self.health, self.skill_set, *self.body, self.msm) + .min(999.9); let indicator_col = cr_color(combat_rating); for i in STATS.iter().copied().enumerate() { let btn = Button::image(match i.1 { diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 7340fabb72..c76b1d496e 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -601,8 +601,7 @@ impl<'a> Widget for Chat<'a> { .set(state.ids.chat_tab_tooltip_bg, ui); Text::new( - self - .localized_strings + self.localized_strings .get("hud.chat.chat_tab_hover_tooltip"), ) .mid_top_with_margin_on(state.ids.chat_tab_tooltip_bg, 3.0) diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index 01f85d4556..5b9135490c 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -684,8 +684,7 @@ impl<'a> Widget for Crafting<'a> { // Crafting Station Info if recipe.craft_sprite.is_some() { Text::new( - self - .localized_strings + self.localized_strings .get("hud.crafting.req_crafting_station"), ) .top_left_with_margins_on(state.ids.align_ing, 10.0, 5.0) diff --git a/voxygen/src/hud/diary.rs b/voxygen/src/hud/diary.rs index bcc6ffcda9..74f04ff778 100644 --- a/voxygen/src/hud/diary.rs +++ b/voxygen/src/hud/diary.rs @@ -1132,8 +1132,7 @@ impl<'a> Widget for Diary<'a> { .mid_top_with_margin_on(state.skills_top_l[0], 3.0) .with_tooltip( self.tooltip_manager, - self - .localized_strings + self.localized_strings .get("hud.skill.axe_double_strike_title"), self.localized_strings.get("hud.skill.axe_double_strike"), &diary_tooltip, @@ -1316,8 +1315,7 @@ impl<'a> Widget for Diary<'a> { .mid_top_with_margin_on(state.skills_top_l[0], 3.0) .with_tooltip( self.tooltip_manager, - self - .localized_strings + self.localized_strings .get("hud.skill.hmr_single_strike_title"), self.localized_strings.get("hud.skill.hmr_single_strike"), &diary_tooltip, @@ -1370,8 +1368,7 @@ impl<'a> Widget for Diary<'a> { .mid_top_with_margin_on(state.skills_top_r[0], 3.0) .with_tooltip( self.tooltip_manager, - self - .localized_strings + self.localized_strings .get("hud.skill.hmr_charged_melee_title"), self.localized_strings.get("hud.skill.hmr_charged_melee"), &diary_tooltip, @@ -1726,8 +1723,7 @@ impl<'a> Widget for Diary<'a> { .mid_top_with_margin_on(state.skills_top_r[0], 3.0) .with_tooltip( self.tooltip_manager, - self - .localized_strings + self.localized_strings .get("hud.skill.st_flamethrower_title"), self.localized_strings.get("hud.skill.st_flamethrower"), &diary_tooltip, @@ -2183,12 +2179,10 @@ impl<'a> Diary<'a> { ) .with_tooltip( self.tooltip_manager, - self - .localized_strings + self.localized_strings .get(&format!("hud.skill.{}_title", skill_key)), &format_skill_description( - self - .localized_strings + self.localized_strings .get(&format!("hud.skill.{}", skill_key)), skill, self.skill_set, diff --git a/voxygen/src/hud/settings_window/chat.rs b/voxygen/src/hud/settings_window/chat.rs index a224c901a7..8c5b3ba816 100644 --- a/voxygen/src/hud/settings_window/chat.rs +++ b/voxygen/src/hud/settings_window/chat.rs @@ -150,8 +150,7 @@ impl<'a> Widget for Chat<'a> { // Chat Transp Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.background_transparency"), ) .down_from(state.ids.general_txt, 20.0) @@ -178,8 +177,7 @@ impl<'a> Widget for Chat<'a> { // "Show character names in chat" toggle button Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.chat_character_name"), ) .down_from(state.ids.transp_slider, 10.0) diff --git a/voxygen/src/hud/settings_window/gameplay.rs b/voxygen/src/hud/settings_window/gameplay.rs index 7ce83d824f..137a21976a 100644 --- a/voxygen/src/hud/settings_window/gameplay.rs +++ b/voxygen/src/hud/settings_window/gameplay.rs @@ -188,8 +188,7 @@ impl<'a> Widget for Gameplay<'a> { // Camera clamp angle Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.camera_clamp_angle"), ) .down_from(state.ids.mouse_zoom_slider, 10.0) @@ -241,8 +240,7 @@ impl<'a> Widget for Gameplay<'a> { } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.invert_scroll_zoom"), ) .right_from(state.ids.mouse_zoom_invert_button, 10.0) @@ -271,8 +269,7 @@ impl<'a> Widget for Gameplay<'a> { } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.invert_mouse_y_axis"), ) .right_from(state.ids.mouse_y_invert_button, 10.0) @@ -301,8 +298,7 @@ impl<'a> Widget for Gameplay<'a> { } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.invert_controller_y_axis"), ) .right_from(state.ids.controller_y_invert_button, 10.0) @@ -331,8 +327,7 @@ impl<'a> Widget for Gameplay<'a> { } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.enable_mouse_smoothing"), ) .right_from(state.ids.smooth_pan_toggle_button, 10.0) @@ -344,8 +339,7 @@ impl<'a> Widget for Gameplay<'a> { // Free look behaviour Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.free_look_behavior"), ) .down_from(state.ids.mouse_zoom_invert_button, 10.0) @@ -355,11 +349,9 @@ impl<'a> Widget for Gameplay<'a> { .set(state.ids.free_look_behavior_text, ui); let mode_label_list = [ - self - .localized_strings + self.localized_strings .get("hud.settings.press_behavior.toggle"), - self - .localized_strings + self.localized_strings .get("hud.settings.press_behavior.hold"), ]; @@ -383,8 +375,7 @@ impl<'a> Widget for Gameplay<'a> { // Auto walk behavior Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.auto_walk_behavior"), ) .down_from(state.ids.mouse_zoom_invert_button, 10.0) @@ -413,8 +404,7 @@ impl<'a> Widget for Gameplay<'a> { // Camera clamp behavior Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.camera_clamp_behavior"), ) .down_from(state.ids.free_look_behavior_list, 10.0) @@ -443,8 +433,7 @@ impl<'a> Widget for Gameplay<'a> { // Player physics behavior Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.player_physics_behavior"), ) .down_from(state.ids.auto_walk_behavior_list, 10.0) @@ -499,8 +488,7 @@ impl<'a> Widget for Gameplay<'a> { } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.stop_auto_walk_on_input"), ) .right_from(state.ids.stop_auto_walk_on_input_button, 10.0) diff --git a/voxygen/src/hud/settings_window/interface.rs b/voxygen/src/hud/settings_window/interface.rs index 5c0f0102ee..eb9949fd1a 100644 --- a/voxygen/src/hud/settings_window/interface.rs +++ b/voxygen/src/hud/settings_window/interface.rs @@ -690,8 +690,7 @@ impl<'a> Widget for Interface<'a> { */ // SCT/ Scrolling Combat Text Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.scrolling_combat_text"), ) .top_left_with_margins_on(state.ids.window_r, 5.0, 5.0) @@ -715,8 +714,7 @@ impl<'a> Widget for Interface<'a> { events.push(Sct(!self.global_state.settings.interface.sct)) } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.scrolling_combat_text"), ) .right_from(state.ids.sct_show_radio, 10.0) @@ -739,8 +737,7 @@ impl<'a> Widget for Interface<'a> { .set(state.ids.sct_single_dmg_radio, ui); Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.single_damage_number"), ) .right_from(state.ids.sct_single_dmg_radio, 10.0) @@ -810,8 +807,7 @@ impl<'a> Widget for Interface<'a> { )) } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.cumulated_incoming_damage"), ) .right_from(state.ids.sct_batch_inc_radio, 10.0) @@ -852,8 +848,7 @@ impl<'a> Widget for Interface<'a> { events.push(SpeechBubbleDarkMode(speech_bubble_dark_mode)); } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.speech_bubble_dark_mode"), ) .right_from(state.ids.speech_bubble_dark_mode_button, 10.0) @@ -876,8 +871,7 @@ impl<'a> Widget for Interface<'a> { events.push(SpeechBubbleIcon(speech_bubble_icon)); } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.speech_bubble_icon"), ) .right_from(state.ids.speech_bubble_icon_button, 10.0) diff --git a/voxygen/src/hud/settings_window/sound.rs b/voxygen/src/hud/settings_window/sound.rs index 95b843f9ac..476606fae5 100644 --- a/voxygen/src/hud/settings_window/sound.rs +++ b/voxygen/src/hud/settings_window/sound.rs @@ -137,8 +137,7 @@ impl<'a> Widget for Sound<'a> { .set(state.ids.master_volume_number, ui); // Master Volume (inactive window) ---------------------------------- Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.inactive_master_volume_perc"), ) .down_from(state.ids.master_volume_slider, 10.0) @@ -196,8 +195,7 @@ impl<'a> Widget for Sound<'a> { // SFX Volume ------------------------------------------------------- Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.sound_effect_volume"), ) .down_from(state.ids.audio_volume_slider, 10.0) diff --git a/voxygen/src/hud/settings_window/video.rs b/voxygen/src/hud/settings_window/video.rs index 5046b59354..05b0b0d1a5 100644 --- a/voxygen/src/hud/settings_window/video.rs +++ b/voxygen/src/hud/settings_window/video.rs @@ -544,8 +544,7 @@ impl<'a> Widget for Video<'a> { events.push(GraphicsChange::AdjustSpriteRenderDistance(new_val)); } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.sprites_view_distance"), ) .up_from(state.ids.sprite_dist_slider, 8.0) @@ -584,8 +583,7 @@ impl<'a> Widget for Video<'a> { events.push(GraphicsChange::AdjustFigureLoDRenderDistance(new_val)); } Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.figures_view_distance"), ) .up_from(state.ids.figure_dist_slider, 8.0) @@ -693,8 +691,7 @@ impl<'a> Widget for Video<'a> { // CloudMode Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode"), ) .down_from(state.ids.upscale_factor_list, 8.0) @@ -713,20 +710,15 @@ impl<'a> Widget for Video<'a> { ]; let mode_label_list = [ self.localized_strings.get("common.none"), - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode.minimal"), - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode.low"), - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode.medium"), - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode.high"), - self - .localized_strings + self.localized_strings .get("hud.settings.cloud_rendering_mode.ultra"), ]; @@ -749,8 +741,7 @@ impl<'a> Widget for Video<'a> { // FluidMode Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.fluid_rendering_mode"), ) .down_from(state.ids.cloud_mode_list, 8.0) @@ -761,11 +752,9 @@ impl<'a> Widget for Video<'a> { let mode_list = [FluidMode::Cheap, FluidMode::Shiny]; let mode_label_list = [ - self - .localized_strings + self.localized_strings .get("hud.settings.fluid_rendering_mode.cheap"), - self - .localized_strings + self.localized_strings .get("hud.settings.fluid_rendering_mode.shiny"), ]; @@ -788,8 +777,7 @@ impl<'a> Widget for Video<'a> { // LightingMode Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.lighting_rendering_mode"), ) .down_from(state.ids.fluid_mode_list, 8.0) @@ -804,14 +792,11 @@ impl<'a> Widget for Video<'a> { LightingMode::Lambertian, ]; let mode_label_list = [ - self - .localized_strings + self.localized_strings .get("hud.settings.lighting_rendering_mode.ashikhmin"), - self - .localized_strings + self.localized_strings .get("hud.settings.lighting_rendering_mode.blinnphong"), - self - .localized_strings + self.localized_strings .get("hud.settings.lighting_rendering_mode.lambertian"), ]; @@ -834,8 +819,7 @@ impl<'a> Widget for Video<'a> { // ShadowMode Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.shadow_rendering_mode"), ) .down_from(state.ids.lighting_mode_list, 8.0) @@ -851,14 +835,11 @@ impl<'a> Widget for Video<'a> { ShadowMode::Map(shadow_map_mode.unwrap_or_default()), ]; let mode_label_list = [ - self - .localized_strings + self.localized_strings .get("hud.settings.shadow_rendering_mode.none"), - self - .localized_strings + self.localized_strings .get("hud.settings.shadow_rendering_mode.cheap"), - self - .localized_strings + self.localized_strings .get("hud.settings.shadow_rendering_mode.map"), ]; @@ -882,8 +863,7 @@ impl<'a> Widget for Video<'a> { if let Some(shadow_map_mode) = shadow_map_mode { // Display the shadow map mode if selected. Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.shadow_rendering_mode.map.resolution"), ) .right_from(state.ids.shadow_mode_list, 10.0) @@ -975,8 +955,7 @@ impl<'a> Widget for Video<'a> { // Lossy terrain compression Text::new( - self - .localized_strings + self.localized_strings .get("hud.settings.lossy_terrain_compression"), ) .font_size(self.fonts.cyri.scale(14)) diff --git a/voxygen/src/hud/trade.rs b/voxygen/src/hud/trade.rs index e79c4e7f8e..1aa46459e9 100644 --- a/voxygen/src/hud/trade.rs +++ b/voxygen/src/hud/trade.rs @@ -566,9 +566,7 @@ impl<'a> Widget for Trade<'a> { event = self .item_pane(&mut state, ui, trade, prices, true) .or(event); - event = self - .accept_decline_buttons(&mut state, ui, trade) - .or(event); + event = self.accept_decline_buttons(&mut state, ui, trade).or(event); event = self.close_button(&mut state, ui).or(event); event diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 156eab439b..64478e0acc 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -205,9 +205,7 @@ impl FigureMgrStates { match body { Body::Humanoid(_) => self.character_states.remove(entity).map(|e| e.meta), Body::QuadrupedSmall(_) => self.quadruped_small_states.remove(entity).map(|e| e.meta), - Body::QuadrupedMedium(_) => { - self.quadruped_medium_states.remove(entity).map(|e| e.meta) - }, + Body::QuadrupedMedium(_) => self.quadruped_medium_states.remove(entity).map(|e| e.meta), Body::QuadrupedLow(_) => self.quadruped_low_states.remove(entity).map(|e| e.meta), Body::BirdMedium(_) => self.bird_medium_states.remove(entity).map(|e| e.meta), Body::FishMedium(_) => self.fish_medium_states.remove(entity).map(|e| e.meta), diff --git a/voxygen/src/ui/graphic/mod.rs b/voxygen/src/ui/graphic/mod.rs index eaf57fa3ed..e7ccb3a916 100644 --- a/voxygen/src/ui/graphic/mod.rs +++ b/voxygen/src/ui/graphic/mod.rs @@ -424,10 +424,9 @@ fn draw_graphic( ), border_color, )), - Graphic::Voxel(ref segment, trans, sample_strat) => Some(( - renderer::draw_vox(segment, dims, trans, sample_strat), - None, - )), + Graphic::Voxel(ref segment, trans, sample_strat) => { + Some((renderer::draw_vox(segment, dims, trans, sample_strat), None)) + }, Graphic::Blank => None, } }