Skip to content

Commit 3d7f3a6

Browse files
authored
Rollback
1 parent 540dc7f commit 3d7f3a6

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/main.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ use std::fs;
66
use std::path::Path;
77

88
fn main() {
9-
let home: String = std::env::var("HOME").unwrap();
10-
let path: &Path = Path::new(&home).join(".ssh");
11-
let mut arr: Vec<(String, String)> = Vec::new();
9+
let home = std::env::var("HOME").unwrap();
10+
let path = Path::new(&home).join(".ssh");
11+
let mut arr = Vec::new();
1212

1313
for entry in fs::read_dir(path).expect("Unable to list") {
1414
let entry = entry.expect("unable to get entry");
1515
let path = entry.path();
1616
let str = path.display().to_string();
1717

1818
if !str.contains("known_hosts") {
19-
arr.push((str.clone(), str));
19+
arr.push(str);
2020
}
2121
}
2222

23-
let mut select = SelectView::<(String, String)>::new().h_align(HAlign::Center).autojump();
23+
let mut select = SelectView::new().h_align(HAlign::Center).autojump();
2424

25-
select.add_all(arr);
25+
select.add_all_str(arr);
2626
select.set_on_submit(show_next_window);
2727

28-
let mut siv = Cursive::default();
28+
let mut siv = cursive::default();
2929

3030
siv.add_layer(Dialog::around(select.scrollable().fixed_size((40, 10))).title("My Keys"));
3131
siv.run();
3232
}
3333

34-
fn show_next_window(siv: &mut Cursive, str: &(String, String)) {
34+
fn show_next_window(siv: &mut Cursive, str: &str) {
3535
siv.pop_layer();
3636

37-
let contents = fs::read_to_string(&str.1).expect("Should have been able to read the file");
37+
let contents = fs::read_to_string(str).expect("Should have been able to read the file");
3838
let text = contents;
3939

4040
siv.add_layer(Dialog::around(TextView::new(text)).button("Quit", |s| s.quit()));
41-
}
41+
}

0 commit comments

Comments
 (0)