Skip to content

Commit e70aa7d

Browse files
authored
Merge pull request #92 from CertainLach/fix-builtin-variable-names
2 parents a556594 + 9b148f9 commit e70aa7d

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

crates/jrsonnet-stdlib/src/math.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
use jrsonnet_evaluator::{error::Result, function::builtin, typed::PositiveF64};
22

33
#[builtin]
4-
pub fn builtin_abs(x: f64) -> Result<f64> {
5-
Ok(x.abs())
4+
pub fn builtin_abs(n: f64) -> Result<f64> {
5+
Ok(n.abs())
66
}
77

88
#[builtin]
9-
pub fn builtin_sign(x: f64) -> Result<f64> {
10-
Ok(if x == 0. { 0. } else { x.signum() })
9+
pub fn builtin_sign(n: f64) -> Result<f64> {
10+
Ok(if n == 0. { 0. } else { n.signum() })
1111
}
1212

1313
#[builtin]
14-
pub fn builtin_max(x: f64, y: f64) -> Result<f64> {
15-
Ok(x.max(y))
14+
pub fn builtin_max(a: f64, b: f64) -> Result<f64> {
15+
Ok(a.max(b))
1616
}
1717

1818
#[builtin]
19-
pub fn builtin_min(x: f64, y: f64) -> Result<f64> {
20-
Ok(x.min(y))
19+
pub fn builtin_min(a: f64, b: f64) -> Result<f64> {
20+
Ok(a.min(b))
2121
}
2222

2323
#[builtin]

crates/jrsonnet-stdlib/src/strings.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,38 @@ pub fn builtin_find_substr(pat: IStr, str: IStr) -> Result<ArrValue> {
7676
}
7777

7878
#[builtin]
79-
pub fn builtin_parse_int(raw: IStr) -> Result<f64> {
80-
if let Some(raw) = raw.strip_prefix('-') {
79+
pub fn builtin_parse_int(str: IStr) -> Result<f64> {
80+
if let Some(raw) = str.strip_prefix('-') {
8181
if raw.is_empty() {
8282
throw!("integer only consists of a minus")
8383
}
8484

8585
parse_nat::<10>(raw).map(|value| -value)
8686
} else {
87-
if raw.is_empty() {
87+
if str.is_empty() {
8888
throw!("empty integer")
8989
}
9090

91-
parse_nat::<10>(raw.as_str())
91+
parse_nat::<10>(str.as_str())
9292
}
9393
}
9494

9595
#[builtin]
96-
pub fn builtin_parse_octal(raw: IStr) -> Result<f64> {
97-
if raw.is_empty() {
96+
pub fn builtin_parse_octal(str: IStr) -> Result<f64> {
97+
if str.is_empty() {
9898
throw!("empty octal integer");
9999
}
100100

101-
parse_nat::<8>(raw.as_str())
101+
parse_nat::<8>(str.as_str())
102102
}
103103

104104
#[builtin]
105-
pub fn builtin_parse_hex(raw: IStr) -> Result<f64> {
106-
if raw.is_empty() {
105+
pub fn builtin_parse_hex(str: IStr) -> Result<f64> {
106+
if str.is_empty() {
107107
throw!("empty hexadecimal integer");
108108
}
109109

110-
parse_nat::<16>(raw.as_str())
110+
parse_nat::<16>(str.as_str())
111111
}
112112

113113
fn parse_nat<const BASE: u32>(raw: &str) -> Result<f64> {

0 commit comments

Comments
 (0)