Docs.rs: Please install `rustfmt` to the docs.rs doc build environment

Created on 20 May 2019  路  12Comments  路  Source: rust-lang/docs.rs

My crate builds bindings, and the bindings output comes out as all one line without rustfmt available.

All 12 comments

@Lokathor It looks like this is fixed in new versions of fermium, probably because of #407. Can you take a look at https://docs.rs/fermium/0.1.4/src/fermium/SDL2-v2.0.8-x86_64-pc-windows-msvc.rs.html#4692-4695 and make sure it looks about right?

Well, that's correct, but probably because I have since stopped using bindgen on docs.rs. The file you linked is just permanently in the repo: https://github.com/Lokathor/fermium/blob/master/src/SDL2-v2.0.8-x86_64-pc-windows-msvc.rs

but i guess we can close this and someone else will report if it's still a problem later.

I'd actually rather keep it open until I know it's fixed, sorry we took so long you found a workaround instead.

Mentoring instructions:

If you have any questions, feel free to reach out here or on Discord.

add_component requires two parameters:

self.toolchain.add_component(&self.workspace, "rustfmt")?;

@jyn514 the solution above didn't work...

What do you mean by didn't work? Can you put up a draft branch?

adding the command:

self.toolchain.add_component(&self.workspace, "rustfmt")?;

to update_toolchain

@elmurci can you join the discord so I can help you debug without spamming notifications for people watching the issue? https://discord.gg/f7mTXPW

I managed to fix it. Putting it here as it may help others.
The problem was due to a dependency (tonic-build) having rustfmt in its features section in cargo.toml:

...
[features]
default = ["transport", "rustfmt", "prost"]
...

I solved it by disabling tonic-build's rustfmt dependency in my project's cargo.toml:

...
[build-dependencies]
tonic-build = { version = "0.1.1", default-features = false, features = ["transport"] }
...

After doing this it built correctly.

@pietroalbini if rustfmt isn't available on the latest nightly, should we refuse to update the toolchain or instead remove the rustfmt component? I lean towards not updating but I could be convinced otherwise.

I'd prefer not updating as well.

Was this page helpful?
0 / 5 - 0 ratings