Skip to content

Commit 67993f5

Browse files
Merge pull request #142 from theseus-rs/correct-lints
chore: correct lint errors
2 parents 17db700 + 262f54a commit 67993f5

File tree

5 files changed

+24
-26
lines changed

5 files changed

+24
-26
lines changed

export/pronom/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ fn main() -> Result<()> {
3030
initialize_tracing();
3131

3232
let mut max_fmt_puid = 2039;
33-
if let Ok(fmt_puid) = env::var("MAX_FMT_PUID") {
34-
if let Ok(fmt_puid) = fmt_puid.parse::<i64>() {
35-
max_fmt_puid = fmt_puid;
36-
}
33+
if let Ok(fmt_puid) = env::var("MAX_FMT_PUID")
34+
&& let Ok(fmt_puid) = fmt_puid.parse::<i64>()
35+
{
36+
max_fmt_puid = fmt_puid;
3737
}
3838

3939
let mut max_x_fmt_puid = 455;
40-
if let Ok(x_fmt_puid) = env::var("MAX_X_FMT_PUID") {
41-
if let Ok(x_fmt_puid) = x_fmt_puid.parse::<i64>() {
42-
max_x_fmt_puid = x_fmt_puid;
43-
}
40+
if let Ok(x_fmt_puid) = env::var("MAX_X_FMT_PUID")
41+
&& let Ok(x_fmt_puid) = x_fmt_puid.parse::<i64>()
42+
{
43+
max_x_fmt_puid = x_fmt_puid;
4444
}
4545

4646
let puid_ids = HashMap::from([("fmt", max_fmt_puid), ("x-fmt", max_x_fmt_puid)]);

export/wikidata/src/main.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,22 @@ fn parse_json(json: &Value) -> Vec<FileFormat> {
160160
.get("extension")
161161
.and_then(|extension| extension.get("value"))
162162
.and_then(|extension| extension.as_str())
163+
&& !extensions.contains(&extension)
163164
{
164-
if !extensions.contains(&extension) {
165-
let extension = Box::leak(extension.to_string().into_boxed_str());
166-
extensions.push(extension);
167-
extensions.sort_unstable();
168-
}
165+
let extension = Box::leak(extension.to_string().into_boxed_str());
166+
extensions.push(extension);
167+
extensions.sort_unstable();
169168
}
170169

171170
if let Some(media_type) = binding
172171
.get("mediaType")
173172
.and_then(|media_type| media_type.get("value"))
174173
.and_then(|media_type| media_type.as_str())
174+
&& !media_types.contains(&media_type)
175175
{
176-
if !media_types.contains(&media_type) {
177-
let media_type = Box::leak(media_type.to_string().into_boxed_str());
178-
media_types.push(media_type);
179-
media_types.sort_unstable();
180-
}
176+
let media_type = Box::leak(media_type.to_string().into_boxed_str());
177+
media_types.push(media_type);
178+
media_types.sort_unstable();
181179
}
182180

183181
if let Some(file_signature) = binding

file_type/src/file_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl Ord for FileType {
225225

226226
impl PartialOrd for FileType {
227227
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
228-
Some(self.file_format.cmp(other.file_format))
228+
Some(self.cmp(other))
229229
}
230230
}
231231

file_type/src/format/file_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl SourceType {
3030

3131
impl PartialOrd for SourceType {
3232
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
33-
Some(self.priority().cmp(&other.priority()))
33+
Some(self.cmp(other))
3434
}
3535
}
3636

file_type/src/format/signature.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ impl Signature {
1515
#[must_use]
1616
pub fn key(&self) -> u64 {
1717
for byte_sequence in self.byte_sequences {
18-
if byte_sequence.position_type == PositionType::BOF {
19-
if let Some(0) = byte_sequence.offset {
20-
let key = byte_sequence.regex.key();
21-
if key != 0 {
22-
return key;
23-
}
18+
if byte_sequence.position_type == PositionType::BOF
19+
&& let Some(0) = byte_sequence.offset
20+
{
21+
let key = byte_sequence.regex.key();
22+
if key != 0 {
23+
return key;
2424
}
2525
}
2626
}

0 commit comments

Comments
 (0)