mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
fix: Clippy warnings (#424)
Also schedule works to be run at 8:00 AM everyday. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
444b2970a1
commit
8ee1cf3298
@@ -339,7 +339,7 @@ fn yaml_marshal(span: &Span, params: &[Ref<Expr>], args: &[Value], _strict: bool
|
||||
ensure_args_count(span, name, params, args, 1)?;
|
||||
|
||||
let serialized = serde_yaml::to_string(&args[0])
|
||||
.map_err(|err| span.error(&format!("could not serialize to yaml: {}", err)))?;
|
||||
.map_err(|err| span.error(&format!("could not serialize to yaml: {err}")))?;
|
||||
|
||||
Ok(Value::String(serialized.into()))
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ pub fn arithmetic_operation(
|
||||
v2: Value,
|
||||
strict: bool,
|
||||
) -> Result<Value> {
|
||||
let op_name = format!("{:?}", op).to_lowercase();
|
||||
let op_name = format!("{op:?}").to_lowercase();
|
||||
let v1 = ensure_numeric(op_name.as_str(), expr1, &v1)?;
|
||||
let v2 = ensure_numeric(op_name.as_str(), expr2, &v2)?;
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ fn json_match_schema(
|
||||
|
||||
// The following is expected to succeed.
|
||||
let document: serde_json::Value = serde_json::from_str(&args[0].to_json_str()?)
|
||||
.map_err(|err| span.error(&format!("Failed to parse JSON: {}", err)))?;
|
||||
.map_err(|err| span.error(&format!("Failed to parse JSON: {err}")))?;
|
||||
|
||||
Ok(Value::from_array(
|
||||
match compile_json_schema(¶ms[1], &args[1]) {
|
||||
|
||||
@@ -733,7 +733,7 @@ impl Interpreter {
|
||||
{
|
||||
bail!(rhs
|
||||
.span()
|
||||
.error(&format!("redefinition for variable {}", name)));
|
||||
.error(&format!("redefinition for variable {name}")));
|
||||
}
|
||||
|
||||
(name, rhs_value)
|
||||
@@ -3192,10 +3192,9 @@ impl Interpreter {
|
||||
Expr::RefBrack { refr, index, .. } => (refr, Some(index.clone())),
|
||||
Expr::RefDot { .. } => (refr, None),
|
||||
Expr::Var { .. } => (refr, None),
|
||||
_ => bail!(refr.span().error(&format!(
|
||||
"invalid token {:?} with the default keyword",
|
||||
refr
|
||||
))),
|
||||
_ => bail!(refr
|
||||
.span()
|
||||
.error(&format!("invalid token {refr:?} with the default keyword"))),
|
||||
};
|
||||
|
||||
Parser::get_path_ref_components_into(refr, &mut path)?;
|
||||
|
||||
@@ -403,13 +403,13 @@ impl Number {
|
||||
|
||||
pub fn format_bin(&self) -> String {
|
||||
self.ensure_integer()
|
||||
.map(|a| format!("{:b}", a))
|
||||
.map(|a| format!("{a:b}"))
|
||||
.unwrap_or("".to_string())
|
||||
}
|
||||
|
||||
pub fn format_octal(&self) -> String {
|
||||
self.ensure_integer()
|
||||
.map(|a| format!("{:o}", a))
|
||||
.map(|a| format!("{a:o}"))
|
||||
.unwrap_or("".to_string())
|
||||
}
|
||||
|
||||
@@ -469,13 +469,13 @@ impl Number {
|
||||
|
||||
pub fn format_hex(&self) -> String {
|
||||
self.ensure_integer()
|
||||
.map(|a| format!("{:x}", a))
|
||||
.map(|a| format!("{a:x}"))
|
||||
.unwrap_or("".to_string())
|
||||
}
|
||||
|
||||
pub fn format_big_hex(&self) -> String {
|
||||
self.ensure_integer()
|
||||
.map(|a| format!("{:X}", a))
|
||||
.map(|a| format!("{a:X}"))
|
||||
.unwrap_or("".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user