首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >警告"doc注释不被rustdoc使用“意味着什么,我如何修复它?

警告"doc注释不被rustdoc使用“意味着什么,我如何修复它?
EN

Stack Overflow用户
提问于 2018-10-28 06:27:06
回答 1查看 1.7K关注 0票数 3

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

代码语言:javascript
复制
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"];

这是一个警告:

代码语言:javascript
复制
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

这个警告究竟意味着什么,以及如何修正它?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-28 06:40:21

///开头的注释用于生成文档。这些文档注释在它们记录的功能之前。引用https://doc.rust-lang.org/book/second-edition/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments

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

代码语言:javascript
复制
/// 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> {
    // ...
}
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53028926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档