Skip to content

Commit

Permalink
Hide Clone implementations during cfg(dev)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jul 21, 2022
1 parent 4c15d29 commit 707a76d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
# nightly is only used by cargo-minimal-versions to regenerate the lock file
- run: rustup toolchain add nightly --no-self-update
- name: Test all features
env:
RUSTFLAGS:
--cfg dev
run: cargo minimal-versions test --all-features --workspace
- name: Check snapshots
run: git diff --exit-code -- tests/out
Expand Down
4 changes: 2 additions & 2 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<T> Iterator for Range<T> {
/// Adding new items to the arena produces a strongly-typed [`Handle`].
/// The arena can be indexed using the given handle to obtain
/// a reference to the stored item.
#[derive(Clone)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "serialize", serde(transparent))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
Expand Down Expand Up @@ -413,7 +413,7 @@ mod tests {
///
/// `UniqueArena` is similar to [`Arena`]: If `Arena` is vector-like,
/// `UniqueArena` is `HashSet`-like.
#[derive(Clone)]
#[cfg_attr(not(dev), derive(Clone))]
pub struct UniqueArena<T> {
set: IndexSet<T>,

Expand Down
18 changes: 12 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ pub enum ImageClass {
}

/// A data type declared in the module.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[derive(Debug, Eq, Hash, PartialEq)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand All @@ -568,7 +569,8 @@ pub struct Type {
}

/// Enum with additional information, depending on the kind of type.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[derive(Debug, Eq, Hash, PartialEq)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -744,7 +746,8 @@ pub enum TypeInner {
}

/// Constant value.
#[derive(Clone, Debug, PartialEq)]
#[derive(Debug, PartialEq)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -1582,7 +1585,8 @@ pub struct FunctionResult {
}

/// A function defined in the module.
#[derive(Clone, Debug, Default)]
#[derive(Debug, Default)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -1646,7 +1650,8 @@ pub struct Function {
/// [`Location`]: Binding::Location
/// [`function`]: EntryPoint::function
/// [`stage`]: EntryPoint::stage
#[derive(Clone, Debug)]
#[derive(Debug)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -1676,7 +1681,8 @@ pub struct EntryPoint {
/// Alternatively, you can load an existing shader using one of the [available front ends][front].
///
/// When finished, you can export modules using one of the [available backends][back].
#[derive(Clone, Debug, Default)]
#[derive(Debug, Default)]
#[cfg_attr(not(dev), derive(Clone))]
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down

0 comments on commit 707a76d

Please sign in to comment.