webern / cargo-readme

Generate README.md from docstrings
Other
350 stars 57 forks source link

Cargo.toml parsing expects path key when [lib] section is found. #32

Open mendelt opened 5 years ago

mendelt commented 5 years ago

Thank you for making cargo readme available. While using it I found a small issue

I tried running cargo readme on a crate with proc macro's in it. It had this section in its cargo.toml

[lib]
proc-macro = true

This causes cargo readme to fail with the error "Error: missing field path for key lib" First of all this error could be made clearer, where was this field missing? what file? But when the path key is not found it should just use the default src/lib.rs For now I can get around this by adding

path = "src/lib.rs"

to Cargo.toml

mendelt commented 5 years ago

I created a pull request where lib or bin sections without a path will just default to src/main.rs or src/lib.rs. If that's ok with you I can add some tests for it. I also found some deprecated warnings that I fixed. I'll add a separate pull request for those.

Charles-Johnson commented 4 years ago
path = "scr/lib.rs"

Should be path = "src/lib.rs"

mendelt commented 4 years ago

Should be path = "src/lib.rs"

Thanks! I fixed it. I had to read the text 10 times though before I saw where I mistyped :-)

cmrschwarz commented 3 months ago

Any updates on this? Unfortunately still happening 5 years later :sweat_smile: .