Skip to content

Commit

Permalink
allow(unused_variables) instead of let _ = x
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgolfouse committed Dec 3, 2024
1 parent 363d866 commit 084a3da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
34 changes: 17 additions & 17 deletions creusot-contracts/src/logic/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ impl Int {
#[pure]
#[ensures(*result == value@)]
#[allow(unreachable_code)]
#[allow(unused_variables)]
pub fn new(value: i128) -> GhostBox<Self> {
let _ = value;
ghost!(panic!())
}

Expand All @@ -75,8 +75,8 @@ impl Int {
#[trusted]
#[logic]
#[creusot::builtins = "int.Power.power"]
#[allow(unused_variables)]
pub fn pow(self, p: Int) -> Int {
let _ = p;
dead
}

Expand All @@ -91,8 +91,8 @@ impl Int {
#[trusted]
#[logic]
#[creusot::builtins = "int.MinMax.max"]
#[allow(unused_variables)]
pub fn max(self, x: Int) -> Int {
let _ = x;
dead
}

Expand All @@ -107,8 +107,8 @@ impl Int {
#[logic]
#[creusot::builtins = "int.MinMax.min"]
#[trusted]
#[allow(unused_variables)]
pub fn min(self, x: Int) -> Int {
let _ = x;
dead
}

Expand All @@ -123,8 +123,8 @@ impl Int {
#[trusted]
#[logic]
#[creusot::builtins = "int.EuclideanDivision.div"]
#[allow(unused_variables)]
pub fn div_euclid(self, d: Int) -> Int {
let _ = d;
dead
}

Expand All @@ -139,8 +139,8 @@ impl Int {
#[trusted]
#[logic]
#[creusot::builtins = "int.EuclideanDivision.mod"]
#[allow(unused_variables)]
pub fn rem_euclid(self, d: Int) -> Int {
let _ = d;
dead
}

Expand Down Expand Up @@ -171,8 +171,8 @@ impl AddLogic for Int {
#[trusted]
#[creusot::no_translate]
#[creusot::builtins = "add_int"]
#[allow(unused_variables)]
fn add(self, other: Self) -> Self {
let _ = other;
dead
}
}
Expand All @@ -183,8 +183,8 @@ impl SubLogic for Int {
#[trusted]
#[creusot::no_translate]
#[creusot::builtins = "sub_int"]
#[allow(unused_variables)]
fn sub(self, other: Self) -> Self {
let _ = other;
dead
}
}
Expand All @@ -195,8 +195,8 @@ impl MulLogic for Int {
#[trusted]
#[creusot::no_translate]
#[creusot::builtins = "mul_int"]
#[allow(unused_variables)]
fn mul(self, other: Self) -> Self {
let _ = other;
dead
}
}
Expand All @@ -207,8 +207,8 @@ impl DivLogic for Int {
#[trusted]
#[creusot::no_translate]
#[creusot::builtins = "div_int"]
#[allow(unused_variables)]
fn div(self, other: Self) -> Self {
let _ = other;
dead
}
}
Expand All @@ -219,8 +219,8 @@ impl RemLogic for Int {
#[trusted]
#[creusot::no_translate]
#[creusot::builtins = "rem_int"]
#[allow(unused_variables)]
fn rem(self, other: Self) -> Self {
let _ = other;
dead
}
}
Expand All @@ -242,8 +242,8 @@ impl PartialEq for Int {
#[trusted]
#[pure]
#[ensures(result == (*self == *other))]
#[allow(unused_variables)]
fn eq(&self, other: &Self) -> bool {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand All @@ -253,8 +253,8 @@ impl Add for Int {
#[trusted]
#[pure]
#[ensures(result == self + other)]
#[allow(unused_variables)]
fn add(self, other: Int) -> Self {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand All @@ -264,8 +264,8 @@ impl Sub for Int {
#[trusted]
#[pure]
#[ensures(result == self - other)]
#[allow(unused_variables)]
fn sub(self, other: Int) -> Self {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand All @@ -275,8 +275,8 @@ impl Mul for Int {
#[trusted]
#[pure]
#[ensures(result == self * other)]
#[allow(unused_variables)]
fn mul(self, other: Int) -> Self {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand All @@ -286,8 +286,8 @@ impl Div for Int {
#[trusted]
#[pure]
#[ensures(result == self / other)]
#[allow(unused_variables)]
fn div(self, other: Int) -> Self {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand All @@ -297,8 +297,8 @@ impl Rem for Int {
#[trusted]
#[pure]
#[ensures(result == self % other)]
#[allow(unused_variables)]
fn rem(self, other: Int) -> Self {
let _ = other;
unreachable!("BUG: called ghost function in normal code")
}
}
Expand Down
24 changes: 12 additions & 12 deletions creusot/tests/creusot-contracts/creusot-contracts.coma

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 084a3da

Please sign in to comment.