mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Minor code style improvements
This commit is contained in:
parent
7cb8ca65fc
commit
bcf3c3f9ef
12
src/main.rs
12
src/main.rs
@ -122,15 +122,13 @@ async fn real_main(mut opt: Opt) -> Result<()> {
|
|||||||
|
|
||||||
// Load course_names.toml file
|
// Load course_names.toml file
|
||||||
let course_names_path = opt.output.join("course_names.toml");
|
let course_names_path = opt.output.join("course_names.toml");
|
||||||
let course_names: HashMap<String, String>;
|
let course_names = if fs::metadata(&course_names_path).await.is_ok() {
|
||||||
|
// file exists, try to read it
|
||||||
if fs::metadata(&course_names_path).await.is_ok() {
|
toml::from_str(&fs::read_to_string(course_names_path).await.context("accessing course_names.toml")?).context("processing course_names.toml")?
|
||||||
fs::read_to_string(&course_names_path).await.context("reading course_names.toml")?;
|
|
||||||
course_names = toml::from_str(&fs::read_to_string(course_names_path).await?).unwrap();
|
|
||||||
} else {
|
} else {
|
||||||
// If file doesn't exist, initialise course_names with empty HashMap
|
// If file doesn't exist, initialise course_names with empty HashMap
|
||||||
course_names = HashMap::new();
|
HashMap::new()
|
||||||
}
|
};
|
||||||
|
|
||||||
if let Some(err) = error {
|
if let Some(err) = error {
|
||||||
warning!(err);
|
warning!(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user