Skip to content

Commit

Permalink
Rename Fuzzy to Alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
LuuuXXX committed Feb 22, 2024
1 parent a31184b commit 640c077
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/resolver-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub fn resolve_with_config_raw(
for summary in self.list.iter() {
let matched = match kind {
QueryKind::Exact => dep.matches(summary),
QueryKind::Fuzzy => true,
QueryKind::Alternatives => true,
QueryKind::Normalized => true,
};
if matched {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub(super) fn activation_error(
// Maybe the user mistyped the name? Like `dep-thing` when `Dep_Thing`
// was meant. So we try asking the registry for a `fuzzy` search for suggestions.
let candidates = loop {
match registry.query_vec(&new_dep, QueryKind::Fuzzy) {
match registry.query_vec(&new_dep, QueryKind::Alternatives) {
Poll::Ready(Ok(candidates)) => break candidates,
Poll::Ready(Err(e)) => return to_resolve_err(e),
Poll::Pending => match registry.block_until_ready() {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
let packages = self.packages.values().map(|p| &p.0);
let matches = packages.filter(|pkg| match kind {
QueryKind::Exact => dep.matches(pkg.summary()),
QueryKind::Fuzzy => true,
QueryKind::Alternatives => true,
QueryKind::Normalized => dep.matches(pkg.summary()),
});
for summary in matches.map(|pkg| pkg.summary().clone()) {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ impl<'cfg> Source for PathSource<'cfg> {
for s in self.packages.iter().map(|p| p.summary()) {
let matched = match kind {
QueryKind::Exact => dep.matches(s),
QueryKind::Fuzzy => true,
QueryKind::Alternatives => true,
QueryKind::Normalized => dep.matches(s),
};
if matched {
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
.query_inner(dep.package_name(), &req, &mut *self.ops, &mut |s| {
let matched = match kind {
QueryKind::Exact => dep.matches(s.as_summary()),
QueryKind::Fuzzy => true,
QueryKind::Alternatives => true,
QueryKind::Normalized => true,
};
if !matched {
Expand Down Expand Up @@ -832,7 +832,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
return Poll::Ready(Ok(()));
}
let mut any_pending = false;
if kind == QueryKind::Fuzzy || kind == QueryKind::Normalized {
if kind == QueryKind::Alternatives || kind == QueryKind::Normalized {
// Attempt to handle misspellings by searching for a chain of related
// names to the original name. The resolver will later
// reject any candidates that have the wrong name, and with this it'll
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub enum QueryKind {
/// Path/Git sources may return all dependencies that are at that URI,
/// whereas an `Registry` source may return dependencies that have the same
/// canonicalization.
Fuzzy,
Alternatives,
/// Match a denpendency in all ways and will normalize the package name.
/// Each source defines what normalizing means.
Normalized,
Expand Down

0 comments on commit 640c077

Please sign in to comment.