Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheoni committed Dec 19, 2024
1 parent 7b8d43d commit 7c758d2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/aisle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl AisleConf<'_> {

for name in &igr.names {
let info = IngredientInfo {
name: *name,
name,
common_name,
category: cat.name,
};
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/event_consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct Locations<'i> {

const IMPLICIT_REF_WARN: &str = "The reference (&) is implicit";

impl<'i, 'c> RecipeCollector<'i, 'c> {
impl<'i> RecipeCollector<'i, '_> {
fn parse_events(mut self, mut events: impl Iterator<Item = Event<'i>>) -> AnalysisResult {
enum BlockBuffer {
Step(Vec<Item>),
Expand Down Expand Up @@ -247,7 +247,7 @@ impl<'i, 'c> RecipeCollector<'i, 'c> {
let mut to_remove = Vec::new();
for (key, value) in self.content.metadata.map.iter() {
if let Some(sk) = key.as_str().and_then(|s| StdKey::from_str(s).ok()) {
match check_std_entry(sk, value, &self.converter) {
match check_std_entry(sk, value, self.converter) {
Ok(Some(servings)) => self.content.data = servings,
Ok(None) => {}
Err(err) => {
Expand Down
2 changes: 1 addition & 1 deletion src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ impl BestConversions {
Some(Arc::clone(&converter.all_units[best_id]))
}

fn all_units<'c>(&'c self, converter: &'c Converter) -> impl Iterator<Item = &Arc<Unit>> {
fn all_units<'c>(&'c self, converter: &'c Converter) -> impl Iterator<Item = &'c Arc<Unit>> {
self.0.iter().map(|(_, uid)| &converter.all_units[*uid])
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn value_as_tags(val: &serde_yaml::Value) -> Result<Vec<&str>, MetadataError> {
let entries = if let Some(s) = val.as_str() {
s.split(',').map(|e| e.trim()).collect()
} else if let Some(seq) = val.as_sequence() {
seq.into_iter()
seq.iter()
.map(|val| val.as_str())
.collect::<Option<Vec<&str>>>()
.ok_or(MetadataError::UnexpectedType)?
Expand Down
8 changes: 4 additions & 4 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl Ingredient<Value> {
pub fn all_quantities<'a>(
&'a self,
all_ingredients: &'a [Self],
) -> impl Iterator<Item = &ScaledQuantity> {
) -> impl Iterator<Item = &'a ScaledQuantity> {
std::iter::once(self.quantity.as_ref())
.chain(
self.relation
Expand Down Expand Up @@ -332,7 +332,7 @@ impl Cookware<Value> {
}

/// Gets an iterator over all quantities of this ingredient and its references.
pub fn all_amounts<'a>(&'a self, all_cookware: &'a [Self]) -> impl Iterator<Item = &Value> {
pub fn all_amounts<'a>(&'a self, all_cookware: &'a [Self]) -> impl Iterator<Item = &'a Value> {
std::iter::once(self.quantity.as_ref())
.chain(
self.relation
Expand Down Expand Up @@ -533,9 +533,9 @@ pub struct Timer<V: QuantityValue = Value> {
/// If created from parsing the following applies:
///
/// - If the [`ADVANCED_UNITS`](crate::Extensions::ADVANCED_UNITS) extension
/// is enabled, this is guaranteed to have a time unit and a non text value.
/// is enabled, this is guaranteed to have a time unit and a non text value.
///
/// - If the [`TIMER_REQUIRES_TIME`](crate::Extensions::TIMER_REQUIRES_TIME)
/// extension is enabled, this is guaranteed to be [`Some`].
/// extension is enabled, this is guaranteed to be [`Some`].
pub quantity: Option<Quantity<V>>,
}
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ fn parse_block(block: &mut BlockParser, old_style_metadata: bool) {
let key_t = key.text_outer_trimmed();
let is_config_key = key_t.starts_with('[') && key_t.ends_with(']');
let modes_active = bp.extension(Extensions::MODES);
return (is_config_key && modes_active) || old_style_metadata;
(is_config_key && modes_active) || old_style_metadata
})
}),
T![=] => block.with_recover(section),
Expand Down
2 changes: 1 addition & 1 deletion src/parser/token_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'i> TokenStream<'i> {
}
}

impl<'i> Iterator for TokenStream<'i> {
impl Iterator for TokenStream<'_> {
type Item = Token;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl ScalableRecipe {
pub fn scale(self, target: u32, converter: &Converter) -> ScaledRecipe {
let target = if let Servings(Some(servings)) = &self.data {
let base = servings.first().copied().unwrap_or(1);
ScaleTarget::new(base, target, &servings)
ScaleTarget::new(base, target, servings)
} else {
ScaleTarget::new(1, target, &[])
};
Expand Down

0 comments on commit 7c758d2

Please sign in to comment.