Skip to content

Commit

Permalink
Replaced config.get_table() with a more succinct config.get<BTreeMap>…
Browse files Browse the repository at this point in the history
…() when listing aliases.
  • Loading branch information
zachlute committed Nov 9, 2019
1 parent ff3e880 commit 0f157f5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/bin/cargo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![warn(clippy::needless_borrow)]
#![warn(clippy::redundant_clone)]

use std::collections::BTreeSet;
use std::collections::{BTreeMap, BTreeSet};
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -115,11 +115,8 @@ fn list_commands(config: &Config) -> BTreeSet<CommandInfo> {

/// List all runnable aliases
fn list_aliases(config: &Config) -> Vec<String> {
match config.get_table("alias") {
Ok(table) => match table {
Some(aliases) => aliases.val.keys().map(|a| a.to_string()).collect(),
None => Vec::new(),
},
match config.get::<BTreeMap<String, String>>("alias") {
Ok(aliases) => aliases.keys().map(|a| a.to_string()).collect(),
Err(_) => Vec::new(),
}
}
Expand Down

0 comments on commit 0f157f5

Please sign in to comment.