summaryrefslogtreecommitdiff
path: root/server/common/src/grit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/common/src/grit.rs')
-rw-r--r--server/common/src/grit.rs48
1 files changed, 24 insertions, 24 deletions
diff --git a/server/common/src/grit.rs b/server/common/src/grit.rs
index 9d01dac..4a71ade 100644
--- a/server/common/src/grit.rs
+++ b/server/common/src/grit.rs
@@ -137,7 +137,7 @@ pub struct TranslationUnit {
pub target: Vec<TextPlaceholder>,
}
-fn get_opt_attribute<'a>(attributes: &'a Vec<OwnedAttribute>, name: &str) -> Option<&'a str> {
+fn get_opt_attribute<'a>(attributes: &'a [OwnedAttribute], name: &str) -> Option<&'a str> {
for attribute in attributes {
if attribute.name.local_name == name {
return Some(attribute.value.as_str());
@@ -146,12 +146,12 @@ fn get_opt_attribute<'a>(attributes: &'a Vec<OwnedAttribute>, name: &str) -> Opt
None
}
-fn get_attribute<'a>(attributes: &'a Vec<OwnedAttribute>, name: &str) -> anyhow::Result<&'a str> {
+fn get_attribute<'a>(attributes: &'a [OwnedAttribute], name: &str) -> anyhow::Result<&'a str> {
get_opt_attribute(attributes, name).ok_or(Error::msg(format!("Expected attribute {name}")))
}
fn parse_grit_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Grit> {
let current_release = get_attribute(attributes, "current_release")?.parse::<u32>()?;
@@ -215,7 +215,7 @@ fn parse_grit_element<R: Read>(
}
fn parse_outputs_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Outputs> {
let mut output = Vec::<IfOutput>::new();
@@ -264,7 +264,7 @@ fn parse_outputs_element<R: Read>(
}
fn parse_output_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Output> {
let filename = get_attribute(attributes, "filename")?;
@@ -311,7 +311,7 @@ fn parse_output_element<R: Read>(
}
fn parse_if_output_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<IfOutput> {
let expr = get_attribute(attributes, "expr")?;
@@ -364,7 +364,7 @@ fn parse_if_output_element<R: Read>(
}
fn parse_translations_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Translations> {
let mut file = Vec::<IfFile>::new();
@@ -413,7 +413,7 @@ fn parse_translations_element<R: Read>(
}
fn parse_file_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<File> {
let path = get_attribute(attributes, "path")?;
@@ -458,7 +458,7 @@ fn parse_file_element<R: Read>(
}
fn parse_if_file_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<IfFile> {
let expr = get_attribute(attributes, "expr")?;
@@ -511,7 +511,7 @@ fn parse_if_file_element<R: Read>(
}
fn parse_release_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Release> {
let allow_pseudo = get_attribute(attributes, "allow_pseudo")?.parse::<bool>()?;
@@ -563,7 +563,7 @@ fn parse_release_element<R: Read>(
}
fn parse_messages_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Messages> {
let fallback_to_english = get_attribute(attributes, "fallback_to_english")?.parse::<bool>()?;
@@ -623,7 +623,7 @@ fn parse_messages_element<R: Read>(
}
fn parse_message_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Message> {
let desc = get_attribute(attributes, "desc")?;
@@ -703,7 +703,7 @@ fn parse_message_element<R: Read>(
}
fn parse_if_message_part_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<IfMessagePart> {
let expr = get_attribute(attributes, "expr")?;
@@ -763,7 +763,7 @@ fn parse_if_message_part_element<R: Read>(
}
fn parse_if_message_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<IfMessage> {
let expr = get_attribute(attributes, "expr")?;
@@ -820,7 +820,7 @@ fn parse_if_message_element<R: Read>(
}
fn parse_part_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<IfMessagePart> {
let file = get_attribute(attributes, "file")?;
@@ -864,7 +864,7 @@ fn parse_part_element<R: Read>(
}
fn parse_placeholder_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<TextPlaceholder> {
let name = get_attribute(attributes, "name")?;
@@ -925,7 +925,7 @@ fn parse_placeholder_element<R: Read>(
}
fn parse_placeholder_example_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<String> {
let mut content = String::new();
@@ -965,7 +965,7 @@ fn parse_placeholder_example_element<R: Read>(
}
fn parse_grit_part_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<GritPart> {
let mut messages = Vec::<IfMessage>::new();
@@ -1247,7 +1247,7 @@ pub fn get_message_id(message: &Message) -> i64 {
}
fn parse_translation_unit_target_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Vec<TextPlaceholder>> {
let mut content = Vec::<TextPlaceholder>::new();
@@ -1316,7 +1316,7 @@ fn parse_translation_unit_target_element<R: Read>(
}
fn parse_translation_placeholder_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<TextPlaceholder> {
let id = get_attribute(attributes, "id")?;
@@ -1358,7 +1358,7 @@ fn parse_translation_placeholder_element<R: Read>(
}
fn parse_translation_unit_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<TranslationUnit> {
let id = get_attribute(attributes, "id")?.parse::<i64>()?;
@@ -1409,7 +1409,7 @@ fn parse_translation_unit_element<R: Read>(
}
fn parse_translation_body_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<Vec<TranslationUnit>> {
let mut units = Vec::<TranslationUnit>::new();
@@ -1452,7 +1452,7 @@ fn parse_translation_body_element<R: Read>(
}
fn parse_translation_file_element<R: Read>(
- attributes: &Vec<OwnedAttribute>,
+ attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<TranslationFile> {
let target_language = get_attribute(attributes, "target-language")?;
@@ -1503,7 +1503,7 @@ fn parse_translation_file_element<R: Read>(
}
fn parse_xliff_element<R: Read>(
- _attributes: &Vec<OwnedAttribute>,
+ _attributes: &[OwnedAttribute],
reader: &mut EventReader<R>,
) -> anyhow::Result<TranslationFile> {
let mut file = VecDeque::<TranslationFile>::new();