警告“rustdoc 未使用文档注释”是什么意思以及如何修复它?

vic*_*mea 3 rust

以下代码在编译时会产生警告:

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"];
Run Code Online (Sandbox Code Playgroud)

这是警告:

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"];
Run Code Online (Sandbox Code Playgroud)

这个警告到底是什么意思以及如何解决它?

phi*_*mue 7

以 开头的注释///用于生成文档。这些文档注释位于它们所记录的函数之前。引用Rust 编程语言

\n\n
\n

将文档注释放在他们\xe2\x80\x99 正在记录的项目之前。

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