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> {
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> {

View File

@ -158,8 +158,7 @@ impl MetadataBuilder {
let localized_attributes_rule_id = self
.localized_attributes
.iter()
.map(|v| v.iter())
.flatten()
.flat_map(|v| v.iter())
.position(|rule| rule.match_str(field))
.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::Bool(v) => ValueView::to_kstr(v),
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::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 {
use raw_collections::Value;
match &self.value {
Value::Bool(_) | Value::Number(_) | Value::String(_) => true,
_ => false,
}
matches!(&self.value, Value::Bool(_) | Value::Number(_) | Value::String(_))
}
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(())
}
}
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 mut rendered = bumpalo::collections::Vec::with_capacity_in(
self.max_bytes.unwrap_or_else(default_max_bytes).get(),
&doc_alloc,
doc_alloc,
);
self.template
.render_to(&mut rendered, &context)