Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the warning "doc comment not used by rustdoc" mean and how do I fix it?

Tags:

rust

The following code produces a warning when compiled:

pub fn add_source_path(request: &mut Request) -> IronResult<Response> {
/// Adds source path to the database.
///
/// This function saves provided absolute path (on the server) to the database
/// and goes over all jpeg files recursively in order to add them to DB.

let params = request.get_ref::<Params>().unwrap();

let path = &params["path"];

This is the warning:

warning: doc comment not used by rustdoc
--> src/crawler.rs:64:2
   |
64 |  /// Adds source path to the database.
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_doc_comment)] on by default

What exactly does this warning mean and how to fix it?

like image 566
victor_crimea Avatar asked Oct 15 '25 20:10

victor_crimea


1 Answers

Comments starting with /// are used to generate documentation. Those documentation comments go before the function they document. Quoting The Rust Programming Language:

Place documentation comments just before the item they’re documenting.

/// Adds source path to the database.
///
/// This function saves provided absolute path (on the server) to the database
/// and goes over all jpeg files recursively in order to add them to DB.
pub fn add_source_path(request: &mut Request) -> IronResult<Response> {
    // ...
}
like image 195
phimuemue Avatar answered Oct 18 '25 14:10

phimuemue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!