Skip to content

Commit

Permalink
formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
balanza committed Nov 7, 2024
1 parent da109ef commit d6f6ccb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
27 changes: 14 additions & 13 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::{fs, io::{self, Read}};
use std::{
fs,
io::{self, Read},
};

#[derive(Debug)]
pub struct Scenario {
Expand All @@ -10,14 +13,15 @@ pub struct Scenario {
fn get_config_from_stdin() -> String {
let mut piped_input = String::new();
match io::stdin().read_to_string(&mut piped_input) {
Ok(len) => {
match len {
0 => String::new(),
_ => piped_input
}
Ok(len) => match len {
0 => String::new(),
_ => piped_input,
},
Err(error) => {
println!("Error! could not read from stdin the photofinish config file\n: {}", error);
println!(
"Error! could not read from stdin the photofinish config file\n: {}",
error
);
String::new()
}
}
Expand All @@ -31,13 +35,10 @@ pub fn get_config_file_content() -> String {

match piped_config.as_str() {
"" => {
println!(
"Error! Probably .photofinish.toml is missing\n{}",
err
);
println!("Error! Probably .photofinish.toml is missing\n{}", err);
String::new()
},
_ => piped_config
}
_ => piped_config,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async fn main() {
.await
{
Ok(()) => std::process::exit(exitcode::OK),
Err(()) => std::process::exit(1)
Err(()) => std::process::exit(1),
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ pub async fn run(
match selected_scenario {
None => {
println!("Non-existing scenario!");
return Err(())
},
return Err(());
}
Some(scenario) => {
let mut fixtures_in_directories: Vec<String> = scenario
.directories
Expand All @@ -123,9 +123,7 @@ pub async fn run(
retryable.push(FixtureResult::Retryable { file })
}
Ok(FixtureResult::Skippable | FixtureResult::Success) => (),
Ok(FixtureResult::Unauthorized) => {
return Err(())
},
Ok(FixtureResult::Unauthorized) => return Err(()),
Err(Errored { file, reason }) => {
println!("An error occurred in loading fixture {}: {}", file, reason)
}
Expand Down

0 comments on commit d6f6ccb

Please sign in to comment.