mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Enforce strict strategies parsing rule: Reject duplicate strategy in --strategies
(#545)
`cargo-binstall` should reject duplicate strategy in `--strategies` as it is illegal input and it cannot be interpreted reasonably. * Reject duplicate strategy in `--strategies` * Optimize `compute_resolvers`: Use `Vec::retain` instead of `Iterator::filter` plus collecting into `Vec`. * Optimize `compute_resolvers`: Reject `strategies.len() > Strategy::COUNT` * Improve err msg for cases where user disabled all strategies * Simplify `BinstallError::InvalidStrategies`: Takes `&'static str` instead of `&'static &'static str` since other variants are larger than 8B. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
bdb4b2070d
commit
83b2de3ea2
3 changed files with 31 additions and 25 deletions
|
@ -291,7 +291,7 @@ pub enum BinstallError {
|
|||
/// - Exit: 93
|
||||
#[error("Invalid strategies configured: {0}")]
|
||||
#[diagnostic(severity(error), code(binstall::strategies))]
|
||||
InvalidStrategies(&'static &'static str),
|
||||
InvalidStrategies(&'static str),
|
||||
|
||||
/// Fallback to `cargo-install` is disabled.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue