diff --git a/Cargo.toml b/Cargo.toml
index 46355ae1..004447d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -186,9 +186,6 @@ serialize = ["serde"] # "dep:" prefix only avalible from Rust 1.60
 [package.metadata.docs.rs]
 # document all features
 all-features = true
-# defines the configuration attribute `docs_rs` to enable feature requirements
-# See https://stackoverflow.com/questions/61417452
-rustdoc-args = ["--cfg", "docs_rs"]
 
 # Tests, benchmarks and examples doesn't included in package on crates.io,
 # so we need to specify a path, otherwise `cargo package` complains
diff --git a/src/lib.rs b/src/lib.rs
index db164e21..7cc37566 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -49,7 +49,8 @@
 #![recursion_limit = "1024"]
 // Enable feature requirements in the docs from 1.57
 // See https://stackoverflow.com/questions/61417452
-#![cfg_attr(docs_rs, feature(doc_auto_cfg))]
+// docs.rs defines `docsrs` when building documentation
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
 
 #[cfg(feature = "serialize")]
 pub mod de;