Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schildt <sebastian.schildt@de.bosch.com>
  • Loading branch information
SebastianSchildt committed Oct 20, 2024
1 parent 6ec0aef commit b2ec135
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
7 changes: 1 addition & 6 deletions kuksa-persistence-provider/src/kuksaconnector.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::storage;

use regex;
use prost_types::Timestamp;

use std::time::SystemTime;
use std::collections::HashMap;

Expand All @@ -11,7 +8,6 @@ use kuksa::proto as proto;
//use kuksa::proto::v1::{datapoint::Value, DataType, Datapoint};

use std::sync::{Arc, Mutex};
use log;

#[derive(Debug)]
pub struct ParseError {}
Expand All @@ -31,7 +27,7 @@ pub async fn get_from_storage_and_set(storage: &impl storage::Storage, kuksa_cli
log::warn!("No value for VSS signal: {} stored", vsspath);
return;
}
};
};

/*
let data_value = try_into_data_value(
Expand Down Expand Up @@ -68,7 +64,6 @@ pub async fn get_from_storage_and_set(storage: &impl storage::Storage, kuksa_cli
log::warn!("Error: Could not set value for VSS signal: {}, Errors: {msg:?}", vsspath);
}
};
log::debug!("Got {} from storage for {}" ,value, vsspath);
}


Expand Down
3 changes: 0 additions & 3 deletions kuksa-persistence-provider/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ use std::{path::PathBuf,env};
use clap::Parser;
use tinyjson::JsonValue;

use tokio;

use log;

#[derive(Parser)]
#[command(version, about, long_about = None)]
Expand Down
16 changes: 7 additions & 9 deletions kuksa-persistence-provider/src/storage/filestorage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::collections::HashMap;
use log;

pub struct FileStorage {
storagefile: String,
state: JsonValue,
}

Expand All @@ -30,9 +29,9 @@ impl Storage for FileStorage {
println!("Reading storage from {}", path);
let config_str = std::fs::read_to_string(&path).unwrap();
let state = config_str.parse().unwrap();
FileStorage { storagefile: path, state: state }
FileStorage { state }
}
_ => {
_ => {
log::error!("Error: file storage path is invalid");
std::process::exit(1);
}
Expand All @@ -49,11 +48,12 @@ impl Storage for FileStorage {

if entry.is_some() && entry.unwrap().contains_key("value") {
let value = entry.unwrap()["value"].get::<String>();
if value.is_some() {
return Some(value.unwrap());

if let Some(v) = value {
return Some(v);
}
}
return None;
None
}

fn set(&self, vsspath: &str, vssvalue: &'static str) -> Result<(), ()> {
Expand All @@ -64,7 +64,5 @@ impl Storage for FileStorage {
}

impl FileStorage {
pub fn get_storagefile(&self) -> &String {
&self.storagefile
}

}

0 comments on commit b2ec135

Please sign in to comment.