rust-lang-deprecated / error-chain

Error boilerplate for Rust
Apache License 2.0
729 stars 111 forks source link

Rename lint unused_doc_comment to unused_doc_comments #246

Closed hoodie closed 6 years ago

bjgill commented 6 years ago

This looks to be a useful PR, thanks. Is this back-compatible? The travis failure perhaps suggests not.

EDIT: it looks as if you might want something like:

diff --git a/src/error_chain.rs b/src/error_chain.rs
index ddba192..3ef7dc2 100644
--- a/src/error_chain.rs
+++ b/src/error_chain.rs
@@ -179,7 +179,7 @@ macro_rules! impl_error_chain_processed {
                 self.description()
             }

-            #[allow(unknown_lints, unused_doc_comments)]
+            #[allow(unknown_lints, unused_doc_comment, unused_doc_comment, unused_doc_comments)]
             fn cause(&self) -> Option<&::std::error::Error> {
                 match self.1.next_error {
                     Some(ref c) => Some(&**c),
@@ -421,7 +421,7 @@ macro_rules! impl_extract_backtrace {
     ($error_name: ident
      $error_kind_name: ident
      $([$link_error_path: path, $(#[$meta_links: meta])*])*) => {
-        #[allow(unknown_lints, unused_doc_comments)]
+        #[allow(unknown_lints, unused_doc_comment, unused_doc_comments)]
         fn extract_backtrace(e: &(::std::error::Error + Send + 'static))
             -> Option<$crate::InternalBacktrace> {
             if let Some(e) = e.downcast_ref::<$error_name>() {
diff --git a/src/impl_error_chain_kind.rs b/src/impl_error_chain_kind.rs
index 2d51a92..6c89d00 100644
--- a/src/impl_error_chain_kind.rs
+++ b/src/impl_error_chain_kind.rs
@@ -224,7 +224,7 @@ macro_rules! impl_error_chain_kind {
             $item:ident: $imode:tt [$(#[$imeta:meta])*] [$( $var:ident: $typ:ty ),*] {$( $funcs:tt )*}
         )*}
     ) => {
-        #[allow(unknown_lints, unused, unused_doc_comments)]
+        #[allow(unknown_lints, unused, unused_doc_comment, unused_doc_comments)]
         impl ::std::fmt::Display for $name {
             fn fmt(&self, fmt: &mut ::std::fmt::Formatter)
                 -> ::std::fmt::Result
@@ -247,7 +247,7 @@ macro_rules! impl_error_chain_kind {
                 }
             }
         }
-        #[allow(unknown_lints, unused, unused_doc_comments)]
+        #[allow(unknown_lints, unused, unused_doc_comment, unused_doc_comments)]
         impl $name {
             /// A string describing the error kind.
             pub fn description(&self) -> &str {
df5602 commented 6 years ago

@bjgill Won't this still generate the same warnings that prompted this pull request? (see issue #245 )

bjgill commented 6 years ago

Good point - we also need to allow renamed_and_removed_lints. I've done that in https://github.com/bjgill/error-chain/tree/lint-problem, which compiles without warnings in both stable and nightly (c.f. this PR, which has warnings ins stable, and master, which has warnings in nightly).

@hoodie - do you want to take on my back-compatibility enhancement (or equivalent)? Otherwise, I'll open a new PR tomorrow.

TedDriggs commented 6 years ago

What are the cases that generate unused doc comments? If we can fix those, then we can remove the lint outright, and have no version compatibility concerns.

bjgill commented 6 years ago

I believe the problem is https://github.com/rust-lang-nursery/error-chain/issues/63 (attribute handling in links)

Yamakaky commented 6 years ago

Closing for #247