Disable warning for unused doc comment

From time to time, in my code, I would like to make certain comment about a particular function and such.
If I use double slash, my IDE would color it gray, making it harder to look and the text would look like a commented piece of leftover code, while that comment is noted intentionally.
Resorted to use triple slash or /** ... **/ solved my problem, as the comment would be color green and very easy to look at. However, doing so makes the compiler spill out the warning:

warning: unused doc comment
...
rustdoc does not generate documentation for expressions

Does sound like a first world problem, but is there any way to mitigate this? Thank you.

You could change your editor's color scheme to make ordinary comments more readable; they often contain important information.

2 Likes

I comment out unused code a lot with double slash, I am fine with them being gray. However, intentional note should be in different color, but that would not work with double slash.

You can put #![allow(unused_doc_comments)] at the top of your lib.rs file

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.