complete_datastore_name: write more compact code

This commit is contained in:
Dietmar Maurer 2018-12-12 12:41:59 +01:00
parent 30d2e99c77
commit e3d40bb8cd
1 changed files with 2 additions and 12 deletions

View File

@ -79,18 +79,8 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> {
// shell completion helper
pub fn complete_datastore_name() -> Vec<String> {
let data = match config() {
Ok(data) => data,
match config() {
Ok(data) => data.sections.iter().map(|(id,_)| id.to_string()).collect(),
Err(_) => return vec![],
};
//let test = data.sections
let mut res = vec![];
for (id, _) in data.sections {
res.push(id);
}
res
}