Skip to content

Commit 700fd47

Browse files
committed
fix: silence nonminimal bool warnings
1 parent dee2b82 commit 700fd47

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

.cspell.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ words:
66
- nextest
77
- nixos
88
- nixpkgs
9+
- nonminimal
910
- pkgs
1011
- RUSTDOCFLAGS
1112
- taplo

examples/library.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ impl Library {
2424
self.available.insert(book_id.to_string());
2525
}
2626

27-
#[allow(clippy::nonminimal_bool)]
2827
#[debug_requires(self.book_exists(book_id))]
2928
#[ensures(ret -> self.available.len() == old(self.available.len()) - 1)]
3029
#[ensures(ret -> self.lent.len() == old(self.lent.len()) + 1)]

src/implementation/codegen.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,20 @@ pub(crate) fn generate(
185185

186186
if mode == ContractMode::LogOnly {
187187
result.extend(quote::quote_spanned! { span=>
188-
if !(#exec_expr) {
189-
log::error!("{}", #format_args);
188+
#[allow(clippy::nonminimal_bool)]
189+
{
190+
if !(#exec_expr) {
191+
log::error!("{}", #format_args);
192+
}
190193
}
191194
});
192195
}
193196

194197
if let Some(assert_macro) = get_assert_macro(ctype, mode, span) {
195198
result.extend(quote::quote_spanned! { span=>
196-
#assert_macro!(#exec_expr, "{}", #format_args);
199+
#[allow(clippy::nonminimal_bool)] {
200+
#assert_macro!(#exec_expr, "{}", #format_args);
201+
}
197202
});
198203
}
199204

tests/implication.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use contracts::*;
77
#[cfg(feature = "mirai_assertions")]
88
mod mirai_assertion_mocks;
99

10-
#[allow(clippy::nonminimal_bool)]
1110
#[test]
1211
fn test_ret_implication() {
1312
#[ensures(do_thing -> ret.is_some(), "do_thing should cause a Some(_)")]
@@ -24,7 +23,6 @@ fn test_ret_implication() {
2423
perform_thing(false);
2524
}
2625

27-
#[allow(clippy::nonminimal_bool)]
2826
#[test]
2927
fn test_ret_implication_old() {
3028
#[ensures(old(*x) % 2 == 0 -> *x % 2 == 0)]
@@ -40,7 +38,6 @@ fn test_ret_implication_old() {
4038
incr(&mut x);
4139
}
4240

43-
#[allow(clippy::nonminimal_bool)]
4441
#[test]
4542
fn test_requires_implication() {
4643
#[requires(!negative -> value >= 0)]

tests/issues.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ fn gl_issue_11() {
1212

1313
#[ensures(self.contains_key(key) -> ret.is_some())]
1414
#[ensures(!self.contains_key(key) -> ret.is_none())]
15-
#[ensures(true)]
1615
pub fn get_mut(&mut self, key: &str) -> Option<&mut u8> {
1716
None
1817
}

0 commit comments

Comments
 (0)