Skip to content

Commit 3d29dd9

Browse files
committed
Fix clippy warnings (mostly dead code)
1 parent bdcc4a8 commit 3d29dd9

File tree

6 files changed

+10
-25
lines changed

6 files changed

+10
-25
lines changed

mithril-client-cli/src/commands/snapshot/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl SnapshotDownloadCommand {
5959
let progress_output_type = if self.json {
6060
ProgressOutputType::JsonReporter
6161
} else {
62-
ProgressOutputType::TTY
62+
ProgressOutputType::Tty
6363
};
6464
let progress_printer = ProgressPrinter::new(progress_output_type, 5);
6565
let client = ClientBuilder::aggregator(

mithril-client-cli/src/configuration.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl ConfigParameters {
2424
}
2525

2626
/// Useful constructor for testing
27+
#[cfg(test)]
2728
pub fn build(parameters: &[(&str, &str)]) -> Self {
2829
let parameters = parameters
2930
.iter()
@@ -34,6 +35,7 @@ impl ConfigParameters {
3435
}
3536

3637
/// Add or replace a parameter in the holder
38+
#[cfg(test)]
3739
pub fn add_parameter(&mut self, name: &str, value: &str) -> &mut Self {
3840
let _ = self.parameters.insert(name.to_string(), value.to_string());
3941

mithril-client-cli/src/utils/feedback_receiver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl FeedbackReceiver for IndicatifFeedbackReceiver {
3535
download_id: _,
3636
size,
3737
} => {
38-
let pb = if self.output_type == ProgressOutputType::TTY {
38+
let pb = if self.output_type == ProgressOutputType::Tty {
3939
ProgressBar::new(size)
4040
} else {
4141
ProgressBar::with_draw_target(Some(size), ProgressDrawTarget::hidden())
@@ -68,7 +68,7 @@ impl FeedbackReceiver for IndicatifFeedbackReceiver {
6868
MithrilEvent::CertificateChainValidationStarted {
6969
certificate_chain_validation_id: _,
7070
} => {
71-
let pb = if self.output_type == ProgressOutputType::TTY {
71+
let pb = if self.output_type == ProgressOutputType::Tty {
7272
ProgressBar::new_spinner()
7373
} else {
7474
ProgressBar::hidden()

mithril-client-cli/src/utils/progress_reporter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum ProgressOutputType {
1414
/// Output to json
1515
JsonReporter,
1616
/// Output to tty
17-
TTY,
17+
Tty,
1818
/// No output
1919
Hidden,
2020
}
@@ -23,7 +23,7 @@ impl From<ProgressOutputType> for ProgressDrawTarget {
2323
fn from(value: ProgressOutputType) -> Self {
2424
match value {
2525
ProgressOutputType::JsonReporter => ProgressDrawTarget::hidden(),
26-
ProgressOutputType::TTY => ProgressDrawTarget::stdout(),
26+
ProgressOutputType::Tty => ProgressDrawTarget::stdout(),
2727
ProgressOutputType::Hidden => ProgressDrawTarget::hidden(),
2828
}
2929
}
@@ -54,7 +54,7 @@ impl ProgressPrinter {
5454
timestamp = Utc::now().to_rfc3339(),
5555
number_of_steps = self.number_of_steps,
5656
),
57-
ProgressOutputType::TTY => self
57+
ProgressOutputType::Tty => self
5858
.multi_progress
5959
.println(format!("{step_number}/{} - {text}", self.number_of_steps))?,
6060
ProgressOutputType::Hidden => (),

mithril-client-cli/src/utils/snapshot.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,15 @@ mod test {
6767

6868
#[test]
6969
fn check_disk_space_error_should_return_error_if_error_is_not_error_not_enough_space() {
70-
let error = SnapshotUnpackerError::UnpackFailed {
71-
dirpath: PathBuf::from(""),
72-
error: anyhow::Error::msg("Some error message"),
73-
};
70+
let error = SnapshotUnpackerError::UnpackDirectoryAlreadyExists(PathBuf::new());
7471

7572
let error = SnapshotUtils::check_disk_space_error(anyhow!(error))
7673
.expect_err("check_disk_space_error should fail");
7774

7875
assert!(
7976
matches!(
8077
error.downcast_ref::<SnapshotUnpackerError>(),
81-
Some(SnapshotUnpackerError::UnpackFailed {
82-
dirpath: _,
83-
error: _
84-
})
78+
Some(SnapshotUnpackerError::UnpackDirectoryAlreadyExists(_))
8579
),
8680
"Unexpected error: {:?}",
8781
error

mithril-client-cli/src/utils/unpacker.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ pub enum SnapshotUnpackerError {
3838
/// Cannot write in the given directory.
3939
#[error("Unpack directory '{0}' is not writable.")]
4040
UnpackDirectoryIsNotWritable(PathBuf, #[source] StdError),
41-
42-
/// Unpacking error
43-
#[error("Could not unpack from streamed data snapshot to directory '{dirpath}'")]
44-
UnpackFailed {
45-
/// Location where the archive is to be extracted.
46-
dirpath: PathBuf,
47-
48-
/// Subsystem error
49-
#[source]
50-
error: StdError,
51-
},
5241
}
5342

5443
impl SnapshotUnpacker {

0 commit comments

Comments
 (0)