Skip to content

Commit 65eb53c

Browse files
More clippy fixes
1 parent 54d19e2 commit 65eb53c

File tree

12 files changed

+62
-69
lines changed

12 files changed

+62
-69
lines changed

src/api/asset.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ impl Api {
2424
Ok(serde_json::from_value(commands::get(
2525
&self.authentication,
2626
&format!(
27-
"v4/assets?select=signature&app_id=eq.{}&app_revision=eq.{}&type=eq.edge-app-file",
28-
app_id, revision
27+
"v4/assets?select=signature&app_id=eq.{app_id}&app_revision=eq.{revision}&type=eq.edge-app-file"
2928
),
3029
)?)?)
3130
}
@@ -38,8 +37,7 @@ impl Api {
3837
let response = commands::get(
3938
&self.authentication,
4039
&format!(
41-
"v4/assets?select=status,processing_error,title&app_id=eq.{}&app_revision=eq.{}&status=neq.finished",
42-
app_id, revision
40+
"v4/assets?select=status,processing_error,title&app_id=eq.{app_id}&app_revision=eq.{revision}&status=neq.finished"
4341
),
4442
)?;
4543

src/api/version.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ impl Api {
3030
let response = commands::get(
3131
&self.authentication,
3232
&format!(
33-
"v4.1/edge-apps/versions?select=user_version,description,icon,author,homepage_url,revision,ready_signal&app_id=eq.{}&order=revision.desc&limit=1",
34-
app_id
33+
"v4.1/edge-apps/versions?select=user_version,description,icon,author,homepage_url,revision,ready_signal&app_id=eq.{app_id}&order=revision.desc&limit=1"
3534
),
3635
)?;
3736

src/authentication.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn verify_and_store_token(
130130

131131
fn verify_token(token: &str, api_url: &str) -> anyhow::Result<(), AuthenticationError> {
132132
// Using uuid of non existing playlist. If we get 404 it means we authenticated successfully.
133-
let url = format!("{}/v3/groups/11CF9Z3GZR0005XXKH00F8V20R/", api_url);
133+
let url = format!("{api_url}/v3/groups/11CF9Z3GZR0005XXKH00F8V20R/");
134134
let secret = format!("Token {token}");
135135
let client = reqwest::blocking::Client::builder().build()?;
136136

src/cli.rs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ pub fn handle_command_execution_result<T: Formatter>(
441441
)
442442
}
443443
_ => {
444-
error!("Error occurred: {:?}", e);
444+
error!("Error occurred: {e:?}");
445445
}
446446
}
447447
std::process::exit(1);
@@ -511,7 +511,7 @@ pub fn handle_cli(cli: &Cli) {
511511
std::process::exit(1);
512512
}
513513
_ => {
514-
error!("Error occurred: {:?}", e);
514+
error!("Error occurred: {e:?}");
515515
std::process::exit(1);
516516
}
517517
},
@@ -538,7 +538,7 @@ fn get_user_input() -> String {
538538
match stdin.read_line(&mut user_input) {
539539
Ok(_) => {}
540540
Err(e) => {
541-
error!("Error occurred: {}", e);
541+
error!("Error occurred: {e}");
542542
std::process::exit(1);
543543
}
544544
}
@@ -563,15 +563,15 @@ pub fn handle_cli_screen_command(command: &ScreenCommands) {
563563
ScreenCommands::Delete { uuid } => {
564564
match get_screen_name(uuid, &screen_command) {
565565
Ok(name) => {
566-
info!("You are about to delete the screen named \"{}\". This operation cannot be reversed.", name);
566+
info!("You are about to delete the screen named \"{name}\". This operation cannot be reversed.");
567567
info!("Enter the screen name to confirm the screen deletion: ");
568568
if name != get_user_input() {
569569
error!("The name you entered is incorrect. Aborting.");
570570
std::process::exit(1);
571571
}
572572
}
573573
Err(e) => {
574-
error!("Error occurred: {}", e);
574+
error!("Error occurred: {e}");
575575
std::process::exit(1);
576576
}
577577
}
@@ -582,7 +582,7 @@ pub fn handle_cli_screen_command(command: &ScreenCommands) {
582582
std::process::exit(0);
583583
}
584584
Err(e) => {
585-
error!("Error occurred: {:?}", e);
585+
error!("Error occurred: {e:?}");
586586
std::process::exit(1);
587587
}
588588
}
@@ -612,7 +612,7 @@ pub fn handle_cli_playlist_command(command: &PlaylistCommands) {
612612
match playlist_file {
613613
Ok(playlist) => {
614614
let pretty_playlist_file = serde_json::to_string_pretty(&playlist).unwrap();
615-
println!("{}", pretty_playlist_file);
615+
println!("{pretty_playlist_file}");
616616
}
617617
Err(e) => {
618618
eprintln!("Error occurred when getting playlist: {e:?}")
@@ -694,7 +694,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
694694
AssetCommands::Delete { uuid } => {
695695
match get_asset_title(uuid, &asset_command) {
696696
Ok(title) => {
697-
info!("You are about to delete the asset named \"{}\". This operation cannot be reversed.", title);
697+
info!("You are about to delete the asset named \"{title}\". This operation cannot be reversed.");
698698
info!("Enter the asset title to confirm the asset deletion: ");
699699
io::stdout().flush().unwrap();
700700

@@ -703,7 +703,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
703703
match stdin.read_line(&mut user_input) {
704704
Ok(_) => {}
705705
Err(e) => {
706-
error!("Error occurred: {}", e);
706+
error!("Error occurred: {e}");
707707
std::process::exit(1);
708708
}
709709
}
@@ -714,7 +714,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
714714
}
715715
}
716716
Err(e) => {
717-
error!("Error occurred: {}", e);
717+
error!("Error occurred: {e}");
718718
std::process::exit(1);
719719
}
720720
}
@@ -724,7 +724,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
724724
std::process::exit(0);
725725
}
726726
Err(e) => {
727-
error!("Error occurred: {:?}", e);
727+
error!("Error occurred: {e:?}");
728728
std::process::exit(1);
729729
}
730730
}
@@ -736,21 +736,21 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
736736
match response.status() {
737737
StatusCode::OK => response.text().unwrap_or_default(),
738738
status => {
739-
error!("Failed to retrieve JS injection code. Wrong response status: {}", status);
739+
error!("Failed to retrieve JS injection code. Wrong response status: {status}");
740740
std::process::exit(1);
741741
}
742742
}
743743
}
744744
Err(e) => {
745-
error!("Failed to retrieve JS injection code. Error: {}", e);
745+
error!("Failed to retrieve JS injection code. Error: {e}");
746746
std::process::exit(1);
747747
}
748748
}
749749
} else {
750750
match fs::read_to_string(path) {
751751
Ok(text) => text,
752752
Err(e) => {
753-
error!("Failed to read file with JS injection code. Error: {}", e);
753+
error!("Failed to read file with JS injection code. Error: {e}");
754754
std::process::exit(1);
755755
}
756756
}
@@ -761,7 +761,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
761761
info!("Asset updated successfully.");
762762
}
763763
Err(e) => {
764-
error!("Error occurred: {:?}", e);
764+
error!("Error occurred: {e:?}");
765765
std::process::exit(1);
766766
}
767767
}
@@ -772,7 +772,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
772772
info!("Asset updated successfully.");
773773
}
774774
Err(e) => {
775-
error!("Error occurred: {:?}", e);
775+
error!("Error occurred: {e:?}");
776776
std::process::exit(1);
777777
}
778778
}
@@ -787,7 +787,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
787787
info!("Asset updated successfully.");
788788
}
789789
Err(e) => {
790-
error!("Error occurred: {:?}", e);
790+
error!("Error occurred: {e:?}");
791791
std::process::exit(1);
792792
}
793793
}
@@ -798,7 +798,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
798798
info!("Asset updated successfully.");
799799
}
800800
Err(e) => {
801-
error!("Error occurred: {:?}", e);
801+
error!("Error occurred: {e:?}");
802802
std::process::exit(1);
803803
}
804804
}
@@ -812,7 +812,7 @@ pub fn handle_cli_asset_command(command: &AssetCommands) {
812812
info!("Asset updated successfully.");
813813
}
814814
Err(e) => {
815-
error!("Error occurred: {:?}", e);
815+
error!("Error occurred: {e:?}");
816816
std::process::exit(1);
817817
}
818818
}
@@ -864,8 +864,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
864864
} => match edge_app_command.deploy(path.clone(), *delete_missing_settings) {
865865
Ok(revision) => {
866866
println!(
867-
"Edge app successfully deployed. Revision: {revision}.",
868-
revision = revision
867+
"Edge app successfully deployed. Revision: {revision}."
869868
);
870869
}
871870
Err(e) => {
@@ -883,7 +882,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
883882
println!("Edge app setting successfully set.");
884883
}
885884
Err(e) => {
886-
eprintln!("Failed to set edge app setting: {}", e);
885+
eprintln!("Failed to set edge app setting: {e}");
887886
std::process::exit(1);
888887
}
889888
}
@@ -893,21 +892,21 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
893892
let actual_app_id = match edge_app_command.get_app_id(path.clone()) {
894893
Ok(id) => id,
895894
Err(e) => {
896-
error!("Error calling delete Edge App: {}", e);
895+
error!("Error calling delete Edge App: {e}");
897896
std::process::exit(1);
898897
}
899898
};
900899
match edge_app_command.get_app_name(&actual_app_id) {
901900
Ok(name) => {
902-
info!("You are about to delete the Edge App named \"{}\". This operation cannot be reversed.", name);
901+
info!("You are about to delete the Edge App named \"{name}\". This operation cannot be reversed.");
903902
info!("Enter the Edge App name to confirm the app deletion: ");
904903
if name != get_user_input() {
905904
error!("The name you entered is incorrect. Aborting.");
906905
std::process::exit(1);
907906
}
908907
}
909908
Err(e) => {
910-
error!("Error occurred: {}", e);
909+
error!("Error occurred: {e}");
911910
std::process::exit(1);
912911
}
913912
}
@@ -930,14 +929,14 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
930929
println!("App id cleared from manifest.");
931930
}
932931
Err(e) => {
933-
error!("Error occurred while clearing manifest: {}", e);
932+
error!("Error occurred while clearing manifest: {e}");
934933
std::process::exit(1);
935934
}
936935
}
937936
std::process::exit(0);
938937
}
939938
Err(e) => {
940-
error!("Error occurred: {:?}", e);
939+
error!("Error occurred: {e:?}");
941940
std::process::exit(1);
942941
}
943942
}
@@ -946,7 +945,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
946945
let actual_app_id = match edge_app_command.get_app_id(path.clone()) {
947946
Ok(id) => id,
948947
Err(e) => {
949-
error!("Error calling delete Edge App: {}", e);
948+
error!("Error calling delete Edge App: {e}");
950949
std::process::exit(1);
951950
}
952951
};
@@ -1071,7 +1070,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
10711070
let actual_app_id = match edge_app_command.get_app_id(path.clone()) {
10721071
Ok(id) => id,
10731072
Err(e) => {
1074-
error!("Error calling list instances: {}", e);
1073+
error!("Error calling list instances: {e}");
10751074
std::process::exit(1);
10761075
}
10771076
};
@@ -1084,7 +1083,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
10841083
let actual_app_id = match edge_app_command.get_app_id(path.clone()) {
10851084
Ok(id) => id,
10861085
Err(e) => {
1087-
error!("Error calling create instance: {}", e);
1086+
error!("Error calling create instance: {e}");
10881087
std::process::exit(1);
10891088
}
10901089
};
@@ -1121,7 +1120,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
11211120
match edge_app_command.get_installation_id(path.clone()) {
11221121
Ok(_installation_id) => _installation_id,
11231122
Err(e) => {
1124-
error!("Error calling delete setting: {}", e);
1123+
error!("Error calling delete setting: {e}");
11251124
std::process::exit(1);
11261125
}
11271126
};
@@ -1136,7 +1135,7 @@ pub fn handle_cli_edge_app_command(command: &EdgeAppCommands) {
11361135
}
11371136
},
11381137
Err(e) => {
1139-
eprintln!("Failed to delete edge app instance. {:?}", e);
1138+
eprintln!("Failed to delete edge app instance. {e:?}");
11401139
std::process::exit(1);
11411140
}
11421141
};
@@ -1212,7 +1211,7 @@ mod tests {
12121211

12131212
assert_eq!(
12141213
new_path,
1215-
PathBuf::from(format!("{}/screenly.yml", dir_path))
1214+
PathBuf::from(format!("{dir_path}/screenly.yml"))
12161215
);
12171216
}
12181217

src/commands/edge_app/app.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl EdgeAppCommand {
181181
Err(_) => true,
182182
};
183183

184-
debug!("File tree changed: {}", file_tree_changed);
184+
debug!("File tree changed: {file_tree_changed}");
185185
if !self.requires_upload(&changed_files) && !file_tree_changed && !version_metadata_changed
186186
{
187187
return Err(CommandError::NoChangesToUpload(
@@ -420,7 +420,7 @@ impl EdgeAppCommand {
420420
revision: u32,
421421
changed_files: &FileChanges,
422422
) -> Result<(), CommandError> {
423-
debug!("Changed files: {:#?}", changed_files);
423+
debug!("Changed files: {changed_files:#?}");
424424

425425
let copied_signatures = self.copy_edge_app_assets(
426426
app_id,
@@ -439,7 +439,7 @@ impl EdgeAppCommand {
439439
return Ok(());
440440
}
441441

442-
debug!("Uploading edge app files: {:#?}", files_to_upload);
442+
debug!("Uploading edge app files: {files_to_upload:#?}");
443443
let file_paths: Vec<PathBuf> = files_to_upload
444444
.iter()
445445
.map(|file| edge_app_dir.join(&file.path))
@@ -465,7 +465,7 @@ impl EdgeAppCommand {
465465
}
466466

467467
let prompt = format!("It seems like the setting \"{}\" is absent in the YAML file, but it exists on the server. If you wish to skip deletion, you can leave the input blank. Warning, deleting the setting will drop all the associated values. To proceed with deletion, please confirm the setting name by writing it down: ", setting.name);
468-
println!("{}", prompt);
468+
println!("{prompt}");
469469
io::stdin()
470470
.read_line(&mut input_name)
471471
.expect("Failed to read input");
@@ -534,7 +534,7 @@ impl EdgeAppCommand {
534534
let mut headers = HeaderMap::new();
535535
headers.insert("Prefer", "return=representation".parse()?);
536536

537-
debug!("Uploading file: {:?}", path);
537+
debug!("Uploading file: {path:?}");
538538
let form = reqwest::blocking::multipart::Form::new()
539539
.text(
540540
"title",
@@ -1833,7 +1833,7 @@ mod tests {
18331833
let result =
18341834
command.get_installation_id(Some(temp_dir.path().to_str().unwrap().to_string()));
18351835

1836-
println!("{:?}", result);
1836+
println!("{result:?}");
18371837
assert!(result.is_ok());
18381838
assert_eq!(result.unwrap(), "01H2QZ6Z8WXWNDC0KQ198XCZEB");
18391839
}

src/commands/edge_app/instance_manifest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ where
6868
match s.as_str() {
6969
INSTANCE_MANIFEST_VERSION => Ok(s),
7070
invalid => Err(serde::de::Error::custom(format!(
71-
"Invalid syntax: {}. Only 'instance_v1' is accepted.",
72-
invalid
71+
"Invalid syntax: {invalid}. Only 'instance_v1' is accepted."
7372
))),
7473
}
7574
}

0 commit comments

Comments
 (0)