Skip to content

Commit dbe4a6c

Browse files
committed
Fix clippy warnings
Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent d244ee8 commit dbe4a6c

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

keylime-agent/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ config.workspace = true
1616
futures.workspace = true
1717
glob.workspace = true
1818
hex.workspace = true
19-
keylime.workspace = true
19+
keylime = { workspace = true, features = [] }
2020
libc.workspace = true
2121
log.workspace = true
2222
openssl.workspace = true
@@ -40,7 +40,7 @@ actix-rt.workspace = true
4040
[features]
4141
# The features enabled by default
4242
default = []
43-
testing = []
43+
testing = ["keylime/testing"]
4444
# Whether the agent should be compiled with support to listen for notification
4545
# messages on ZeroMQ
4646
#

keylime-push-model-agent/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ assert_cmd.workspace = true
1414
async-trait.workspace = true
1515
chrono.workspace = true
1616
clap.workspace = true
17-
keylime.workspace = true
17+
keylime = { workspace = true, features = [] }
1818
log.workspace = true
1919
predicates.workspace = true
2020
pretty_env_logger.workspace = true
@@ -34,7 +34,7 @@ wiremock = {version = "0.6"}
3434
[features]
3535
# The features enabled by default
3636
default = []
37-
testing = []
37+
testing = ["keylime/testing"]
3838
legacy-python-actions = []
3939

4040
[package.metadata.deb]

keylime-push-model-agent/src/struct_filler.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,7 @@ mod tests {
661661
if let Ok(mut ctx) = context_info_result {
662662
// Temporarily override config to point to a non-existent path
663663
let original_path =
664-
std::env::var("KEYLIME_CONFIG_PATH").unwrap_or_default();
665-
std::env::set_var(
666-
"KEYLIME_CONFIG_PATH",
667-
"test-data/non-existent-config.conf",
668-
);
664+
std::env::var("KEYLIME_AGENT_CONFIG").unwrap_or_default();
669665

670666
// Create a temporary config file with an invalid path for measuredboot_ml_path
671667
let temp_dir = tempfile::tempdir().unwrap();
@@ -675,16 +671,20 @@ mod tests {
675671
writeln!(file, "[agent]").unwrap();
676672
writeln!(
677673
file,
678-
"measuredboot_ml_path = /path/to/non/existent/log"
674+
"measuredboot_ml_path = \"/path/to/non/existent/log\""
679675
)
680676
.unwrap();
681-
std::env::set_var("KEYLIME_CONFIG_PATH", config_path);
677+
std::env::set_var("KEYLIME_AGENT_CONFIG", config_path);
682678

683679
let filler = FillerFromHardware::new(&mut ctx);
684680
assert!(filler.uefi_log_handler.is_none());
685681

686682
// Restore original config path
687-
std::env::set_var("KEYLIME_CONFIG_PATH", original_path);
683+
if original_path.is_empty() {
684+
std::env::remove_var("KEYLIME_AGENT_CONFIG");
685+
} else {
686+
std::env::set_var("KEYLIME_AGENT_CONFIG", original_path);
687+
}
688688
assert!(ctx.flush_context().is_ok());
689689
}
690690
}

keylimectl/src/commands/agent.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,12 +2130,13 @@ async fn validate_tpm_quote(
21302130
}
21312131

21322132
// Handle the 'r' prefix - remove the single 'r' character as documented
2133-
let quote_data_clean = if let Some(stripped) = quote_data.strip_prefix('r') {
2134-
debug!("Removing 'r' prefix from quote data");
2135-
stripped
2136-
} else {
2137-
quote_data
2138-
};
2133+
let quote_data_clean =
2134+
if let Some(stripped) = quote_data.strip_prefix('r') {
2135+
debug!("Removing 'r' prefix from quote data");
2136+
stripped
2137+
} else {
2138+
quote_data
2139+
};
21392140

21402141
debug!("Cleaned quote data length: {}", quote_data_clean.len());
21412142

keylimectl/src/config/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use thiserror::Error;
3333
/// This enum covers all error conditions that can occur during configuration
3434
/// operations, from file loading to validation and environment variable processing.
3535
#[derive(Error, Debug)]
36+
#[allow(dead_code)]
3637
pub enum ConfigError {
3738
/// Configuration file loading errors
3839
#[error("Configuration file error: {0}")]
@@ -56,13 +57,15 @@ pub enum ConfigError {
5657
/// These errors represent issues when loading configuration files,
5758
/// including file system errors and format issues.
5859
#[derive(Error, Debug)]
60+
#[allow(dead_code)]
5961
pub enum LoadError {}
6062

6163
/// Configuration validation errors
6264
///
6365
/// These errors represent validation failures for specific configuration
6466
/// values, providing detailed context about what is wrong and how to fix it.
6567
#[derive(Error, Debug)]
68+
#[allow(dead_code)]
6669
pub enum ValidationError {}
6770

6871
impl ConfigError {}

0 commit comments

Comments
 (0)