Skip to content

Commit 5bb93ba

Browse files
authored
Merge pull request #281 from brxken128/clippy-fix
fix clippy (and stop using `deny`)
2 parents e4103ae + bff4e23 commit 5bb93ba

File tree

11 files changed

+27
-29
lines changed

11 files changed

+27
-29
lines changed

dexios-core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//!
3434
//! Dexios-Core exclusively uses AEADs provided by the [RustCrypto Team](https://github.com/RustCrypto), so I'd like to give them a huge thank you for their hard work (this wouldn't have been possible without them!)
3535
#![forbid(unsafe_code)]
36-
#![deny(clippy::all)]
36+
#![warn(clippy::all)]
3737

3838
pub const CORE_VERSION: &str = env!("CARGO_PKG_VERSION");
3939

dexios-domain/src/encrypt.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub mod tests {
261261
assert_eq!(output_content, V4_ENCRYPTED_CONTENT.to_vec());
262262
}
263263
Err(e) => {
264-
println!("{:?}", e);
264+
println!("{e:?}");
265265
unreachable!()
266266
}
267267
}
@@ -293,7 +293,7 @@ pub mod tests {
293293
assert_eq!(output_content, V5_ENCRYPTED_CONTENT.to_vec());
294294
}
295295
Err(e) => {
296-
println!("{:?}", e);
296+
println!("{e:?}");
297297
unreachable!()
298298
}
299299
}
@@ -329,7 +329,7 @@ pub mod tests {
329329
assert_eq!(output_header, V5_ENCRYPTED_DETACHED_HEADER.to_vec());
330330
}
331331
Err(e) => {
332-
println!("{:?}", e);
332+
println!("{e:?}");
333333
unreachable!()
334334
}
335335
}

dexios-domain/src/erase.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl std::fmt::Display for Error {
1919
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2020
match self {
2121
Error::OpenFile => f.write_str("Unable to open file"),
22-
Error::Overwrite(inner) => write!(f, "Unable to overwrite file: {}", inner),
22+
Error::Overwrite(inner) => write!(f, "Unable to overwrite file: {inner}"),
2323
Error::RemoveFile => f.write_str("Unable to remove file"),
2424
}
2525
}

dexios-domain/src/erase_dir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl std::fmt::Display for Error {
1919
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2020
match self {
2121
Error::InvalidFileType => f.write_str("Invalid file type"),
22-
Error::EraseFile(inner) => write!(f, "Unable to erase file: {}", inner),
22+
Error::EraseFile(inner) => write!(f, "Unable to erase file: {inner}"),
2323
Error::ReadDirEntries => f.write_str("Unable to get all dir entries"),
2424
Error::RemoveDir => f.write_str("Unable to remove directory recursively"),
2525
}

dexios-domain/src/lib.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,23 @@
3232
//! You can read more about Dexios, Dexios-Core, Dexios-Domain and the technical details [in the project's main documentation](https://brxken128.github.io/dexios/)!
3333
//!
3434
35-
// Rustc lints
35+
// lints
3636
#![forbid(unsafe_code)]
37-
#![deny(
37+
#![warn(
3838
rust_2018_idioms,
3939
non_ascii_idents,
4040
unstable_features,
4141
unused_imports,
42-
unused_qualifications
42+
unused_qualifications,
43+
clippy::pedantic,
44+
clippy::all
4345
)]
44-
// Clippy lints
45-
#![deny(clippy::pedantic, clippy::all)]
4646
#![allow(
4747
clippy::module_name_repetitions,
4848
clippy::similar_names,
4949
clippy::needless_pass_by_value,
50-
// yet
5150
clippy::missing_panics_doc,
52-
clippy::missing_errors_doc,
51+
clippy::missing_errors_doc
5352
)]
5453

5554
pub mod decrypt;

dexios-domain/src/pack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl std::fmt::Display for Error {
3535
Error::FinishArchive => f.write_str("Unable to finish archive"),
3636
Error::ReadData => f.write_str("Unable to read data"),
3737
Error::WriteData => f.write_str("Unable to write data"),
38-
Error::Encrypt(inner) => write!(f, "Unable to encrypt archive: {}", inner),
38+
Error::Encrypt(inner) => write!(f, "Unable to encrypt archive: {inner}"),
3939
}
4040
}
4141
}

dexios-domain/src/storage.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl std::fmt::Display for Error {
3737
match self {
3838
Error::CreateDir => f.write_str("Unable to create a new directory"),
3939
Error::CreateFile => f.write_str("Unable to create a new file"),
40-
Error::OpenFile(mode) => write!(f, "Unable to read the file in {:?} mode", mode),
40+
Error::OpenFile(mode) => write!(f, "Unable to read the file in {mode:?} mode"),
4141
Error::FlushFile => f.write_str("Unable to flush the file"),
4242
Error::RemoveFile => f.write_str("Unable to remove the file"),
4343
Error::RemoveDir => f.write_str("Unable to remove dir"),
@@ -457,7 +457,7 @@ where
457457
mod tests {
458458
use super::*;
459459

460-
fn sorted_file_names(file_names: Vec<&PathBuf>) -> Vec<&str> {
460+
fn sorted_file_names(file_names: &[PathBuf]) -> Vec<&str> {
461461
let mut keys = file_names
462462
.iter()
463463
.map(|k| k.to_str().unwrap())
@@ -651,9 +651,9 @@ mod tests {
651651
Ok(()) => {
652652
assert_eq!(stor.files().get(&file_path).cloned(), None);
653653
let files = stor.files();
654-
let keys = files.keys().collect::<Vec<_>>();
654+
let keys = files.keys().cloned().collect::<Vec<_>>();
655655
assert_eq!(
656-
sorted_file_names(keys),
656+
sorted_file_names(&keys),
657657
vec!["bar/", "bar/hello.txt", "bar/world.txt", "hello.txt"]
658658
);
659659
}
@@ -674,8 +674,8 @@ mod tests {
674674
Ok(()) => {
675675
assert_eq!(stor.files().get(&file_path).cloned(), None);
676676
let files = stor.files();
677-
let keys = files.keys().collect();
678-
assert_eq!(sorted_file_names(keys), vec!["hello.txt"]);
677+
let keys = files.keys().cloned().collect::<Vec<PathBuf>>();
678+
assert_eq!(sorted_file_names(&keys), vec!["hello.txt"]);
679679
}
680680
_ => unreachable!(),
681681
}
@@ -696,7 +696,7 @@ mod tests {
696696
.map(|f| f.path().to_path_buf())
697697
.collect::<Vec<_>>();
698698
assert_eq!(
699-
sorted_file_names(file_names.iter().collect()),
699+
sorted_file_names(&file_names),
700700
vec![
701701
"bar/",
702702
"bar/foo/",
@@ -722,11 +722,11 @@ mod tests {
722722
match stor.read_dir(&file) {
723723
Ok(files) => {
724724
let file_names = files
725-
.iter()
725+
.into_iter()
726726
.map(|f| f.path().to_path_buf())
727727
.collect::<Vec<_>>();
728728
assert_eq!(
729-
sorted_file_names(file_names.iter().collect()),
729+
sorted_file_names(&file_names),
730730
vec![
731731
"bar/",
732732
"bar/.foo/",

dexios-domain/src/unpack.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ impl std::fmt::Display for Error {
2828
Error::OpenArchive => f.write_str("Unable to open archive"),
2929
Error::OpenArchivedFile => f.write_str("Unable to open archived file"),
3030
Error::ResetCursorPosition => f.write_str("Unable to reset cursor position"),
31-
Error::Storage(inner) => write!(f, "Storage error: {}", inner),
32-
Error::Decrypt(inner) => write!(f, "Decrypt error: {}", inner),
31+
Error::Storage(inner) => write!(f, "Storage error: {inner}"),
32+
Error::Decrypt(inner) => write!(f, "Decrypt error: {inner}"),
3333
}
3434
}
3535
}

dexios-domain/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mod test {
3737
pub fn hex_encode(bytes: &[u8]) -> String {
3838
bytes
3939
.iter()
40-
.map(|b| format!("{:02x}", b))
40+
.map(|b| format!("{b:02x}"))
4141
.collect::<String>()
4242
}
4343

dexios/src/global/parameters.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ use super::structs::KeyManipulationParams;
1616
pub fn get_params(name: &str, sub_matches: &ArgMatches) -> Result<Vec<String>> {
1717
let values = sub_matches
1818
.get_many::<String>(name)
19-
.with_context(|| format!("No {} provided", name))?
20-
.into_iter()
19+
.with_context(|| format!("No {name} provided"))?
2120
.map(String::from)
2221
.collect();
2322
Ok(values)

dexios/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![forbid(unsafe_code)]
2-
#![deny(clippy::all)]
2+
#![warn(clippy::all)]
33

44
use anyhow::Result;
55

0 commit comments

Comments
 (0)