mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
clippy & fmt
This commit is contained in:
parent
1748b5e76f
commit
d743293e56
@ -391,16 +391,14 @@ impl LocalizationGuard {
|
||||
fn get_content_for_lang(lang: &Language, content: &Content) -> Result<String, String> {
|
||||
match content {
|
||||
Content::Plain(text) => Ok(text.clone()),
|
||||
Content::Key(key) => {
|
||||
lang.try_msg(key, None)
|
||||
.map(Cow::into_owned)
|
||||
.ok_or_else(|| format!("{key}"))
|
||||
},
|
||||
Content::Attr(key, attr) => {
|
||||
lang.try_attr(key, attr, None)
|
||||
.map(Cow::into_owned)
|
||||
.ok_or_else(|| format!("{key}.{attr}"))
|
||||
},
|
||||
Content::Key(key) => lang
|
||||
.try_msg(key, None)
|
||||
.map(Cow::into_owned)
|
||||
.ok_or_else(|| key.to_string()),
|
||||
Content::Attr(key, attr) => lang
|
||||
.try_attr(key, attr, None)
|
||||
.map(Cow::into_owned)
|
||||
.ok_or_else(|| format!("{key}.{attr}")),
|
||||
Content::Localized { key, seed, args } => {
|
||||
// flag to detect failure down the chain
|
||||
let mut is_arg_failure = false;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![allow(deprecated)] // since item i18n
|
||||
|
||||
use clap::Parser;
|
||||
use std::{
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(deprecated)] // since item i18n
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![allow(clippy::expect_fun_call)] //TODO: evaluate to remove this and use `unwrap_or_else(panic!(...))` instead
|
||||
|
||||
|
@ -119,11 +119,11 @@ impl MoodContext {
|
||||
quantity: _,
|
||||
} => {
|
||||
// format!("I need {} {}!", quantity, item.name())
|
||||
format!("I need some item, not just any item!")
|
||||
"I need some item, not just any item!".to_string()
|
||||
},
|
||||
&MoodContext::MissingItem { item: _ } => {
|
||||
// format!("Someone robbed my {}!", item.name())
|
||||
format!("Someone robbed me of my item!")
|
||||
"Someone robbed me of my item!".to_string()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -780,6 +780,7 @@ impl ItemDef {
|
||||
tags: Vec<ItemTag>,
|
||||
slots: u16,
|
||||
) -> Self {
|
||||
#[allow(deprecated)]
|
||||
Self {
|
||||
item_definition_id,
|
||||
name: "test item name".to_owned(),
|
||||
@ -794,6 +795,7 @@ impl ItemDef {
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn create_test_itemdef_from_kind(kind: ItemKind) -> Self {
|
||||
#[allow(deprecated)]
|
||||
Self {
|
||||
item_definition_id: "test.item".to_string(),
|
||||
name: "test item name".to_owned(),
|
||||
@ -1661,18 +1663,15 @@ pub fn all_items_expect() -> Vec<Item> {
|
||||
// Grab modular weapons
|
||||
let mut modular_items: Vec<Item> = primary_comp_pool
|
||||
.keys()
|
||||
.map(|(tool, mat_id)| {
|
||||
.flat_map(|(tool, mat_id)| {
|
||||
let mat = material_parse_table
|
||||
.get(mat_id)
|
||||
.expect("unexpected material ident");
|
||||
|
||||
// get all weapons without imposing additional hand restrictions
|
||||
let its = modular::generate_weapons(*tool, *mat, None)
|
||||
.expect("failure during modular weapon generation");
|
||||
|
||||
its
|
||||
modular::generate_weapons(*tool, *mat, None)
|
||||
.expect("failure during modular weapon generation")
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
|
||||
// 1. Append asset items, that should include pretty much everything,
|
||||
|
Loading…
Reference in New Issue
Block a user