Skip to content

Commit d3023ad

Browse files
committed
Run cargo fmt
1 parent b506dac commit d3023ad

File tree

7 files changed

+49
-34
lines changed

7 files changed

+49
-34
lines changed

noita-proxy/src/bookkeeping/mod_manager.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,15 @@ impl Mods {
450450
self.mod_entries.insert(0, entry);
451451
&mut self.mod_entries[0]
452452
} else {
453-
self.mod_entries.insert(0, ModEntry {
454-
enabled: 0,
455-
name: name.to_owned(),
456-
settings_fold_open: 0,
457-
workshop_item_id: 0,
458-
});
453+
self.mod_entries.insert(
454+
0,
455+
ModEntry {
456+
enabled: 0,
457+
name: name.to_owned(),
458+
settings_fold_open: 0,
459+
workshop_item_id: 0,
460+
},
461+
);
459462
&mut self.mod_entries[0]
460463
}
461464
}
@@ -474,4 +477,4 @@ fn enable_mod(saves_path: &Path) -> Result<(), Box<dyn Error>> {
474477
let xml = quick_xml::se::to_string(&data)?;
475478
fs::write(&mod_config_path, xml)?;
476479
Ok(())
477-
}
480+
}

noita-proxy/src/net.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl NetManager {
362362
&NetMsg::PlayerColor(
363363
self.init_settings.player_png_desc,
364364
self.is_host(),
365-
Some(self.peer.my_id())
365+
Some(self.peer.my_id()),
366366
),
367367
Reliability::Reliable,
368368
);
@@ -423,7 +423,7 @@ impl NetManager {
423423
&NetMsg::PlayerColor(
424424
self.init_settings.player_png_desc,
425425
self.is_host(),
426-
None
426+
None,
427427
),
428428
Reliability::Reliable,
429429
);
@@ -601,7 +601,10 @@ impl NetManager {
601601
rgb[0] as u32 + ((rgb[1] as u32) << 8) + ((rgb[2] as u32) << 16),
602602
);
603603

604-
state.try_ws_write_option("ping_lifetime", self.init_settings.ux_settings.ping_lifetime);
604+
state.try_ws_write_option(
605+
"ping_lifetime",
606+
self.init_settings.ux_settings.ping_lifetime,
607+
);
605608
state.try_ws_write_option("ping_scale", self.init_settings.ux_settings.ping_scale);
606609

607610
let progress = settings.progress.join(",");

noita-proxy/src/net/omni.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl PeerVariant {
9292
}
9393
}
9494
}
95-
95+
9696
pub(crate) fn flush(&self) {
9797
if let PeerVariant::Steam(p) = self {
9898
p.flush()

noita-proxy/src/net/steam_networking.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,10 @@ impl SteamPeer {
341341
for (i, p) in self.inner.lock().unwrap().remote_peers.iter().enumerate() {
342342
if *p == Into::<SteamId>::into(peer) {
343343
n = i as isize;
344-
break
344+
break;
345345
}
346346
}
347-
if n >= 0
348-
{
347+
if n >= 0 {
349348
self.inner.lock().unwrap().remote_peers.remove(n as usize);
350349
}
351350
}

noita-proxy/src/player_cosmetics.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ pub fn arrows_path(path: PathBuf, is_host: bool) -> (PathBuf, PathBuf, PathBuf)
2020
let parent = path.parent().unwrap();
2121
let p = parent.join("player_arrows");
2222
let o = parent.join("player_ping");
23-
(if is_host {
24-
p.join("arrow_host.png")
25-
} else {
26-
p.join("arrow.png")
27-
}, o.join("arrow.png"), parent.join("map/icon.png"))
23+
(
24+
if is_host {
25+
p.join("arrow_host.png")
26+
} else {
27+
p.join("arrow.png")
28+
},
29+
o.join("arrow.png"),
30+
parent.join("map/icon.png"),
31+
)
2832
}
2933

3034
pub fn cursor_path(path: PathBuf) -> PathBuf {
@@ -136,16 +140,22 @@ pub fn get_lch(color: [f64; 4]) -> (f64, f64, f64) {
136140
}
137141

138142
pub fn rgb_to_oklch(color: &mut [f64; 4]) {
139-
let mut l = 0.4122214694707629 * color[0] + 0.5363325372617349 * color[1] + 0.0514459932675022 * color[2];
140-
let mut m = 0.2119034958178251 * color[0] + 0.6806995506452344 * color[1] + 0.1073969535369405 * color[2];
141-
let mut s = 0.0883024591900564 * color[0] + 0.2817188391361215 * color[1] + 0.6299787016738222 * color[2];
143+
let mut l = 0.4122214694707629 * color[0]
144+
+ 0.5363325372617349 * color[1]
145+
+ 0.0514459932675022 * color[2];
146+
let mut m = 0.2119034958178251 * color[0]
147+
+ 0.6806995506452344 * color[1]
148+
+ 0.1073969535369405 * color[2];
149+
let mut s = 0.0883024591900564 * color[0]
150+
+ 0.2817188391361215 * color[1]
151+
+ 0.6299787016738222 * color[2];
142152

143153
l = l.cbrt();
144154
m = m.cbrt();
145155
s = s.cbrt();
146156

147-
color[0] = 0.210454268309314 * l + 0.7936177747023054 * m - 0.0040720430116193 * s;
148-
color[1] = 1.9779985324311684 * l - 2.42859224204858 * m + 0.450593709617411 * s;
157+
color[0] = 0.210454268309314 * l + 0.7936177747023054 * m - 0.0040720430116193 * s;
158+
color[1] = 1.9779985324311684 * l - 2.42859224204858 * m + 0.450593709617411 * s;
149159
color[2] = 0.0259040424655478 * l + 0.7827717124575296 * m - 0.8086757549230774 * s;
150160
}
151161

@@ -158,7 +168,7 @@ fn oklch_to_rgb(color: &mut [f64; 4]) {
158168
m = m.powi(3);
159169
s = s.powi(3);
160170

161-
color[0] = 4.07674163607596 * l - 3.3077115392580635 * m + 0.2309699031821046 * s;
171+
color[0] = 4.07674163607596 * l - 3.3077115392580635 * m + 0.2309699031821046 * s;
162172
color[1] = -1.2684379732850317 * l + 2.6097573492876887 * m - 0.3413193760026572 * s;
163173
color[2] = -0.0041960761386754 * l - 0.7034186179359363 * m + 1.7076146940746116 * s;
164174
}
@@ -400,12 +410,11 @@ pub fn create_player_png(
400410
edit_by_replacing(
401411
tmp_path.join("unmodified_lukki.xml"),
402412
tmp_path.join("tmp/".to_owned() + &id.clone() + "_lukki.xml"),
403-
&[
404-
(
405-
"MARKER_LUKKI_PNG",
406-
format!("mods/quant.ew/files/system/player/tmp/{}_lukki.png", id),
407-
),
408-
]);
413+
&[(
414+
"MARKER_LUKKI_PNG",
415+
format!("mods/quant.ew/files/system/player/tmp/{}_lukki.png", id),
416+
)],
417+
);
409418
edit_by_replacing(
410419
tmp_path.join("unmodified_base.xml"),
411420
tmp_path.join("tmp/".to_owned() + &id.clone() + "_base.xml"),
@@ -504,4 +513,4 @@ fn edit_by_replacing(
504513

505514
fn rgb_to_hex(rgb: [u8; 4]) -> String {
506515
format!("{:02X}{:02X}{:02X}", rgb[0], rgb[1], rgb[2])
507-
}
516+
}

noita-proxy/src/util/steam_helper.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ impl SteamState {
3939
}
4040
let app_id = env::var("NP_APPID").ok().and_then(|x| x.parse().ok());
4141
info!("Initializing steam client...");
42-
let (client, single) = steamworks::Client::init_app(app_id.unwrap_or(if spacewars {480} else {881100}))?;
42+
let (client, single) =
43+
steamworks::Client::init_app(app_id.unwrap_or(if spacewars { 480 } else { 881100 }))?;
4344
info!("Initializing relay network accesss...");
4445
client.networking_utils().init_relay_network_access();
4546
if let Err(err) = client.networking_sockets().init_authentication() {

noita-proxy/tangled/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Peer {
4949
connection_manager.start()?;
5050
Ok(Peer { shared })
5151
}
52-
52+
5353
pub fn remove(&self, peer: PeerId) {
5454
self.shared.remote_peers.remove(&peer);
5555
}

0 commit comments

Comments
 (0)