fmt after applying clippy fixes after toolchain update

This commit is contained in:
Marcel Märtens 2021-07-12 09:09:57 +02:00
parent 9b3b21f368
commit db8aedd363
17 changed files with 78 additions and 150 deletions

View File

@ -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")
}

View File

@ -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::<ItemDef>::load_cloned(name)?)
},
RawRecipeInput::Item(name) => RecipeInput::Item(Arc::<ItemDef>::load_cloned(name)?),
RawRecipeInput::Tag(tag) => RecipeInput::Tag(*tag),
};
Ok((def, spec.1))

View File

@ -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<Participant, NetworkError> {
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),

View File

@ -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]);
}

View File

@ -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,

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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))

View File

@ -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

View File

@ -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),

View File

@ -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,
}
}