From 27b348dbcbd647d24b506ed70c61ebe23c2b087e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 21 Aug 2024 14:16:52 -0500 Subject: [PATCH] refactor(complete): Simplify ArgValueCandidates code --- clap_complete/src/engine/complete.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/clap_complete/src/engine/complete.rs b/clap_complete/src/engine/complete.rs index 34110062bee..24fc9cac291 100644 --- a/clap_complete/src/engine/complete.rs +++ b/clap_complete/src/engine/complete.rs @@ -351,12 +351,8 @@ fn complete_custom_arg_value( ) -> Vec { debug!("complete_custom_arg_value: completer={completer:?}, value={value:?}"); - let mut values = Vec::new(); - let custom_arg_values = completer.candidates(); - values.extend(custom_arg_values); - + let mut values = completer.candidates(); values.retain(|comp| comp.get_content().starts_with(&value.to_string_lossy())); - values }