Skip to content

Commit c1a53f3

Browse files
committed
refactor(toml): Don't move lints to verify them
This is a hold over from when this was unstable
1 parent 0048f2f commit c1a53f3

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,11 @@ pub fn to_real_manifest(
519519

520520
let workspace_config = match (original_toml.workspace.as_ref(), package.workspace.as_ref()) {
521521
(Some(toml_config), None) => {
522-
let lints = toml_config.lints.clone();
523-
let lints = verify_lints(lints)?;
522+
verify_lints(toml_config.lints.as_ref())?;
524523
let inheritable = InheritableFields {
525524
package: toml_config.package.clone(),
526525
dependencies: toml_config.dependencies.clone(),
527-
lints,
526+
lints: toml_config.lints.clone(),
528527
_ws_root: package_root.to_path_buf(),
529528
};
530529
if let Some(ws_deps) = &inheritable.dependencies {
@@ -867,7 +866,7 @@ pub fn to_real_manifest(
867866
.clone()
868867
.map(|mw| lints_inherit_with(mw, || inherit()?.lints()))
869868
.transpose()?;
870-
let lints = verify_lints(lints)?;
869+
verify_lints(lints.as_ref())?;
871870
let default = manifest::TomlLints::default();
872871
let rustflags = lints_to_rustflags(lints.as_ref().unwrap_or(&default));
873872

@@ -1337,12 +1336,11 @@ fn to_virtual_manifest(
13371336
.transpose()?;
13381337
let workspace_config = match original_toml.workspace {
13391338
Some(ref toml_config) => {
1340-
let lints = toml_config.lints.clone();
1341-
let lints = verify_lints(lints)?;
1339+
verify_lints(toml_config.lints.as_ref())?;
13421340
let inheritable = InheritableFields {
13431341
package: toml_config.package.clone(),
13441342
dependencies: toml_config.dependencies.clone(),
1345-
lints,
1343+
lints: toml_config.lints.clone(),
13461344
_ws_root: root.to_path_buf(),
13471345
};
13481346
let ws_root_config = WorkspaceRootConfig::new(
@@ -1476,12 +1474,12 @@ struct ManifestContext<'a, 'b> {
14761474
features: &'a Features,
14771475
}
14781476

1479-
fn verify_lints(lints: Option<manifest::TomlLints>) -> CargoResult<Option<manifest::TomlLints>> {
1477+
fn verify_lints(lints: Option<&manifest::TomlLints>) -> CargoResult<()> {
14801478
let Some(lints) = lints else {
1481-
return Ok(None);
1479+
return Ok(());
14821480
};
14831481

1484-
for (tool, lints) in &lints {
1482+
for (tool, lints) in lints {
14851483
let supported = ["rust", "clippy", "rustdoc"];
14861484
if !supported.contains(&tool.as_str()) {
14871485
let supported = supported.join(", ");
@@ -1504,7 +1502,7 @@ fn verify_lints(lints: Option<manifest::TomlLints>) -> CargoResult<Option<manife
15041502
}
15051503
}
15061504

1507-
Ok(Some(lints))
1505+
Ok(())
15081506
}
15091507

15101508
fn lints_to_rustflags(lints: &manifest::TomlLints) -> Vec<String> {

0 commit comments

Comments
 (0)