Closed hafeoz closed 2 years ago
Great, thanks :smile:
We could also remove the ,ignore
flag by adding an fn main {}
at the end of the code block.
So that this code block is tested when running mdbook test
in the CI.
Here is an example:
```rust
#[deny(bad_style,
const_err,
dead_code,
improper_ctypes,
non_shorthand_field_patterns,
no_mangle_generic_items,
overflowing_literals,
path_statements,
patterns_in_fns_without_body,
private_in_public,
unconditional_recursion,
unused,
unused_allocation,
unused_comparisons,
unused_parens,
while_true)]
fn main() {}
What do you think? :)
Great, thanks smile We could also remove the
,ignore
flag by adding anfn main {}
at the end of the code block. So that this code block is tested when runningmdbook test
in the CI.Here is an example:
```rust #[deny(bad_style, const_err, dead_code, improper_ctypes, non_shorthand_field_patterns, no_mangle_generic_items, overflowing_literals, path_statements, patterns_in_fns_without_body, private_in_public, unconditional_recursion, unused, unused_allocation, unused_comparisons, unused_parens, while_true)] fn main() {}
What do you think? :)
How about marking the attributes as inner attributes? LIke
#![deny(bad_style, ...)]
By doing this way, we won't need fn main() {}
in the code.
Oh, that's even better, yes!
Great, thanks smile We could also remove the
,ignore
flag by adding anfn main {}
at the end of the code block. So that this code block is tested when runningmdbook test
in the CI. Here is an example:```rust #[deny(bad_style, const_err, dead_code, improper_ctypes, non_shorthand_field_patterns, no_mangle_generic_items, overflowing_literals, path_statements, patterns_in_fns_without_body, private_in_public, unconditional_recursion, unused, unused_allocation, unused_comparisons, unused_parens, while_true)] fn main() {}
What do you think? :)
How about marking the attributes as inner attributes? LIke
#![deny(bad_style, ...)]
By doing this way, we won't need
fn main() {}
in the code.
Currently this modification fails to build due to rust-lang/rust#97440
ok, what do you prefer to do, then? All the proposed solutions work for me. The PR can even be merged as it is now.
ok, what do you prefer to do, then? For me, we can also merge this PR as it is.
I'm currently preparing for a PR to fix the ICE. In the meanwhile, maybe we should continue to mark the code block as ignore
until the PR is merged?
Sounds good to me. Should we merge this? rocket
I have changed lints to inner attributes👍 I think it's ready now
rustc -D nonstandard-style
is a valid syntax;#[deny(nonstandard_style)]
is also valid. However,#[deny(nonstandard-style)]
will cause:Which is confusing if someone is trying to copy-paste the code into their own.