From f1e1fd72afb99a6dcf619bc3d53636ecdf10aba4 Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 19 Nov 2023 00:33:33 -0700 Subject: [PATCH] clippystuff --- src/entity/src/character.rs | 1 - src/items/src/state.rs | 4 ++-- src/location/src/lib.rs | 4 ++-- src/login_server/src/character.rs | 8 ++++---- src/pktbuilder/src/character.rs | 4 ++-- src/shops/src/tool.rs | 3 --- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/entity/src/character.rs b/src/entity/src/character.rs index 14d13e6..e58cef5 100644 --- a/src/entity/src/character.rs +++ b/src/entity/src/character.rs @@ -1,4 +1,3 @@ -use std::convert::{From, Into}; use std::collections::HashMap; use serde::{Serialize, Deserialize}; diff --git a/src/items/src/state.rs b/src/items/src/state.rs index aa27143..ac17f0f 100644 --- a/src/items/src/state.rs +++ b/src/items/src/state.rs @@ -240,7 +240,7 @@ impl ItemState { item_id: ClientItemId(0), item: InventoryItemDetail::Stacked(StackedItemDetail { entity_ids: items.iter().map(|i| i.id).collect(), - tool: items.get(0) + tool: items.first() .ok_or_else(|| ItemStateError::StackedItemError(items.clone()))? .item .clone() @@ -284,7 +284,7 @@ impl ItemState { BankItemEntity::Stacked(items) => { BankItemDetail::Stacked(StackedItemDetail { entity_ids: items.iter().map(|i| i.id).collect(), - tool: items.get(0) + tool: items.first() .ok_or_else(|| ItemStateError::StackedItemError(items.clone()))? .item .clone() diff --git a/src/location/src/lib.rs b/src/location/src/lib.rs index 3dd0b2b..3a5c071 100644 --- a/src/location/src/lib.rs +++ b/src/location/src/lib.rs @@ -317,7 +317,7 @@ impl ClientLocation { .flatten() .collect::>(); r.sort_by_key(|k| k.time_join); - let c = r.get(0) + let c = r.first() .ok_or(GetLeaderError::NoClientInArea)?; Ok(**c) } @@ -332,7 +332,7 @@ impl ClientLocation { .flatten() .collect::>(); l.sort_by_key(|k| k.time_join); - let c = l.get(0).ok_or(GetLeaderError::NoClientInArea)?; + let c = l.first().ok_or(GetLeaderError::NoClientInArea)?; Ok(**c) } diff --git a/src/login_server/src/character.rs b/src/login_server/src/character.rs index a5cbc3b..30cf4af 100644 --- a/src/login_server/src/character.rs +++ b/src/login_server/src/character.rs @@ -754,8 +754,8 @@ fn new_character_from_preview(user: &UserAccountEntity, preview: &CharacterPrevi let mut character = NewCharacterEntity::new(user.id); character.slot = preview.slot; character.name = String::from_utf16_lossy(&preview.character.name).trim_matches(char::from(0)).into(); - character.section_id = preview.character.section_id.into(); - character.char_class = preview.character.ch_class.into(); + character.section_id = preview.character.section_id; + character.char_class = preview.character.ch_class; character.appearance.costume = preview.character.costume; character.appearance.skin = preview.character.skin; character.appearance.face = preview.character.face; @@ -810,8 +810,8 @@ impl<'a> SelectScreenCharacterBuilder<'a> { //model: character.model, //_unused: [0; 15], //name_color_checksum: character.name_color_checksum, - section_id: character.section_id.into(), - ch_class: character.char_class.into(), + section_id: character.section_id, + ch_class: character.char_class, //v2flags: character.v2flags, //version: character.version, //v1flags: character.v1flags, diff --git a/src/pktbuilder/src/character.rs b/src/pktbuilder/src/character.rs index 1052af6..92fc999 100644 --- a/src/pktbuilder/src/character.rs +++ b/src/pktbuilder/src/character.rs @@ -62,8 +62,8 @@ impl<'a> CharacterBytesBuilder<'a> { ata: stats.ata, lck: stats.lck + character.materials.luck as u16 * 2, level, - section_id: character.section_id.into(), - ch_class: character.char_class.into(), + section_id: character.section_id, + ch_class: character.char_class, costume: character.appearance.costume, skin: character.appearance.skin, face: character.appearance.face, diff --git a/src/shops/src/tool.rs b/src/shops/src/tool.rs index b068d19..b51ab8d 100644 --- a/src/shops/src/tool.rs +++ b/src/shops/src/tool.rs @@ -231,9 +231,6 @@ impl ToolShop { else { let mut techs = Vec::new(); let tier = tier.techs.iter() - .map(|(tech, entry)| { - (tech, entry) - }) .collect::>(); let tech_choice = WeightedIndex::new(tier.iter().map(|(_, e)| e.probability)).unwrap();