Skip to content

Commit 291ae1d

Browse files
authored
test: Omit All Error Conversions from Coverage (#784)
<!-- Thank you for your interest in contributing to OpenZeppelin! Consider opening an issue for discussion prior to submitting a PR. New features will be merged faster if they were first discussed and designed with the team. Describe the changes introduced in this pull request. Include any context necessary for understanding the PR's purpose. --> <!-- Fill in with issue number --> Resolves #783
1 parent 9e5406a commit 291ae1d

File tree

23 files changed

+37
-0
lines changed

23 files changed

+37
-0
lines changed

contracts/src/access/control/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ pub enum Error {
114114
BadConfirmation(AccessControlBadConfirmation),
115115
}
116116

117+
#[cfg_attr(coverage_nightly, coverage(off))]
117118
impl MethodError for Error {
118119
fn encode(self) -> alloc::vec::Vec<u8> {
119120
self.into()

contracts/src/access/ownable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub enum Error {
5858
InvalidOwner(OwnableInvalidOwner),
5959
}
6060

61+
#[cfg_attr(coverage_nightly, coverage(off))]
6162
impl MethodError for Error {
6263
fn encode(self) -> alloc::vec::Vec<u8> {
6364
self.into()

contracts/src/finance/vesting_wallet.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ pub enum Error {
113113
InvalidToken(InvalidToken),
114114
}
115115

116+
#[cfg_attr(coverage_nightly, coverage(off))]
116117
impl From<ownable::Error> for Error {
117118
fn from(value: ownable::Error) -> Self {
118119
match value {
@@ -124,6 +125,7 @@ impl From<ownable::Error> for Error {
124125
}
125126
}
126127

128+
#[cfg_attr(coverage_nightly, coverage(off))]
127129
impl From<stylus_sdk::call::Error> for Error {
128130
fn from(value: stylus_sdk::call::Error) -> Self {
129131
match value {
@@ -139,6 +141,7 @@ impl From<stylus_sdk::call::Error> for Error {
139141
}
140142
}
141143

144+
#[cfg_attr(coverage_nightly, coverage(off))]
142145
impl From<safe_erc20::Error> for Error {
143146
fn from(value: safe_erc20::Error) -> Self {
144147
match value {
@@ -152,6 +155,7 @@ impl From<safe_erc20::Error> for Error {
152155
}
153156
}
154157

158+
#[cfg_attr(coverage_nightly, coverage(off))]
155159
impl MethodError for Error {
156160
fn encode(self) -> alloc::vec::Vec<u8> {
157161
self.into()

contracts/src/proxy/beacon/upgradeable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ pub enum Error {
4444
InvalidOwner(ownable::OwnableInvalidOwner),
4545
}
4646

47+
#[cfg_attr(coverage_nightly, coverage(off))]
4748
impl MethodError for Error {
4849
fn encode(self) -> alloc::vec::Vec<u8> {
4950
self.into()
5051
}
5152
}
5253

54+
#[cfg_attr(coverage_nightly, coverage(off))]
5355
impl From<ownable::Error> for Error {
5456
fn from(err: ownable::Error) -> Self {
5557
match err {

contracts/src/proxy/erc1967/utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub enum Error {
8080
FailedCallWithReason(address::FailedCallWithReason),
8181
}
8282

83+
#[cfg_attr(coverage_nightly, coverage(off))]
8384
impl From<address::Error> for Error {
8485
fn from(e: address::Error) -> Self {
8586
match e {
@@ -92,6 +93,7 @@ impl From<address::Error> for Error {
9293
}
9394
}
9495

96+
#[cfg_attr(coverage_nightly, coverage(off))]
9597
impl MethodError for Error {
9698
fn encode(self) -> alloc::vec::Vec<u8> {
9799
self.into()

contracts/src/proxy/utils/uups_upgradeable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub enum Error {
8585
FailedCallWithReason(address::FailedCallWithReason),
8686
}
8787

88+
#[cfg_attr(coverage_nightly, coverage(off))]
8889
impl From<erc1967::utils::Error> for Error {
8990
fn from(e: erc1967::utils::Error) -> Self {
9091
match e {
@@ -103,6 +104,7 @@ impl From<erc1967::utils::Error> for Error {
103104
}
104105
}
105106

107+
#[cfg_attr(coverage_nightly, coverage(off))]
106108
impl MethodError for Error {
107109
fn encode(self) -> alloc::vec::Vec<u8> {
108110
self.into()

contracts/src/token/common/erc2981.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub enum Error {
9898
InvalidTokenRoyaltyReceiver(ERC2981InvalidTokenRoyaltyReceiver),
9999
}
100100

101+
#[cfg_attr(coverage_nightly, coverage(off))]
101102
impl MethodError for Error {
102103
fn encode(self) -> alloc::vec::Vec<u8> {
103104
self.into()

contracts/src/token/erc1155/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ pub enum Error {
177177
InvalidArrayLength(ERC1155InvalidArrayLength),
178178
}
179179

180+
#[cfg_attr(coverage_nightly, coverage(off))]
180181
impl MethodError for Error {
181182
fn encode(self) -> alloc::vec::Vec<u8> {
182183
self.into()

contracts/src/token/erc20/extensions/capped.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub enum Error {
4242
InvalidCap(ERC20InvalidCap),
4343
}
4444

45+
#[cfg_attr(coverage_nightly, coverage(off))]
4546
impl MethodError for Error {
4647
fn encode(self) -> alloc::vec::Vec<u8> {
4748
self.into()

contracts/src/token/erc20/extensions/erc4626.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ pub enum Error {
146146
InvalidApprover(erc20::ERC20InvalidApprover),
147147
}
148148

149+
#[cfg_attr(coverage_nightly, coverage(off))]
149150
impl From<safe_erc20::Error> for Error {
150151
fn from(value: safe_erc20::Error) -> Self {
151152
match value {
@@ -159,6 +160,7 @@ impl From<safe_erc20::Error> for Error {
159160
}
160161
}
161162

163+
#[cfg_attr(coverage_nightly, coverage(off))]
162164
impl From<erc20::Error> for Error {
163165
fn from(value: erc20::Error) -> Self {
164166
match value {
@@ -176,6 +178,7 @@ impl From<erc20::Error> for Error {
176178
}
177179
}
178180

181+
#[cfg_attr(coverage_nightly, coverage(off))]
179182
impl MethodError for Error {
180183
fn encode(self) -> alloc::vec::Vec<u8> {
181184
self.into()

0 commit comments

Comments
 (0)