Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Clippy warnings for Rust 1.79 #215

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 48 additions & 46 deletions src/tests/xmp_core_coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,84 +34,84 @@ const NS2: &str = "ns:test2/";

const RDF_COVERAGE: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kRDFCoverage' xmlns:ns1='ns:test1/' xmlns:ns2='ns:test2/'>

<ns1:SimpleProp1>Simple1 value</ns1:SimpleProp1>
<ns1:SimpleProp2 xml:lang='x-default'>Simple2 value</ns1:SimpleProp2>

<ns1:ArrayProp1>
<rdf:Bag>
<rdf:li>Item1.1 value</rdf:li>
<rdf:li>Item1.2 value</rdf:li>
</rdf:Bag>
</ns1:ArrayProp1>

<ns1:ArrayProp2>
<rdf:Alt>
<rdf:li xml:lang='x-one'>Item2.1 value</rdf:li>
<rdf:li xml:lang='x-two'>Item2.2 value</rdf:li>
</rdf:Alt>
</ns1:ArrayProp2>

<ns1:ArrayProp3>
<rdf:Alt>
<rdf:li xml:lang='x-one'>Item3.1 value</rdf:li>
<rdf:li>Item3.2 value</rdf:li>
</rdf:Alt>
</ns1:ArrayProp3>

<ns1:ArrayProp4>
<rdf:Alt>
<rdf:li>Item4.1 value</rdf:li>
<rdf:li xml:lang='x-two'>Item4.2 value</rdf:li>
</rdf:Alt>
</ns1:ArrayProp4>

<ns1:ArrayProp5>
<rdf:Alt>
<rdf:li xml:lang='x-xxx'>Item5.1 value</rdf:li>
<rdf:li xml:lang='x-xxx'>Item5.2 value</rdf:li>
</rdf:Alt>
</ns1:ArrayProp5>

<ns1:StructProp rdf:parseType='Resource'>
<ns2:Field1>Field1 value</ns2:Field1>
<ns2:Field2>Field2 value</ns2:Field2>
</ns1:StructProp>

<ns1:QualProp1 rdf:parseType='Resource'>
<rdf:value>Prop value</rdf:value>
<ns2:Qual>Qual value</ns2:Qual>
</ns1:QualProp1>

<ns1:QualProp2 rdf:parseType='Resource'>
<rdf:value xml:lang='x-default'>Prop value</rdf:value>
<ns2:Qual>Qual value</ns2:Qual>
</ns1:QualProp2>

<!-- NOTE: QualProp3 is not quite kosher. Normally a qualifier on a struct is attached to the -->
<!-- struct node in the XMP tree, and the same for an array. See QualProp4 and QualProp5. But -->
<!-- for the pseudo-struct of a qualified simple property there is no final struct node that -->
<!-- can own the qualifier. Instead the qualifier is attached to the value. The alternative -->
<!-- of attaching the qualifier to the value and all other qualifiers is not compelling. This -->
<!-- issue only arises for xml:lang, it is the only qualifier that RDF has as an attribute. -->

<ns1:QualProp3 xml:lang='x-default' rdf:parseType='Resource'>
<rdf:value>Prop value</rdf:value>
<ns2:Qual>Qual value</ns2:Qual>
</ns1:QualProp3>

<ns1:QualProp4 xml:lang='x-default' rdf:parseType='Resource'>
<ns2:Field1>Field1 value</ns2:Field1>
<ns2:Field2>Field2 value</ns2:Field2>
</ns1:QualProp4>

<ns1:QualProp5 xml:lang='x-default'>
<rdf:Bag>
<rdf:li>Item1.1 value</rdf:li>
<rdf:li>Item1.2 value</rdf:li>
</rdf:Bag>
</ns1:QualProp5>

<ns2:NestedStructProp rdf:parseType='Resource'>
<ns1:Outer rdf:parseType='Resource'>
<ns1:Middle rdf:parseType='Resource'>
Expand All @@ -122,39 +122,39 @@ const RDF_COVERAGE: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-r
</ns1:Middle>
</ns1:Outer>
</ns2:NestedStructProp>

</rdf:Description>
</rdf:RDF>"#;

const SIMPLE_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kSimpleRDF' xmlns:ns1='ns:test1/' xmlns:ns2='ns:test2/'>

<ns1:SimpleProp>Simple value</ns1:SimpleProp>

<ns1:ArrayProp>
<rdf:Bag>
<rdf:li>Item1 value</rdf:li>
<rdf:li>Item2 value</rdf:li>
</rdf:Bag>
</ns1:ArrayProp>

<ns1:StructProp rdf:parseType='Resource'>
<ns2:Field1>Field1 value</ns2:Field1>
<ns2:Field2>Field2 value</ns2:Field2>
</ns1:StructProp>

<ns1:QualProp rdf:parseType='Resource'>
<rdf:value>Prop value</rdf:value>
<ns2:Qual>Qual value</ns2:Qual>
</ns1:QualProp>

<ns1:AltTextProp>
<rdf:Alt>
<rdf:li xml:lang='x-one'>x-one value</rdf:li>
<rdf:li xml:lang='x-two'>x-two value</rdf:li>
</rdf:Alt>
</ns1:AltTextProp>

<ns1:ArrayOfStructProp>
<rdf:Bag>
<rdf:li rdf:parseType='Resource'>
Expand All @@ -167,13 +167,13 @@ const SIMPLE_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf
</rdf:li>
</rdf:Bag>
</ns1:ArrayOfStructProp>

</rdf:Description>
</rdf:RDF>"#;

const NAMESPACE_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kNamespaceRDF' xmlns:ns1='ns:test1/'>

<ns1:NestedStructProp rdf:parseType='Resource'>
<ns2:Outer rdf:parseType='Resource' xmlns:ns2='ns:test2/' xmlns:ns3='ns:test3/'>
<ns3:Middle rdf:parseType='Resource' xmlns:ns4='ns:test4/'>
Expand All @@ -184,50 +184,50 @@ const NAMESPACE_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-
</ns3:Middle>
</ns2:Outer>
</ns1:NestedStructProp>

</rdf:Description>
</rdf:RDF>"#;

const XMP_META_RDF: &str = r#"<x:Outermost xmlns:x='adobe:ns:meta/'>

<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kBogusLeadingRDF' xmlns:ns1='ns:test1/'>
<ns1:BogusLeadingProp>bogus packet</ns1:BogusLeadingProp>
</rdf:Description>
</rdf:RDF>

<x:xmpmeta>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/XMP_META_RDF' xmlns:ns1='ns:test1/'>
<ns1:XMPMetaProp>xmpmeta packet</ns1:XMPMetaProp>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>

<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kBogusTrailingRDF' xmlns:ns1='ns:test1/'>
<ns1:BogusTrailingProp>bogus packet</ns1:BogusTrailingProp>
</rdf:Description>
</rdf:RDF>

</x:Outermost>"#;

const DATE_TIME_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kDateTimeRDF' xmlns:ns1='ns:test1/'>

<ns1:Date1>2003</ns1:Date1>
<ns1:Date2>2003-12</ns1:Date2>
<ns1:Date3>2003-12-31</ns1:Date3>

<ns1:Date4>2003-12-31T12:34Z</ns1:Date4>
<ns1:Date5>2003-12-31T12:34:56Z</ns1:Date5>

<ns1:Date6>2003-12-31T12:34:56.001Z</ns1:Date6>
<ns1:Date7>2003-12-31T12:34:56.000000001Z</ns1:Date7>

<ns1:Date8>2003-12-31T10:04:56-02:30</ns1:Date8>
<ns1:Date9>2003-12-31T15:49:56+03:15</ns1:Date9>

</rdf:Description>
</rdf:RDF>"#;

Expand All @@ -236,11 +236,13 @@ const DATE_TIME_RDF: &str = r#"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-

// // -------------------------------------------------------------------------------------------------

// static void FillDateTime ( XMP_DateTime * dateTime, XMP_Int32 year, XMP_Int32
// month, XMP_Int32 day, XMP_Int32 hour, XMP_Int32 minute, XMP_Int32 second,
// XMP_Bool hasDate, XMP_Bool hasTime, XMP_Bool hasTimeZone,
// XMP_Int8 tzSign, XMP_Int32 tzHour, XMP_Int32 tzMinute, XMP_Int32
// nanoSecond ) {
// static void FillDateTime ( XMP_DateTime * dateTime, XMP_Int32 year,
// XMP_Int32 month, XMP_Int32 day, XMP_Int32 hour,
// XMP_Int32 minute, XMP_Int32 second,
// XMP_Bool hasDate, XMP_Bool hasTime,
// XMP_Bool hasTimeZone, XMP_Int8 tzSign,
// XMP_Int32 tzHour, XMP_Int32 tzMinute,
// XMP_Int32 nanoSecond ) {

// dateTime->year = year;
// dateTime->month = month;
Expand Down Expand Up @@ -2654,8 +2656,8 @@ fn xmp_core_coverage() {

// meta1.set_property ( xmp_ns::XMP, "CreatorTool", "XMPCoverage" );
// meta1.set_property ( xmp_ns::XMP, "Nickname", "TXMP test" );
// DumpXMPObj ( log, meta1, "Set xmp:CreatorTool (internal) and xmp:Nickname
// (external)" );
// DumpXMPObj ( log, meta1, "Set xmp:CreatorTool (internal) and
// xmp:Nickname (external)" );

// SXMPUtils::RemoveProperties ( &meta1 );
// DumpXMPObj ( log, meta1, "Remove all external properties" );
Expand All @@ -2681,22 +2683,22 @@ fn xmp_core_coverage() {
// meta2.set_property ( xmp_ns::XMP, "CreatorTool", "newer CreatorTool" );
// meta2.set_property ( xmp_ns::XMP, "Nickname", "newer Nickname" );
// meta2.set_property ( xmp_ns::XMP, "Format", "newer Format" );
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties |
// kXMPTemplate_IncludeInternalProperties ); DumpXMPObj ( log, meta1,
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties
// | kXMPTemplate_IncludeInternalProperties ); DumpXMPObj ( log, meta1,
// "Append 2nd to 1st, keeping old values, internal also" );

// meta2.set_property ( xmp_ns::XMP, "CreatorTool", "newest CreatorTool" );
// meta2.set_property ( xmp_ns::XMP, "Nickname", "newest Nickname" );
// meta2.set_property ( xmp_ns::XMP, "Format", "newest Format" );
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties |
// kXMPTemplate_ReplaceExistingProperties ); DumpXMPObj ( log, meta1,
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties
// | kXMPTemplate_ReplaceExistingProperties ); DumpXMPObj ( log, meta1,
// "Append 2nd to 1st, replacing old values, external only" );

// meta2.set_property ( xmp_ns::XMP, "CreatorTool", "final CreatorTool" );
// meta2.set_property ( xmp_ns::XMP, "Nickname", "final Nickname" );
// meta2.set_property ( xmp_ns::XMP, "Format", "final Format" );
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties |
// kXMPTemplate_ReplaceExistingProperties |
// SXMPUtils::ApplyTemplate ( &meta1, meta2, kXMPTemplate_AddNewProperties
// | kXMPTemplate_ReplaceExistingProperties |
// kXMPTemplate_IncludeInternalProperties ); DumpXMPObj ( log, meta1,
// "Append 2nd to 1st, replacing old values, internal also" );

Expand Down
6 changes: 3 additions & 3 deletions src/xmp_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ impl IterOptions {
/// Restrict iteration to those properties that are part of the named
/// schema.
pub fn schema_ns(mut self, schema_ns: &str) -> Self {
self.schema_ns = schema_ns.to_owned();
schema_ns.clone_into(&mut self.schema_ns);
self.prop_name = String::default();
self
}

/// Restrict iteration to properties within a specific property.
pub fn property(mut self, schema_ns: &str, prop_name: &str) -> Self {
self.schema_ns = schema_ns.to_owned();
self.prop_name = prop_name.to_owned();
schema_ns.clone_into(&mut self.schema_ns);
prop_name.clone_into(&mut self.prop_name);
self
}

Expand Down
Loading