mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
more clippy fixes in all binaries
This commit is contained in:
parent
631f3ab8ee
commit
cb25a409d5
@ -47,6 +47,7 @@ impl Tui {
|
||||
(Self { _handle: handle }, commands_r)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut)]
|
||||
pub fn process_command(cmd: &str, command_s: &mut async_channel::Sender<Cmd>) -> bool {
|
||||
let matches = Command::new("veloren-botclient")
|
||||
.version(common::util::DISPLAY_VERSION_LONG.as_str())
|
||||
|
@ -749,12 +749,12 @@ pub mod asset_tweak {
|
||||
|
||||
run_with_file(tweak_path, |file| {
|
||||
file.write_all(
|
||||
br#"
|
||||
br"
|
||||
((
|
||||
such: 5,
|
||||
field: 35.752346,
|
||||
))
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.expect("failed to write to the file");
|
||||
|
||||
|
@ -100,11 +100,11 @@ fn input_validated_string(prompt: &str, check: &dyn Fn(&str) -> bool) -> String
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let prompt = r#"
|
||||
let prompt = r"
|
||||
Stub implementation.
|
||||
If you want to migrate new assets, edit `v1` and `v2` modules.
|
||||
If you want to migrate old assets, check commit history.
|
||||
"#;
|
||||
";
|
||||
println!("{prompt}");
|
||||
|
||||
let old_dir = input_validated_string(
|
||||
|
@ -1185,7 +1185,7 @@ mod tests {
|
||||
init();
|
||||
info!("init");
|
||||
|
||||
let mut stock: hashbrown::HashMap<Good, f32> = vec![
|
||||
let mut stock: hashbrown::HashMap<Good, f32> = [
|
||||
(Good::Ingredients, 50.0),
|
||||
(Good::Tools, 10.0),
|
||||
(Good::Armor, 10.0),
|
||||
|
@ -141,6 +141,7 @@ pub fn create_player(state: &mut State) -> Entity {
|
||||
.build()
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut)]
|
||||
pub fn generate_chunk(state: &mut State, chunk_pos: Vec2<i32>) {
|
||||
let (x, y) = chunk_pos.map(|e| e.to_le_bytes()).into_tuple();
|
||||
let mut rng = SmallRng::from_seed([
|
||||
|
@ -861,6 +861,7 @@ mod tests {
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut)]
|
||||
async fn mock_mpsc(
|
||||
cid: Cid,
|
||||
_runtime: &Arc<Runtime>,
|
||||
|
@ -874,13 +874,13 @@ mod tests {
|
||||
#[test]
|
||||
fn parse_cmds() {
|
||||
let expected: Result<(String, Vec<String>), String> = Ok(("help".to_string(), vec![]));
|
||||
assert_eq!(parse_cmd(r#"help"#), expected);
|
||||
assert_eq!(parse_cmd(r"help"), expected);
|
||||
|
||||
let expected: Result<(String, Vec<String>), String> = Ok(("say".to_string(), vec![
|
||||
"foo".to_string(),
|
||||
"bar".to_string(),
|
||||
]));
|
||||
assert_eq!(parse_cmd(r#"say foo bar"#), expected);
|
||||
assert_eq!(parse_cmd(r"say foo bar"), expected);
|
||||
assert_eq!(parse_cmd(r#"say "foo" "bar""#), expected);
|
||||
|
||||
let expected: Result<(String, Vec<String>), String> =
|
||||
|
@ -691,7 +691,7 @@ fn main() {
|
||||
let k = 32;
|
||||
let sz = world.sim().get_size();
|
||||
|
||||
let sites = vec![
|
||||
let sites = [
|
||||
("center", sz / 2),
|
||||
(
|
||||
"dungeon",
|
||||
|
@ -11,7 +11,7 @@ fn main() {
|
||||
]);
|
||||
let mut middle = cons.clone();
|
||||
middle.extend(vec!["tt"]);
|
||||
let vowel = vec!["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let vowel = ["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let end = vec![
|
||||
"et", "ige", "age", "ist", "en", "on", "og", "end", "ind", "ock", "een", "edge", "ist",
|
||||
"ed", "est", "eed", "ast", "olt", "ey", "ean", "ead", "onk", "ink", "eon", "er", "ow",
|
||||
|
@ -198,7 +198,7 @@ fn palette(conn: Connection) -> Result<(), Box<dyn Error>> {
|
||||
let count: i64 = row.get(4)?;
|
||||
block_colors
|
||||
.entry(kind)
|
||||
.or_insert_with(Vec::new)
|
||||
.or_default()
|
||||
.push((rgb, count));
|
||||
}
|
||||
for (_, v) in block_colors.iter_mut() {
|
||||
@ -207,7 +207,7 @@ fn palette(conn: Connection) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let mut palettes: HashMap<BlockKind, Vec<Rgb<u8>>> = HashMap::new();
|
||||
for (kind, colors) in block_colors.iter() {
|
||||
let palette = palettes.entry(*kind).or_insert_with(Vec::new);
|
||||
let palette = palettes.entry(*kind).or_default();
|
||||
if colors.len() <= 256 {
|
||||
for (color, _) in colors {
|
||||
palette.push(*color);
|
||||
|
Loading…
Reference in New Issue
Block a user