Skip to content

Commit

Permalink
lint: fix rust lint error
Browse files Browse the repository at this point in the history
Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 authored and jialez0 committed Aug 19, 2024
1 parent 9d89c25 commit a2de1ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion confidential-data-hub/secret/src/secret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Secret {

// TODO: check the signature
pub fn from_signed_base64_string(secret: String) -> Result<Self> {
let sections: Vec<_> = secret.split(".").collect();
let sections: Vec<_> = secret.split('.').collect();

if sections.len() != 4 {
return Err(SecretError::ParseFailed("malformed input sealed secret"));
Expand Down
22 changes: 12 additions & 10 deletions confidential-data-hub/secret/tests/test_hsm_secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
// SPDX-License-Identifier: Apache-2.0
//

use std::{
fs::File,
io::{Read, Write},
process::Command,
};

use assert_cmd::prelude::*;
use rand::{distributions::Uniform, Rng};
use tempfile::tempdir;

#[test]
#[ignore]
#[cfg(feature = "aliyun")]
Expand Down Expand Up @@ -49,7 +39,16 @@ fn test_cli_envelope_secret_lifetime_ehsm() {
key_lifetime(base_dir, key_id, sub_cmd);
}

#[cfg(any(feature = "aliyun", feature = "ehsm"))]
fn key_lifetime(base_dir: &str, key_id: &str, sub_cmd: Vec<&str>) {
use assert_cmd::prelude::*;
use std::{
fs::File,
io::{Read, Write},
process::Command,
};
use tempfile::tempdir;

let dir = tempdir().expect("create temdir fail");
let dir_path = dir.path();

Expand Down Expand Up @@ -116,7 +115,10 @@ fn key_lifetime(base_dir: &str, key_id: &str, sub_cmd: Vec<&str>) {
assert_eq!(original_secret, unsealed_secret);
}

#[cfg(any(feature = "aliyun", feature = "ehsm"))]
fn create_random_secret() -> Vec<u8> {
use rand::{distributions::Uniform, Rng};

let data_length = 10;

let mut rng = rand::thread_rng();
Expand Down

0 comments on commit a2de1ea

Please sign in to comment.