Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Reduce use of Nightly features.
Browse files Browse the repository at this point in the history
resolves #228
  • Loading branch information
jeremyBanks committed Feb 14, 2020
1 parent 13c9de6 commit 2303e4a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
28 changes: 13 additions & 15 deletions src/bin/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,20 @@ fn unpack_tables() -> Tables {
pub fn read_table<T: DeserializeOwned>(
path: &str,
) -> Result<Vec<T>, Box<dyn std::error::Error>> {
let result: Result<Vec<T>, Box<dyn std::error::Error>> = try {
let file = File::open(path)?;
let buffer = BufReader::new(&file);
let deserializer = JsonDeserializer::from_reader(buffer);
let json_results = deserializer.into_iter::<JsonValue>();
json_results
.map(Result::unwrap)
.map(T::deserialize)
.map(Result::unwrap)
.collect()
};
match result {
Ok(result) => Ok(result),
Ok(match File::open(path) {
Ok(file) => {
let buffer = BufReader::new(&file);
let deserializer = JsonDeserializer::from_reader(buffer);
let json_results = deserializer.into_iter::<JsonValue>();
json_results
.map(Result::unwrap)
.map(T::deserialize)
.map(Result::unwrap)
.collect()
}
Err(err) => {
error!("Failed to load table: {:?}", err);
Ok(vec![])
vec![]
}
}
})
}
1 change: 0 additions & 1 deletion src/bin/speedruns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(try_blocks)]
#![allow(missing_docs, clippy::useless_attribute, clippy::useless_vec)]
#![warn(
missing_debug_implementations,
Expand Down
3 changes: 0 additions & 3 deletions src/lib/speedruns.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//! Tools to download, search, and mirror https://speedrun.com leaderboards.
#![feature(
arbitrary_self_types,
associated_type_defaults,
proc_macro_hygiene,
label_break_value,
slice_concat_ext,
option_unwrap_none,
never_type
)]
Expand Down

0 comments on commit 2303e4a

Please sign in to comment.