Skip to content

Commit

Permalink
Fix clippy nits
Browse files Browse the repository at this point in the history
  • Loading branch information
reknih committed Dec 18, 2023
1 parent d8bb46d commit f1f16dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ macro_rules! deref {
///
/// Use [`XmpWriter::new`] to create a new instance and get the resulting XMP
/// metadata by calling [`XmpWriter::finish`].
#[derive(Default)]
pub struct XmpWriter<'a> {
pub(crate) buf: String,
namespaces: BTreeSet<Namespace<'a>>,
Expand All @@ -82,7 +83,7 @@ pub struct XmpWriter<'a> {
impl<'n> XmpWriter<'n> {
/// Create a new XMP writer.
pub fn new() -> XmpWriter<'n> {
Self { buf: String::new(), namespaces: BTreeSet::new() }
Self::default()
}

/// Add a custom element to the XMP metadata.
Expand Down Expand Up @@ -437,7 +438,7 @@ impl<'n> XmpWriter<'n> {
/// Start writing the `xmpMM:History` property.
///
/// A list of actions taken on the document.
pub fn history<'a>(&mut self) -> ResourceEventsWriter<'_, 'n> {
pub fn history(&mut self) -> ResourceEventsWriter<'_, 'n> {
ResourceEventsWriter::start(
self.element("History", Namespace::XmpMedia)
.array(RdfCollectionType::Seq),
Expand All @@ -447,7 +448,7 @@ impl<'n> XmpWriter<'n> {
/// Write the `xmpMM:Ingredients` property.
///
/// A list of resources that were used to create the document.
pub fn ingredients<'a>(&mut self) -> ResourceRefsWriter<'_, 'n> {
pub fn ingredients(&mut self) -> ResourceRefsWriter<'_, 'n> {
ResourceRefsWriter::start(
self.element("Ingredients", Namespace::XmpMedia)
.array(RdfCollectionType::Bag),
Expand Down
6 changes: 3 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,23 @@ impl<'a, 'n: 'a> Element<'a, 'n> {
}

/// Start writing an unordered array (`rdf:Bag`) as the property value.
pub fn unordered_array<'b>(self, items: impl IntoIterator<Item = impl XmpType>) {
pub fn unordered_array(self, items: impl IntoIterator<Item = impl XmpType>) {
let mut array = self.array(RdfCollectionType::Bag);
for item in items {
array.element().value(item);
}
}

/// Start writing an ordered array (`rdf:Seq`) as the property value.
pub fn ordered_array<'b>(self, items: impl IntoIterator<Item = impl XmpType>) {
pub fn ordered_array(self, items: impl IntoIterator<Item = impl XmpType>) {
let mut array = self.array(RdfCollectionType::Seq);
for item in items {
array.element().value(item);
}
}

/// Start writing an alternative array (`rdf:Alt`) as the property value.
pub fn alternative_array<'b>(self, items: impl IntoIterator<Item = impl XmpType>) {
pub fn alternative_array(self, items: impl IntoIterator<Item = impl XmpType>) {
let mut array = self.array(RdfCollectionType::Alt);
for item in items {
array.element().value(item);
Expand Down

0 comments on commit f1f16dc

Please sign in to comment.