-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mz/enable all doctest warnings #1418
Conversation
dcc974b
to
2c893ff
Compare
let (client_key, server_key) = generate_keys(config); | ||
let (client_key, _server_key) = generate_keys(config); | ||
|
||
let clear_a = 27u8; | ||
let clear_b = 128u8; | ||
|
||
let a = FheUint8::encrypt(clear_a, &client_key); | ||
let b = FheUint8::encrypt(clear_b, &client_key); | ||
let _a = FheUint8::encrypt(clear_a, &client_key); | ||
let _b = FheUint8::encrypt(clear_b, &client_key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep the allow dead code in the tfhe/src/test_user_docs.rs otherwise the outside facing documentation will look very weird
@@ -59,5 +59,6 @@ Refer to the [installation documentation](installation.md) for configuration opt | |||
The `prelude` pattern provides a convenient way to globally import all important **TFHE-rs** traits at once. This approach saves time and avoids confusion. | |||
|
|||
```rust | |||
#[allow(unused_imports)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow that too for the .md docs
tfhe/src/boolean/client_key/mod.rs
Outdated
/// let cks = ClientKey::new(&PARAMETERS_ERROR_PROB_2_POW_MINUS_165); | ||
/// let _cks = ClientKey::new(&PARAMETERS_ERROR_PROB_2_POW_MINUS_165); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this makes sense for doctests
// Enable all warnings in doctests | ||
// https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#showing-warnings-in-doctests | ||
#![doc(test(attr(warn(unused))))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so as I said somewhere else, let's not have that in the user facing docs, otherwise it just looks ridiculous, I'm not convinced for doctests in general either, it looks very bad to have to essentially to prefix everything with _, but I'm guessing we are missing the unused imports if we allow that in that case ?
dab66f2
to
2eeb8dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the changes that are relevant but we don't want to have to rename our variables for doc tests and our md docs
2eeb8dc
to
503d457
Compare
85389e1
to
5098e47
Compare
5098e47
to
8f46d03
Compare
@@ -59,5 +59,6 @@ Refer to the [installation documentation](installation.md) for configuration opt | |||
The `prelude` pattern provides a convenient way to globally import all important **TFHE-rs** traits at once. This approach saves time and avoids confusion. | |||
|
|||
```rust | |||
# #[allow(unused_imports)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this show up in the gitbook doc ?
unfortunately in the .md files we should not have allow attributes otherwise people reading the doc will see those appear in the HTML most likely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this show up in the gitbook doc ?
Indeed
unfortunately in the .md files we should not have allow attributes otherwise people reading the doc will see those appear in the HTML most likely
It seems like it's not possible to ignore doctest warnings by module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the global lib warn cannot be overriden later ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently not
I tried a few different ways but it didn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it be added in modules except docs ? like in high_level, integer, shortint, core ? or is it a always a lib attribute ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's an attribute so unless we do it on a per module basis I don't think we can undo it, what a lame way to enable stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://doc.rust-lang.org/nightly/rustdoc/write-documentation/the-doc-attribute.html#testattr
It's in the section "At the crate level"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error says "error: this attribute can only be applied at the crate level"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙄 what a weird design
8f46d03
to
a6e17b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot !
Please don't forget to create a follow up issue :)
a6e17b1
to
78acbf3
Compare
No description provided.