mirror of
https://gitlab.com/veloren/veloren
synced 2026-08-16 16:26:07 -04:00
cargo clippy in test
This commit is contained in:
parent
8ff47e218c
commit
5d61f74e6b
12 changed files with 31 additions and 34 deletions
|
|
@ -746,7 +746,7 @@ pub mod asset_tweak {
|
|||
{
|
||||
fn create(file: P) -> (Self, File) {
|
||||
let f = File::create(&file)
|
||||
.unwrap_or_else(|_| panic!("failed to create file {:?}", &file));
|
||||
.unwrap_or_else(|_| panic!("failed to create file {:?}", file));
|
||||
(Self { file }, f)
|
||||
}
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ pub mod asset_tweak {
|
|||
{
|
||||
fn drop(&mut self) {
|
||||
fs::remove_file(&self.file).unwrap_or_else(|e| {
|
||||
panic!("failed to remove file {:?}. Error: {:?}", &self.file, e)
|
||||
panic!("failed to remove file {:?}. Error: {:?}", self.file, e)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1134,7 +1134,7 @@ impl TradePricing {
|
|||
.fold(String::new(), |agg, i| agg + &format!("{:?}.", i.1));
|
||||
println!(
|
||||
"{:?}, {}, {:>4.2}, {}, {:?}, {}, {},",
|
||||
&item_id,
|
||||
item_id,
|
||||
if *can_sell { "yes" } else { "no" },
|
||||
pricesum,
|
||||
materials,
|
||||
|
|
|
|||
|
|
@ -634,10 +634,7 @@ pub mod tests {
|
|||
BodyBuilder::RandomWith(string) => {
|
||||
let npc::NpcBody(_body_kind, mut body_creator) =
|
||||
string.parse::<npc::NpcBody>().unwrap_or_else(|err| {
|
||||
panic!(
|
||||
"failed to parse body {:?} in {}. Err: {:?}",
|
||||
&string, config_asset, err
|
||||
)
|
||||
panic!("failed to parse body {string:?} in {config_asset:}. Err: {err:?}")
|
||||
});
|
||||
let _ = body_creator();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ impl FileInfo {
|
|||
Err(e) => {
|
||||
println!(
|
||||
"Cannot get metadata for file: {:?}, does it exist? Error: {:?}",
|
||||
&path, &e
|
||||
path, e
|
||||
);
|
||||
return None;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ impl Shared {
|
|||
println!("Disconnecting all connections");
|
||||
},
|
||||
LocalCommand::Connect(addr) => {
|
||||
println!("Trying to connect to: {:?}", &addr);
|
||||
println!("Trying to connect to: {:?}", addr);
|
||||
match client.connect(addr.clone()).await {
|
||||
Ok(p) => self.loop_participant(p).await,
|
||||
Err(e) => println!("Failed to connect to {:?}, err: {:?}", &addr, e),
|
||||
Err(e) => println!("Failed to connect to {:?}, err: {:?}", addr, e),
|
||||
}
|
||||
},
|
||||
LocalCommand::Serve(fileinfo) => {
|
||||
|
|
@ -155,7 +155,7 @@ impl Shared {
|
|||
|
||||
async fn handle_remote_cmd(&self, mut stream: Stream, remote_info: Arc<Mutex<RemoteInfo>>) {
|
||||
while let Ok(msg) = stream.recv::<Command>().await {
|
||||
println!("Got message: {:?}", &msg);
|
||||
println!("Got message: {:?}", msg);
|
||||
match msg {
|
||||
Command::List => {
|
||||
info!("Request to send my list");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ fn setup() -> Result<SocketAddr, u32> {
|
|||
return Err(1);
|
||||
}
|
||||
let a: SocketAddr = format!("{}:{}", args[1], args[2]).parse().unwrap();
|
||||
println!("You provided address: {}", &a);
|
||||
println!("You provided address: {}", a);
|
||||
Ok(a)
|
||||
}
|
||||
/// This example file is not running veloren-network at all,
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ mod tests {
|
|||
};
|
||||
|
||||
for frame in get_initframes() {
|
||||
println!("initframe: {:?}", &frame);
|
||||
println!("initframe: {:?}", frame);
|
||||
assert_eq!(Some(frame.clone()), dupl(frame));
|
||||
}
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ mod tests {
|
|||
|
||||
// compare
|
||||
for (f, fd) in frames.drain(..).zip(framesd.drain(..)) {
|
||||
println!("initframe: {:?}", &f);
|
||||
println!("initframe: {:?}", f);
|
||||
assert_eq!(Some(f), fd);
|
||||
}
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ mod tests {
|
|||
};
|
||||
|
||||
for frame in get_otframes() {
|
||||
println!("frame: {:?}", &frame);
|
||||
println!("frame: {:?}", frame);
|
||||
assert_eq!(frame.clone(), dupl(frame).expect("ERR").expect("NONE"));
|
||||
}
|
||||
}
|
||||
|
|
@ -417,7 +417,7 @@ mod tests {
|
|||
|
||||
// compare
|
||||
for (f, fd) in frames.drain(..).zip(framesd.drain(..)) {
|
||||
println!("frame: {:?}", &f);
|
||||
println!("frame: {:?}", f);
|
||||
assert_eq!(f, fd.expect("ERR").expect("NONE"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ impl BParticipant {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use core::assert_matches::assert_matches;
|
||||
use core::assert_matches;
|
||||
use network_protocol::{ProtocolMetricCache, ProtocolMetrics};
|
||||
use tokio::{
|
||||
runtime::Runtime,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(assert_matches)]
|
||||
//! How to read those tests:
|
||||
//! - in the first line we call the helper, this is only debug code. in case
|
||||
//! you want to have tracing for a special test you set set the bool = true
|
||||
|
|
@ -20,7 +19,8 @@
|
|||
//! - You sometimes see sleep(1000ms) this is used when we rely on the
|
||||
//! underlying TCP functionality, as this simulates client and server
|
||||
|
||||
use std::{assert_matches::assert_matches, sync::Arc};
|
||||
use core::assert_matches;
|
||||
use std::sync::Arc;
|
||||
use tokio::runtime::Runtime;
|
||||
use veloren_network::{Network, ParticipantError, ParticipantEvent, Pid, Promises, StreamError};
|
||||
mod helper;
|
||||
|
|
|
|||
|
|
@ -449,10 +449,9 @@ impl TutorialState {
|
|||
Interactable::Entity {
|
||||
interaction: EntityInteraction::CampfireSit,
|
||||
..
|
||||
}
|
||||
if self.earn_achievement(Achievement::FindCampfire) => {
|
||||
self.show_hint(Hint::Campfire, Duration::from_secs(1));
|
||||
},
|
||||
} if self.earn_achievement(Achievement::FindCampfire) => {
|
||||
self.show_hint(Hint::Campfire, Duration::from_secs(1));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1931,15 +1931,16 @@ impl ParticleMgr {
|
|||
);
|
||||
},
|
||||
StageSection::Action
|
||||
if repeater.timer.as_secs_f32() < TAIL_SECS => {
|
||||
self.maintain_pyroclasm_charge_particles(
|
||||
scene_data,
|
||||
interpolated.pos,
|
||||
0.9,
|
||||
z,
|
||||
r,
|
||||
);
|
||||
},
|
||||
if repeater.timer.as_secs_f32() < TAIL_SECS =>
|
||||
{
|
||||
self.maintain_pyroclasm_charge_particles(
|
||||
scene_data,
|
||||
interpolated.pos,
|
||||
0.9,
|
||||
z,
|
||||
r,
|
||||
);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -288,8 +288,8 @@ fn palette(conn: Connection) -> Result<(), Box<dyn Error>> {
|
|||
let count: i64 = row.get(4)?;
|
||||
block_colors.entry(kind).or_default().push((rgb, count));
|
||||
}
|
||||
for (_, v) in block_colors.iter_mut() {
|
||||
v.sort_by(|a, b| b.1.cmp(&a.1));
|
||||
for v in block_colors.values_mut() {
|
||||
v.sort_by_key(|b| std::cmp::Reverse(b.1));
|
||||
}
|
||||
|
||||
let mut palettes: HashMap<BlockKind, Vec<KiddoRgb>> = HashMap::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue