-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(install): don't warn for configured tools when version is passed via CLI #9522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ee96be0
172ea20
66dbf87
e956054
4d54b4d
516d513
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -147,14 +147,24 @@ impl Install { | |||||||||||||||||||||||||||||||
| .iter() | ||||||||||||||||||||||||||||||||
| .map(|ta| ta.ba.short.clone()) | ||||||||||||||||||||||||||||||||
| .collect(); | ||||||||||||||||||||||||||||||||
| // Collect inactive tool names before trs borrow is consumed | ||||||||||||||||||||||||||||||||
| // Collect set of tools that appear in any config file. We can't use | ||||||||||||||||||||||||||||||||
| // trs.sources here because load_runtime_args overrides the config-derived | ||||||||||||||||||||||||||||||||
| // source with ToolSource::Argument whenever the user passes TOOL@VERSION. | ||||||||||||||||||||||||||||||||
| let configured_tools: HashSet<String> = config | ||||||||||||||||||||||||||||||||
| .config_files | ||||||||||||||||||||||||||||||||
| .values() | ||||||||||||||||||||||||||||||||
| .filter_map(|cf| cf.to_tool_request_set().ok()) | ||||||||||||||||||||||||||||||||
| .flat_map(|cf_trs| { | ||||||||||||||||||||||||||||||||
| cf_trs | ||||||||||||||||||||||||||||||||
| .tools | ||||||||||||||||||||||||||||||||
| .keys() | ||||||||||||||||||||||||||||||||
| .map(|ba| ba.short.clone()) | ||||||||||||||||||||||||||||||||
| .collect::<Vec<_>>() | ||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||
| .collect(); | ||||||||||||||||||||||||||||||||
|
cursor[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| let inactive_tools: Vec<String> = expanded_runtimes | ||||||||||||||||||||||||||||||||
| .iter() | ||||||||||||||||||||||||||||||||
| .filter(|ta| { | ||||||||||||||||||||||||||||||||
| trs.sources | ||||||||||||||||||||||||||||||||
| .get(ta.ba.as_ref()) | ||||||||||||||||||||||||||||||||
| .is_none_or(|s| s.is_argument()) | ||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||
| .filter(|ta| !configured_tools.contains(&ta.ba.short)) | ||||||||||||||||||||||||||||||||
| .map(|ta| ta.ba.short.clone()) | ||||||||||||||||||||||||||||||||
| .collect(); | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the
Suggested change
|
||||||||||||||||||||||||||||||||
| let mut ts: Toolset = trs.filter_by_tool(tools).into(); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intermediate
Vecallocation insideflat_mapis unnecessary. You can chain the iterator directly to improve efficiency and readability.