Skip to content

Commit 61ef06f

Browse files
authored
Merge pull request #17 from Nemo157/fix-target-tweak
Read string out of target name instead of serializing toml value to a string
2 parents e6c5102 + 09ac5c6 commit 61ef06f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/prepare.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,12 @@ impl<'a> TomlTweaker<'a> {
198198
value
199199
.iter()
200200
.filter_map(|t| t.as_table())
201-
.filter(|t| t.get("name").is_some())
202-
.map(|table| {
203-
let name = table.get("name").unwrap().to_string();
201+
.filter_map(|t| {
202+
t.get("name")
203+
.and_then(Value::as_str)
204+
.map(|n| (t, n.to_owned()))
205+
})
206+
.map(|(table, name)| {
204207
let path = table.get("path").map_or_else(
205208
|| dir.join(folder).join(name + ".rs"),
206209
|path| dir.join(path.as_str().unwrap()),

0 commit comments

Comments
 (0)