Skip to content

Commit f41b4d7

Browse files
committed
fix clippy lints
1 parent 5b4c783 commit f41b4d7

21 files changed

+33
-38
lines changed

svd-parser/src/elementext.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ impl<'a, 'input> ElementExt for Node<'a, 'input> {
3434
where
3535
K: AsRef<str>,
3636
{
37-
for c in self.children() {
38-
if c.has_tag_name(k.as_ref()) {
39-
return Some(c);
40-
}
41-
}
42-
None
37+
self.children().find(|&c| c.has_tag_name(k.as_ref()))
4338
}
4439
fn get_child_text_opt<K>(&self, k: K) -> Result<Option<String>, SVDErrorAt>
4540
where

svd-parser/src/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,11 @@ pub fn derive_enumerated_values(
571571
Ok(epath)
572572
}
573573
} else {
574-
return Err(anyhow!(
574+
Err(anyhow!(
575575
"enumeratedValues {} not found, parent field: {:?}",
576576
dpath,
577577
fpath,
578-
));
578+
))
579579
}
580580
}
581581

svd-parser/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub mod expand;
220220
#[cfg(feature = "expand")]
221221
pub use expand::{expand, expand_properties};
222222
/// SVD parse Errors.
223-
#[derive(Clone, Debug, PartialEq, thiserror::Error)]
223+
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
224224
pub enum SVDError {
225225
#[error("{0}")]
226226
Svd(#[from] svd::SvdError),

svd-rs/src/access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// Defines access rights for fields on the device, though it may be specified at a
22
/// higher level than individual fields.
33
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
4-
#[derive(Clone, Copy, Debug, PartialEq)]
4+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55
pub enum Access {
66
/// Read access is permitted. Write operations have an undefined effect.
77
#[cfg_attr(feature = "serde", serde(rename = "read-only"))]

svd-rs/src/addressblock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::{BuildError, Protection, SvdError, ValidateLevel};
22

33
/// An uniquely mapped address block to a peripheral
44
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
5-
#[derive(Clone, Debug, PartialEq)]
5+
#[derive(Clone, Debug, PartialEq, Eq)]
66
#[non_exhaustive]
77
pub struct AddressBlock {
88
/// Specifies the start address of an address block relative to the peripheral [`baseAddress`](crate::Peripheral::base_address).
@@ -63,7 +63,7 @@ impl AddressBlockUsage {
6363
}
6464

6565
/// Builder for [`AddressBlock`]
66-
#[derive(Clone, Debug, Default, PartialEq)]
66+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
6767
pub struct AddressBlockBuilder {
6868
offset: Option<u32>,
6969
size: Option<u32>,

svd-rs/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::{DimElement, Name};
22
use core::ops::{Deref, DerefMut};
33

44
/// A single SVD instance or array of instances
5-
#[derive(Clone, Debug, PartialEq)]
5+
#[derive(Clone, Debug, PartialEq, Eq)]
66
pub enum MaybeArray<T> {
77
/// A single instance
88
Single(T),

svd-rs/src/bitrange.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub enum Error {
77
}
88

99
/// A bit range, describing the [least significant bit](Self::lsb) and [most significant bit](Self::msb)
10-
#[derive(Clone, Copy, Debug, PartialEq)]
10+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1111
pub struct BitRange {
1212
/// Value defining the position of the least significant bit of the field within the register
1313
pub offset: u32,
@@ -20,7 +20,7 @@ pub struct BitRange {
2020
}
2121

2222
/// The style of bit range that describes a [BitRange]
23-
#[derive(Clone, Copy, Debug, PartialEq)]
23+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2424
pub enum BitRangeType {
2525
/// A bit range in the format: `[<msb>:<lsb>]`
2626
BitRange,

svd-rs/src/cpu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::{BuildError, Endian, SvdError, ValidateLevel};
55
derive(serde::Deserialize, serde::Serialize),
66
serde(rename_all = "camelCase")
77
)]
8-
#[derive(Clone, Debug, PartialEq)]
8+
#[derive(Clone, Debug, PartialEq, Eq)]
99
#[non_exhaustive]
1010
pub struct Cpu {
1111
/// Processor architecture
@@ -99,7 +99,7 @@ pub struct Cpu {
9999
}
100100

101101
/// Builder for [`Cpu`]
102-
#[derive(Clone, Debug, Default, PartialEq)]
102+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
103103
pub struct CpuBuilder {
104104
name: Option<String>,
105105
revision: Option<String>,

svd-rs/src/dimelement.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::ops::RangeInclusive;
88
derive(serde::Deserialize, serde::Serialize),
99
serde(rename_all = "camelCase")
1010
)]
11-
#[derive(Clone, Debug, PartialEq)]
11+
#[derive(Clone, Debug, PartialEq, Eq)]
1212
#[non_exhaustive]
1313
pub struct DimElement {
1414
/// Defines the number of elements in an array or list
@@ -55,7 +55,7 @@ pub struct DimElement {
5555
derive(serde::Deserialize, serde::Serialize),
5656
serde(rename_all = "camelCase")
5757
)]
58-
#[derive(Clone, Debug, PartialEq)]
58+
#[derive(Clone, Debug, PartialEq, Eq)]
5959
pub struct DimArrayIndex {
6060
/// Specify the base name of enumerations
6161
#[cfg_attr(
@@ -69,7 +69,7 @@ pub struct DimArrayIndex {
6969
}
7070

7171
/// Builder for [`DimElement`]
72-
#[derive(Clone, Debug, Default, PartialEq)]
72+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
7373
pub struct DimElementBuilder {
7474
dim: Option<u32>,
7575
dim_increment: Option<u32>,

svd-rs/src/endian.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
derive(serde::Deserialize, serde::Serialize),
55
serde(rename_all = "kebab-case")
66
)]
7-
#[derive(Clone, Copy, Debug, PartialEq)]
7+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88
pub enum Endian {
99
/// Little endian.
1010
Little,

0 commit comments

Comments
 (0)