Remove some warnings

This commit is contained in:
Louis Dureuil 2024-10-28 14:22:19 +01:00
parent 2a91849660
commit 1960003805
No known key found for this signature in database
5 changed files with 4 additions and 20 deletions

View File

@ -62,10 +62,6 @@ impl LocalFieldsIdsMap {
fn metadata(&self, id: FieldId) -> Option<Metadata> { fn metadata(&self, id: FieldId) -> Option<Metadata> {
self.metadata.get(&id).copied() self.metadata.get(&id).copied()
} }
fn iter(&self) -> impl Iterator<Item = (FieldId, &str, Metadata)> {
self.ids_names.iter().map(|(k, v)| (*k, v.as_str(), self.metadata.get(k).copied().unwrap()))
}
} }
impl<'indexing> GlobalFieldsIdsMap<'indexing> { impl<'indexing> GlobalFieldsIdsMap<'indexing> {

View File

@ -158,8 +158,7 @@ impl MetadataBuilder {
let localized_attributes_rule_id = self let localized_attributes_rule_id = self
.localized_attributes .localized_attributes
.iter() .iter()
.map(|v| v.iter()) .flat_map(|v| v.iter())
.flatten()
.position(|rule| rule.match_str(field)) .position(|rule| rule.match_str(field))
.map(|id| NonZeroU16::new(id.saturating_add(1).try_into().unwrap()).unwrap()); .map(|id| NonZeroU16::new(id.saturating_add(1).try_into().unwrap()).unwrap());

View File

@ -520,7 +520,7 @@ impl<'doc> ValueView for ParseableValue<'doc> {
Value::Null => ValueView::to_kstr(&LiquidValue::Nil), Value::Null => ValueView::to_kstr(&LiquidValue::Nil),
Value::Bool(v) => ValueView::to_kstr(v), Value::Bool(v) => ValueView::to_kstr(v),
Value::Number(_number) => self.render().to_string().into(), Value::Number(_number) => self.render().to_string().into(),
Value::String(s) => KStringCow::from_ref(*s), Value::String(s) => KStringCow::from_ref(s),
Value::Array(raw_vec) => ParseableArray::as_parseable(raw_vec).to_kstr(), Value::Array(raw_vec) => ParseableArray::as_parseable(raw_vec).to_kstr(),
Value::Object(raw_map) => ParseableMap::as_parseable(raw_map).to_kstr(), Value::Object(raw_map) => ParseableMap::as_parseable(raw_map).to_kstr(),
} }
@ -577,10 +577,7 @@ impl<'doc> ValueView for ParseableValue<'doc> {
fn is_scalar(&self) -> bool { fn is_scalar(&self) -> bool {
use raw_collections::Value; use raw_collections::Value;
match &self.value { matches!(&self.value, Value::Bool(_) | Value::Number(_) | Value::String(_))
Value::Bool(_) | Value::Number(_) | Value::String(_) => true,
_ => false,
}
} }
fn as_array(&self) -> Option<&dyn liquid::model::ArrayView> { fn as_array(&self) -> Option<&dyn liquid::model::ArrayView> {

View File

@ -316,11 +316,3 @@ impl<'a, 'map, D: ObjectView> fmt::Display for ArrayRender<'a, 'map, D> {
Ok(()) Ok(())
} }
} }
fn convert_index(index: i64, max_size: i64) -> i64 {
if 0 <= index {
index
} else {
max_size + index
}
}

View File

@ -128,7 +128,7 @@ impl Prompt {
let context = Context::new(&document, &fields); let context = Context::new(&document, &fields);
let mut rendered = bumpalo::collections::Vec::with_capacity_in( let mut rendered = bumpalo::collections::Vec::with_capacity_in(
self.max_bytes.unwrap_or_else(default_max_bytes).get(), self.max_bytes.unwrap_or_else(default_max_bytes).get(),
&doc_alloc, doc_alloc,
); );
self.template self.template
.render_to(&mut rendered, &context) .render_to(&mut rendered, &context)