mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Readability fixes for cargo clippy
This commit is contained in:
@@ -17,7 +17,7 @@ impl CustomisationData {
|
||||
(Typed::Str("skinsceneName".into()), Typed::Str(self.skin_scene_name.clone().into())),
|
||||
(Typed::Str("simulationPrefab".into()), Typed::Str(self.simulation_prefab.clone().into())),
|
||||
(Typed::Str("previewImageName".into()), Typed::Str(self.preview_image_name.clone().into())),
|
||||
(Typed::Str("isDefault".into()), Typed::Bool(self.is_default.into())),
|
||||
(Typed::Str("isDefault".into()), Typed::Bool(self.is_default)),
|
||||
].into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ impl ItemShopBundle {
|
||||
pub fn as_transmissible_vec(items: Vec<Self>) -> Typed {
|
||||
let mut buf = Vec::new();
|
||||
let mut writer = std::io::Cursor::new(&mut buf);
|
||||
writer.write(&(items.len() as i32).to_le_bytes()).unwrap();
|
||||
writer.write_all(&(items.len() as i32).to_le_bytes()).unwrap();
|
||||
for item in items.iter() {
|
||||
item.dump(&mut writer).unwrap();
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ pub struct ColourValue {
|
||||
impl ColourValue {
|
||||
fn read_no_alpha<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
|
||||
let mut buf = [0u8; 1];
|
||||
reader.read(&mut buf)?;
|
||||
reader.read_exact(&mut buf)?;
|
||||
let r = buf[0];
|
||||
reader.read(&mut buf)?;
|
||||
reader.read_exact(&mut buf)?;
|
||||
let g = buf[0];
|
||||
reader.read(&mut buf)?;
|
||||
reader.read_exact(&mut buf)?;
|
||||
let b = buf[0];
|
||||
Ok(Self {
|
||||
r, g, b, a: u8::MAX,
|
||||
@@ -39,7 +39,7 @@ impl Colour {
|
||||
let specular = ColourValue::read_no_alpha(reader)?;
|
||||
let overlay = ColourValue::read_no_alpha(reader)?;
|
||||
let mut buf = [0u8; 1];
|
||||
reader.read(&mut buf)?;
|
||||
reader.read_exact(&mut buf)?;
|
||||
let premium = buf[0] != 0;
|
||||
Ok(Self {
|
||||
index, diffuse, specular, overlay, premium,
|
||||
@@ -48,7 +48,7 @@ impl Colour {
|
||||
|
||||
pub fn read_many<R: std::io::Read>(reader: &mut R) -> std::io::Result<Vec<Self>> {
|
||||
let mut buf = [0u8; 4];
|
||||
reader.read(&mut buf)?;
|
||||
reader.read_exact(&mut buf)?;
|
||||
let count = i32::from_le_bytes(buf);
|
||||
let mut results = Vec::with_capacity(count as _);
|
||||
for i in 0..count {
|
||||
|
||||
@@ -17,7 +17,7 @@ impl PlayerRoboPassSeasonInfo {
|
||||
items: vec![
|
||||
(Typed::Str("deltaXpToShow".into()), Typed::Int(self.delta_xp_to_show)),
|
||||
(Typed::Str("grade".into()), Typed::Int(self.grade)),
|
||||
(Typed::Str("hasDeluxe".into()), Typed::Bool(self.has_deluxe.into())),
|
||||
(Typed::Str("hasDeluxe".into()), Typed::Bool(self.has_deluxe)),
|
||||
(Typed::Str("progressInGrade".into()), Typed::Float(self.progress_in_grade)),
|
||||
(Typed::Str("xpFromSeasonStart".into()), Typed::Int(self.xp_from_start)),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user