Skip to content

Commit

Permalink
Fix rustc 1.50 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanarijit committed May 25, 2021
1 parent b4247a7 commit 88aeddd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xplr"
version = "0.12.0" # Update lua.rs
version = "0.12.1" # Update lua.rs
authors = ["Arijit Basu <[email protected]>"]
edition = "2018"
description = "A hackable, minimal, fast TUI file explorer"
Expand Down
5 changes: 3 additions & 2 deletions src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ mod test {
fn test_compatibility() {
assert!(check_version(VERSION, "foo path").is_ok());
assert!(check_version("0.12.0", "foo path").is_ok());
assert!(check_version("0.12.1", "foo path").is_ok());

assert!(check_version("0.12.1", "foo path").is_err());
assert!(check_version("0.10.0", "foo path").is_err());
assert!(check_version("0.12.2", "foo path").is_err());
assert!(check_version("0.11.0", "foo path").is_err());
assert!(check_version("1.12.0", "foo path").is_err());
}
}
9 changes: 5 additions & 4 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,9 @@ fn draw_table<B: Backend>(
})
.unwrap_or_default();

let (mimetype, mimesub) =
node.mime_essence().split_once("/").unwrap_or_default();
let mut me = node.mime_essence().splitn(2, '/');
let mimetype: String = me.next().map(|s| s.into()).unwrap_or_default();
let mimesub: String = me.next().map(|s| s.into()).unwrap_or_default();

let node_type = app_config
.node_types()
Expand All @@ -487,8 +488,8 @@ fn draw_table<B: Backend>(
app_config
.node_types()
.mime_essence()
.get(mimetype)
.and_then(|t| t.get(mimesub).or_else(|| t.get("*")))
.get(&mimetype)
.and_then(|t| t.get(&mimesub).or_else(|| t.get("*")))
})
.unwrap_or_else(|| {
if node.is_symlink() {
Expand Down

0 comments on commit 88aeddd

Please sign in to comment.