Skip to content

Commit

Permalink
Fix: don't include inferred properties in the serialized recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker committed Jan 13, 2025
1 parent 135f3ac commit 3113780
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 47 deletions.
6 changes: 5 additions & 1 deletion src/skeleton/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ pub(super) fn manifests<P: AsRef<Path>>(
let contents = fs::read_to_string(&absolute_path)?;

let mut parsed = cargo_manifest::Manifest::from_str(&contents)?;
// The completions are relevant for our analysis, but we shouldn't
// include them in the final output.
let before_completions = toml::Value::try_from(&parsed)?;

// Required to detect bin/libs when the related section is omitted from the manifest
parsed.complete_from_path(&absolute_path)?;

Expand Down Expand Up @@ -103,7 +107,7 @@ pub(super) fn manifests<P: AsRef<Path>>(

manifests.push(ParsedManifest {
relative_path,
contents: intermediate,
contents: before_completions,
targets: targets.into_iter().collect(),
});
}
Expand Down
46 changes: 0 additions & 46 deletions tests/skeletons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,7 @@ version = "1.8.1"
name = "test-dummy"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["bin"]
[package]
name = "project-a"
Expand Down Expand Up @@ -703,11 +701,8 @@ version = "1.8.1"
path = "../project-a"
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["cdylib"]
"#]],
Expand Down Expand Up @@ -858,9 +853,7 @@ version = "1.8.1"
name = "test-dummy"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["bin"]
[package]
name = "project_a"
Expand All @@ -883,11 +876,8 @@ version = "1.8.1"
[dependencies]
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["cdylib"]
"#]],
Expand Down Expand Up @@ -1011,15 +1001,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
check(
&second.contents,
expect_test::expect![[r#"
[[bin]]
path = "src/main.rs"
name = "binary"
plugin = false
proc-macro = false
edition = "2021"
required-features = []
crate-type = ["bin"]
[package]
name = "binary"
edition = "2021"
Expand All @@ -1044,15 +1025,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
version = "0.0.1"
[dependencies]
[lib]
path = "src/lib.rs"
name = "without"
plugin = false
proc-macro = false
edition = "2021"
required-features = []
crate-type = ["lib"]
"#]],
);
}
Expand Down Expand Up @@ -1286,14 +1258,6 @@ anyhow = { workspace = true }
check(
&second.contents,
expect_test::expect![[r#"
[[bin]]
path = "src/main.rs"
name = "project_a"
plugin = false
proc-macro = false
required-features = []
crate-type = ["bin"]
[package]
name = "project_a"
Expand Down Expand Up @@ -1334,8 +1298,6 @@ anyhow = { workspace = true }
workspace = true
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
required-features = []
Expand Down Expand Up @@ -1436,14 +1398,6 @@ version = "0.2.1"
version = "0.0.1"
path = "../b"
package = "b"
[lib]
path = "src/lib.rs"
name = "a"
plugin = false
proc-macro = false
required-features = []
crate-type = ["lib"]
"#]],
);
}
Expand Down

0 comments on commit 3113780

Please sign in to comment.