fix clippy

This commit is contained in:
jb-alvarado 2024-05-03 12:33:20 +02:00
parent fbe810bb0b
commit 4f71b23368
8 changed files with 33 additions and 24 deletions

View File

@ -62,13 +62,6 @@ use ffplayout_lib::{
vec_strings,
};
#[derive(Serialize)]
struct ResponseObj<T> {
message: String,
status: i32,
data: Option<T>,
}
#[derive(Serialize)]
struct UserObj<T> {
message: String,
@ -870,7 +863,7 @@ pub async fn gen_playlist(
config.storage.paths = path_list;
}
config.general.template = obj.template.clone();
config.general.template.clone_from(&obj.template);
}
match generate_playlist(config.to_owned(), channel.name).await {

View File

@ -143,7 +143,7 @@ pub fn stat(config: PlayoutConfig) -> SystemStat {
for (interface_name, data) in &*networks {
if !interfaces.is_empty() && interface_name == interfaces[0].0 {
network.name = interface_name.clone();
network.name.clone_from(interface_name);
network.current_in = data.received();
network.total_in = data.total_received();
network.current_out = data.transmitted();

View File

@ -95,7 +95,11 @@ impl CurrentProgram {
}
}
*self.player_control.current_list.lock().unwrap() = self.json_playlist.program.clone();
self.player_control
.current_list
.lock()
.unwrap()
.clone_from(&self.json_playlist.program);
if self.json_playlist.path.is_none() {
trace!("missing playlist");
@ -161,7 +165,11 @@ impl CurrentProgram {
self.playout_stat.list_init.store(false, Ordering::SeqCst);
self.set_status(self.json_playlist.date.clone());
*self.player_control.current_list.lock().unwrap() = self.json_playlist.program.clone();
self.player_control
.current_list
.lock()
.unwrap()
.clone_from(&self.json_playlist.program);
self.player_control.current_index.store(0, Ordering::SeqCst);
} else {
self.load_or_update_playlist(seek)
@ -171,7 +179,11 @@ impl CurrentProgram {
}
fn set_status(&mut self, date: String) {
*self.playout_stat.current_date.lock().unwrap() = date.clone();
self.playout_stat
.current_date
.lock()
.unwrap()
.clone_from(&date);
*self.playout_stat.time_shift.lock().unwrap() = 0.0;
if let Err(e) = fs::write(
@ -346,7 +358,11 @@ impl CurrentProgram {
self.json_playlist.start_sec = Some(time_sec);
set_defaults(&mut self.json_playlist);
*self.player_control.current_list.lock().unwrap() = self.json_playlist.program.clone();
self.player_control
.current_list
.lock()
.unwrap()
.clone_from(&self.json_playlist.program);
}
}
@ -355,7 +371,7 @@ impl Iterator for CurrentProgram {
type Item = Media;
fn next(&mut self) -> Option<Self::Item> {
self.last_json_path = self.json_playlist.path.clone();
self.last_json_path.clone_from(&self.json_playlist.path);
self.last_node_ad = self.current_node.last_ad;
self.check_for_playlist(self.playout_stat.list_init.load(Ordering::SeqCst));

View File

@ -219,7 +219,7 @@ fn control_back(
let (delta, _) = get_delta(config, &media.begin.unwrap_or(0.0));
*time_shift = delta;
*date = current_date.clone();
date.clone_from(&current_date);
write_status(config, &current_date, delta);
data_map.insert("operation".to_string(), json!("move_to_last"));
@ -268,7 +268,7 @@ fn control_next(
let (delta, _) = get_delta(config, &media.begin.unwrap_or(0.0));
*time_shift = delta;
*date = current_date.clone();
date.clone_from(&current_date);
write_status(config, &current_date, delta);
data_map.insert("operation".to_string(), json!("move_to_next"));
@ -306,7 +306,7 @@ fn control_reset(
info!("Reset playout to original state");
let mut data_map = Map::new();
*time_shift = 0.0;
*date = current_date.clone();
date.clone_from(&current_date);
playout_stat.list_init.store(true, Ordering::SeqCst);
write_status(config, &current_date, 0.0);

View File

@ -101,12 +101,12 @@ pub fn get_config(args: Args) -> Result<PlayoutConfig, ProcError> {
}
if let Some(start) = args.start {
config.playlist.day_start = start.clone();
config.playlist.day_start.clone_from(&start);
config.playlist.start_sec = Some(time_to_sec(&start));
}
if let Some(length) = args.length {
config.playlist.length = length.clone();
config.playlist.length.clone_from(&length);
if length.contains(':') {
config.playlist.length_sec = Some(time_to_sec(&length));

View File

@ -213,7 +213,7 @@ pub fn fill_filler_list(
}
if let Some(control) = player_control.as_ref() {
*control.filler_list.lock().unwrap() = filler_list.clone();
control.filler_list.lock().unwrap().clone_from(&filler_list);
}
} else if filler_path.is_file() {
let mut media = Media::new(0, &config.storage.filler.to_string_lossy(), false);
@ -227,7 +227,7 @@ pub fn fill_filler_list(
filler_list.push(media);
if let Some(control) = player_control.as_ref() {
*control.filler_list.lock().unwrap() = filler_list.clone();
control.filler_list.lock().unwrap().clone_from(&filler_list);
}
}

View File

@ -115,7 +115,7 @@ pub fn read_json(
let mut current_file = playlist_path.as_path().display().to_string();
if let Some(p) = path {
playlist_path = Path::new(&p).to_owned();
Path::new(&p).clone_into(&mut playlist_path);
current_file = p
}

View File

@ -210,7 +210,7 @@ pub fn validate_playlist(
// Filter out same item in current playlist, then add the probe to it.
// Check also if duration differs with playlist value, log error if so and adjust that value.
list.iter_mut().filter(|list_item| list_item.source == item.source).for_each(|o| {
o.probe = item.probe.clone();
o.probe.clone_from(&item.probe);
if let Some(dur) =
item.probe.as_ref().and_then(|f| f.format.duration.clone())
@ -228,7 +228,7 @@ pub fn validate_playlist(
}
if o.audio == item.audio && item.probe_audio.is_some() {
o.probe_audio = item.probe_audio.clone();
o.probe_audio.clone_from(&item.probe_audio);
o.duration_audio = item.duration_audio;
}
});