aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2021-11-12 13:10:14 +0100
committerDaniel <kingdread@gmx.de>2021-11-12 13:10:14 +0100
commit14d90bcbe6cef70d0ab99cb3285038fbd6385efa (patch)
tree6978fc122e4e6ce905b0773921315c776de08cff /src
parent96187a020266cb07d516bb851ede988d7dea2be2 (diff)
downloadraidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.tar.gz
raidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.tar.bz2
raidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.zip
Update dependencies
Only minor changes are needed.
Diffstat (limited to 'src')
-rw-r--r--src/guilds.rs9
-rw-r--r--src/main.rs6
2 files changed, 5 insertions, 10 deletions
diff --git a/src/guilds.rs b/src/guilds.rs
index 24ec817..e847841 100644
--- a/src/guilds.rs
+++ b/src/guilds.rs
@@ -39,16 +39,11 @@ pub fn lookup(api_id: &str) -> Option<Guild> {
let mut cache = CACHE.write().unwrap();
let url = format!("https://api.guildwars2.com/v2/guild/{}", api_id);
- let result = ureq::get(&url)
+ let guild: Guild = ureq::get(&url)
.call()
+ .ok()?
.into_json()
.expect("Invalid JSON in API response");
- let name = result["name"].as_str()?;
- let tag = result["tag"].as_str()?;
- let guild = Guild {
- tag: tag.into(),
- name: name.into(),
- };
cache.insert(api_id.into(), guild.clone());
Some(guild)
}
diff --git a/src/main.rs b/src/main.rs
index 9149b17..256de97 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -388,7 +388,7 @@ fn repl(opt: &Opt) -> Result<()> {
loop {
let line = rl.readline("Query> ")?;
rl.add_history_entry(&line);
- maybe_save_history(&rl, history_path.as_ref().map(|r| r as &Path));
+ maybe_save_history(&mut rl, history_path.as_ref().map(|r| r as &Path));
let parsed = build_filter(&line);
INTERRUPTED.store(false, Ordering::Relaxed);
@@ -408,8 +408,8 @@ fn maybe_load_history(rl: &mut Editor<()>, path: Option<&Path>) {
}
}
-fn maybe_save_history(rl: &Editor<()>, path: Option<&Path>) {
- let run = |path: &Path| -> Result<()> {
+fn maybe_save_history(rl: &mut Editor<()>, path: Option<&Path>) {
+ let mut run = |path: &Path| -> Result<()> {
debug!("Saving history to {:?}", path);
let parent = path
.parent()