Skip to content

Commit 3113780

Browse files
Fix: don't include inferred properties in the serialized recipe
1 parent 135f3ac commit 3113780

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

src/skeleton/read.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ pub(super) fn manifests<P: AsRef<Path>>(
6767
let contents = fs::read_to_string(&absolute_path)?;
6868

6969
let mut parsed = cargo_manifest::Manifest::from_str(&contents)?;
70+
// The completions are relevant for our analysis, but we shouldn't
71+
// include them in the final output.
72+
let before_completions = toml::Value::try_from(&parsed)?;
73+
7074
// Required to detect bin/libs when the related section is omitted from the manifest
7175
parsed.complete_from_path(&absolute_path)?;
7276

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

104108
manifests.push(ParsedManifest {
105109
relative_path,
106-
contents: intermediate,
110+
contents: before_completions,
107111
targets: targets.into_iter().collect(),
108112
});
109113
}

tests/skeletons.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,7 @@ version = "1.8.1"
673673
name = "test-dummy"
674674
plugin = false
675675
proc-macro = false
676-
edition = "2018"
677676
required-features = []
678-
crate-type = ["bin"]
679677
680678
[package]
681679
name = "project-a"
@@ -703,11 +701,8 @@ version = "1.8.1"
703701
path = "../project-a"
704702
705703
[lib]
706-
path = "src/lib.rs"
707-
name = "project_b"
708704
plugin = false
709705
proc-macro = false
710-
edition = "2018"
711706
required-features = []
712707
crate-type = ["cdylib"]
713708
"#]],
@@ -858,9 +853,7 @@ version = "1.8.1"
858853
name = "test-dummy"
859854
plugin = false
860855
proc-macro = false
861-
edition = "2018"
862856
required-features = []
863-
crate-type = ["bin"]
864857
865858
[package]
866859
name = "project_a"
@@ -883,11 +876,8 @@ version = "1.8.1"
883876
[dependencies]
884877
885878
[lib]
886-
path = "src/lib.rs"
887-
name = "project_b"
888879
plugin = false
889880
proc-macro = false
890-
edition = "2018"
891881
required-features = []
892882
crate-type = ["cdylib"]
893883
"#]],
@@ -1011,15 +1001,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
10111001
check(
10121002
&second.contents,
10131003
expect_test::expect![[r#"
1014-
[[bin]]
1015-
path = "src/main.rs"
1016-
name = "binary"
1017-
plugin = false
1018-
proc-macro = false
1019-
edition = "2021"
1020-
required-features = []
1021-
crate-type = ["bin"]
1022-
10231004
[package]
10241005
name = "binary"
10251006
edition = "2021"
@@ -1044,15 +1025,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
10441025
version = "0.0.1"
10451026
10461027
[dependencies]
1047-
1048-
[lib]
1049-
path = "src/lib.rs"
1050-
name = "without"
1051-
plugin = false
1052-
proc-macro = false
1053-
edition = "2021"
1054-
required-features = []
1055-
crate-type = ["lib"]
10561028
"#]],
10571029
);
10581030
}
@@ -1286,14 +1258,6 @@ anyhow = { workspace = true }
12861258
check(
12871259
&second.contents,
12881260
expect_test::expect![[r#"
1289-
[[bin]]
1290-
path = "src/main.rs"
1291-
name = "project_a"
1292-
plugin = false
1293-
proc-macro = false
1294-
required-features = []
1295-
crate-type = ["bin"]
1296-
12971261
[package]
12981262
name = "project_a"
12991263
@@ -1334,8 +1298,6 @@ anyhow = { workspace = true }
13341298
workspace = true
13351299
13361300
[lib]
1337-
path = "src/lib.rs"
1338-
name = "project_b"
13391301
plugin = false
13401302
proc-macro = false
13411303
required-features = []
@@ -1436,14 +1398,6 @@ version = "0.2.1"
14361398
version = "0.0.1"
14371399
path = "../b"
14381400
package = "b"
1439-
1440-
[lib]
1441-
path = "src/lib.rs"
1442-
name = "a"
1443-
plugin = false
1444-
proc-macro = false
1445-
required-features = []
1446-
crate-type = ["lib"]
14471401
"#]],
14481402
);
14491403
}

0 commit comments

Comments
 (0)