refactor: sort of some complete type (#253)

pull/254/head
sigoden 6 months ago committed by GitHub
parent 18f16c6511
commit c58912ba64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -473,12 +473,10 @@ impl Config {
} else {
return vec![];
};
let mut values: Vec<String> = values
values
.into_iter()
.filter(|v| v.starts_with(filter))
.collect();
values.sort_unstable();
values
.collect()
}
pub fn update(&mut self, data: &str) -> Result<()> {
@ -616,6 +614,7 @@ impl Config {
names.push(name.to_string());
}
}
names.sort_unstable();
names
}
Err(_) => vec![],

@ -86,8 +86,7 @@ impl ReplCompleter {
pub fn new(config: &GlobalConfig) -> Self {
let mut groups = HashMap::new();
let mut commands: Vec<ReplCommand> = REPL_COMMANDS.to_vec();
commands.sort_by(|a, b| a.name.cmp(b.name));
let commands: Vec<ReplCommand> = REPL_COMMANDS.to_vec();
for cmd in REPL_COMMANDS.iter() {
let name = cmd.name;

Loading…
Cancel
Save