Apply rust_2024_incompatible_pat

This commit is contained in:
Eric Huss 2025-07-05 19:27:01 -07:00
parent 425af55326
commit 1213fc652b
9 changed files with 13 additions and 17 deletions

View File

@ -368,7 +368,7 @@ fn changed<'r, 'ws>(
for delta in diff.deltas() {
let old = delta.old_file().path().unwrap();
let new = delta.new_file().path().unwrap();
for (ref pkg_root, pkg) in ws_members.iter() {
for (pkg_root, pkg) in ws_members.iter() {
if old.starts_with(pkg_root) || new.starts_with(pkg_root) {
changed_members.insert(pkg.name().as_str(), *pkg);
break;

View File

@ -1003,7 +1003,7 @@ impl Target {
pub fn doctestable(&self) -> bool {
match self.kind() {
TargetKind::Lib(ref kinds) => kinds.iter().any(|k| {
TargetKind::Lib(kinds) => kinds.iter().any(|k| {
*k == CrateType::Rlib || *k == CrateType::Lib || *k == CrateType::ProcMacro
}),
_ => false,

View File

@ -447,7 +447,7 @@ fn activate_deps_loop(
frame
.remaining_siblings
.remaining()
.find_map(|(ref new_dep, _, _)| {
.find_map(|(new_dep, _, _)| {
past_conflicting_activations.conflicting(&resolver_ctx, new_dep)
})
{

View File

@ -584,7 +584,7 @@ impl<'gctx> Workspace<'gctx> {
packages.iter_mut().filter_map(move |(path, package)| {
if members.contains(path) {
if let MaybePackage::Package(ref mut p) = package {
if let MaybePackage::Package(p) = package {
return Some(p);
}
}
@ -615,7 +615,7 @@ impl<'gctx> Workspace<'gctx> {
packages.iter_mut().filter_map(move |(path, package)| {
if members.contains(path) {
if let MaybePackage::Package(ref mut p) = package {
if let MaybePackage::Package(p) = package {
return Some(p);
}
}
@ -722,7 +722,7 @@ impl<'gctx> Workspace<'gctx> {
if let Some(root_path) = &self.root_manifest {
let root_package = self.packages.load(root_path)?;
match root_package.workspace_config() {
WorkspaceConfig::Root(ref root_config) => {
WorkspaceConfig::Root(root_config) => {
return Ok(Some(root_config.clone()));
}

View File

@ -376,12 +376,12 @@ impl<'gctx> InstallablePackage<'gctx> {
// behavior for this fallback case as well.
if let CompileFilter::Only { bins, examples, .. } = &self.opts.filter {
let mut any_specific = false;
if let FilterRule::Just(ref v) = bins {
if let FilterRule::Just(v) = bins {
if !v.is_empty() {
any_specific = true;
}
}
if let FilterRule::Just(ref v) = examples {
if let FilterRule::Just(v) = examples {
if !v.is_empty() {
any_specific = true;
}

View File

@ -785,11 +785,7 @@ pub fn exe_names(pkg: &Package, filter: &ops::CompileFilter) -> BTreeSet<String>
.filter(|target| target.is_executable())
.map(|target| to_exe(target.name()))
.collect(),
CompileFilter::Only {
ref bins,
ref examples,
..
} => {
CompileFilter::Only { bins, examples, .. } => {
let collect = |rule: &_, f: fn(&Target) -> _| match rule {
FilterRule::All => pkg
.targets()

View File

@ -140,7 +140,7 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
None => {
let reg = super::infer_registry(&just_pkgs)?;
validate_registry(&just_pkgs, reg.as_ref())?;
if let Some(RegistryOrIndex::Registry(ref registry)) = &reg {
if let Some(RegistryOrIndex::Registry(registry)) = &reg {
if registry != CRATES_IO_REGISTRY {
// Don't warn for crates.io.
opts.gctx.shell().note(&format!(

View File

@ -956,7 +956,7 @@ fn load_inheritable_fields(
match workspace_config {
WorkspaceConfig::Root(root) => Ok(root.inheritable().clone()),
WorkspaceConfig::Member {
root: Some(ref path_to_root),
root: Some(path_to_root),
} => {
let path = normalized_path
.parent()
@ -1674,7 +1674,7 @@ pub fn to_real_manifest(
.normalized_publish()
.expect("previously normalized")
{
Some(manifest::VecStringOrBool::VecString(ref vecstring)) => Some(vecstring.clone()),
Some(manifest::VecStringOrBool::VecString(vecstring)) => Some(vecstring.clone()),
Some(manifest::VecStringOrBool::Bool(false)) => Some(vec![]),
Some(manifest::VecStringOrBool::Bool(true)) => None,
None => version.is_none().then_some(vec![]),

View File

@ -53,7 +53,7 @@ pub fn check_token(expected_token: Option<&str>, registry: Option<&str>) {
.get("registry")
.and_then(|registry_table| registry_table.get("token"))
.and_then(|v| match v {
toml::Value::String(ref token) => Some(token.as_str().to_string()),
toml::Value::String(token) => Some(token.as_str().to_string()),
_ => None,
}),
};