Skip to content

Commit

Permalink
Merge pull request #4023 from weiznich/fix/cfg_lint
Browse files Browse the repository at this point in the history
Fix all new unexpected_cfgs warnings
  • Loading branch information
pksunkara authored May 13, 2024
2 parents f2eb9b2 + 4f3d5e8 commit 56a39c0
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
sudo apt-get -y install libmysqlclient-dev libsqlite3-dev libpq-dev
- name: Build documentation
env:
RUSTFLAGS: "--cfg doc_cfg"
RUSTDOCFLAGS: "--cfg doc_cfg"
RUSTFLAGS: "--cfg docsrs"
RUSTDOCFLAGS: "--cfg docsrs"
run:
cargo +nightly doc --manifest-path diesel/Cargo.toml --features "postgres sqlite mysql extras i-implement-a-third-party-backend-and-opt-into-breaking-changes" --workspace

Expand Down
4 changes: 2 additions & 2 deletions diesel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ time = ["diesel_derives/time", "dep:time"]
[package.metadata.docs.rs]
features = ["postgres", "mysql", "sqlite", "extras"]
no-default-features = true
rustc-args = ["--cfg", "doc_cfg"]
rustdoc-args = ["--cfg", "doc_cfg"]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
4 changes: 2 additions & 2 deletions diesel/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ pub(crate) mod private {
///
/// [`QueryFragment`]: crate::query_builder::QueryFragment
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait DieselReserveSpecialization {}
Expand All @@ -572,7 +572,7 @@ pub(crate) mod private {
/// `i-implement-a-third-party-backend-and-opt-into-breaking-changes`
/// feature flag.
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait TrustedBackend {}
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ pub(crate) mod private {

/// This trait restricts who can implement `Connection`
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait ConnectionSealed {}
Expand All @@ -559,7 +559,7 @@ pub(crate) mod private {
/// to/from an `std::any::Any` reference. This is used internally by the `#[derive(MultiConnection)]`
/// implementation
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait MultiConnectionHelper: super::Connection {
Expand Down
12 changes: 6 additions & 6 deletions diesel/src/connection/statement_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ use super::Instrumentation;
/// A prepared statement cache
#[allow(missing_debug_implementations, unreachable_pub)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub struct StatementCache<DB: Backend, Statement> {
Expand All @@ -123,7 +123,7 @@ pub struct StatementCache<DB: Backend, Statement> {
/// preparing the statement
#[derive(Debug, Clone, Copy)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
#[allow(unreachable_pub)]
Expand Down Expand Up @@ -162,7 +162,7 @@ where
all(feature = "sqlite", test)
))]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub fn len(&self) -> usize {
Expand Down Expand Up @@ -251,7 +251,7 @@ where
/// function as a function that simply returns a constant `String`.
#[allow(unreachable_pub)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait QueryFragmentForCachedStatement<DB> {
Expand Down Expand Up @@ -283,7 +283,7 @@ where
/// that does not depend on [`ToOwned`]
#[allow(missing_debug_implementations, unreachable_pub)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
#[non_exhaustive]
Expand Down Expand Up @@ -323,7 +323,7 @@ impl<'a, T> DerefMut for MaybeCached<'a, T> {
#[allow(missing_debug_implementations, unreachable_pub)]
#[derive(Hash, PartialEq, Eq)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub enum StatementCacheKey<DB: Backend> {
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
//! - `32-column-tables`
#![cfg_attr(feature = "unstable", feature(trait_alias))]
#![cfg_attr(doc_cfg, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(feature = "128-column-tables", recursion_limit = "256")]
// Built-in Lints
#![warn(
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/pg/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct PgValue<'a> {
/// the implementation for `NonZeroU32` here instead
/// of providing their own custom implementation
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
#[allow(unreachable_pub)]
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/query_builder/ast_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ where
doc(hidden)
)] // This is used by the `define_sql_function` macro
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub fn backend(&self) -> &DB {
Expand All @@ -300,7 +300,7 @@ where
doc(hidden)
)] // This is used by the `__diesel_column` macro
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub fn should_skip_from(&self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/query_builder/limit_offset_clause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::query_builder::QueryId;
/// This type is only relevant for implementing custom backends
#[derive(Debug, Clone, Copy, QueryId)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub struct LimitOffsetClause<Limit, Offset> {
Expand All @@ -21,7 +21,7 @@ pub struct LimitOffsetClause<Limit, Offset> {
/// This type is only relevant for implementing custom backends
#[allow(missing_debug_implementations)]
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub struct BoxedLimitOffsetClause<'a, DB> {
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_dsl/load_dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod private {
}

#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
#[diagnostic::on_unimplemented(
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub(crate) mod private {

/// This trait restricts who can implement `Row`
#[cfg_attr(
doc_cfg,
docsrs,
doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
)]
pub trait RowSealed {}
Expand Down
2 changes: 1 addition & 1 deletion diesel_derives/src/diesel_public_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl EntryWithVisibility {
EntryWithVisibility::TraitFunction { meta, tail } if field_list.is_empty() => quote! {
#(#meta)*
#[cfg_attr(not(#cfg), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(#cfg)))]
#[cfg_attr(docsrs, doc(cfg(#cfg)))]
#tail
},
EntryWithVisibility::Item { meta, vis, tail } if field_list.is_empty() => {
Expand Down
2 changes: 1 addition & 1 deletion diesel_tests/tests/types_roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ fn mk_f64(f: DoubleWrapper) -> f64 {
impl quickcheck::Arbitrary for DoubleWrapper {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
let mut f = f64::arbitrary(g);
while (cfg!(feature = "sqlite") || cfg!(featuer = "mysql")) && f.is_nan() {
while (cfg!(feature = "sqlite") || cfg!(feature = "mysql")) && f.is_nan() {
f = f64::arbitrary(g);
}
DoubleWrapper(f)
Expand Down

0 comments on commit 56a39c0

Please sign in to comment.