diff --git a/.github/workflows/pr-extensions.yml b/.github/workflows/pr-extensions.yml index 6c2d5562..1d1212c8 100644 --- a/.github/workflows/pr-extensions.yml +++ b/.github/workflows/pr-extensions.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5aa496cc..3a858ab5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 7410d003..ada0972a 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -16,6 +16,9 @@ on: # The branches below must be a subset of the branches above branches: [ "main" ] workflow_dispatch: + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: rust-clippy-analyze: diff --git a/.github/workflows/test-c-cpp.yml b/.github/workflows/test-c-cpp.yml index f2525817..c24cdedc 100644 --- a/.github/workflows/test-c-cpp.yml +++ b/.github/workflows/test-c-cpp.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: test: diff --git a/.github/workflows/test-csharp.yml b/.github/workflows/test-csharp.yml index 66b5edff..cd725f6b 100644 --- a/.github/workflows/test-csharp.yml +++ b/.github/workflows/test-csharp.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: build-ffi: @@ -129,4 +132,4 @@ jobs: - name: Run Regorus.Tests run: dotnet test --no-restore - working-directory: ./bindings/csharp/Regorus.Tests \ No newline at end of file + working-directory: ./bindings/csharp/Regorus.Tests diff --git a/.github/workflows/test-ffi.yml b/.github/workflows/test-ffi.yml index 4bb62631..a182a739 100644 --- a/.github/workflows/test-ffi.yml +++ b/.github/workflows/test-ffi.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: test: diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index c40c02c5..73a85b00 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: test: diff --git a/.github/workflows/test-java.yml b/.github/workflows/test-java.yml index d47c3332..c710c0c7 100644 --- a/.github/workflows/test-java.yml +++ b/.github/workflows/test-java.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: test: diff --git a/.github/workflows/test-musl.yml b/.github/workflows/test-musl.yml index cd693d32..30f355f1 100644 --- a/.github/workflows/test-musl.yml +++ b/.github/workflows/test-musl.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/test-no-std.yml b/.github/workflows/test-no-std.yml index f6763fcb..f33458ca 100644 --- a/.github/workflows/test-no-std.yml +++ b/.github/workflows/test-no-std.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 2123e702..779eed48 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: PYTHON_VERSION: "3.10" @@ -86,4 +89,4 @@ jobs: run: | pip3 install ../../wheels/${{ matrix.host.wheel }} python3 test.py - working-directory: bindings/python \ No newline at end of file + working-directory: bindings/python diff --git a/.github/workflows/test-wasm.yml b/.github/workflows/test-wasm.yml index aa668dba..b91ca27d 100644 --- a/.github/workflows/test-wasm.yml +++ b/.github/workflows/test-wasm.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" jobs: test: diff --git a/.github/workflows/tests-debug.yml b/.github/workflows/tests-debug.yml index 8d5b5425..1dadccad 100644 --- a/.github/workflows/tests-debug.yml +++ b/.github/workflows/tests-debug.yml @@ -5,6 +5,9 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + # Run at 8:00 AM every day + - cron: "0 8 * * *" env: CARGO_TERM_COLOR: always diff --git a/bindings/ruby/ext/regorusrb/src/lib.rs b/bindings/ruby/ext/regorusrb/src/lib.rs index 138ec994..615ce0e9 100644 --- a/bindings/ruby/ext/regorusrb/src/lib.rs +++ b/bindings/ruby/ext/regorusrb/src/lib.rs @@ -45,49 +45,49 @@ impl Engine { self.engine .borrow_mut() .add_policy(path, rego) - .map_err(|e| Error::new(runtime_error(), format!("Failed to add policy: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to add policy: {e}"))) } fn add_policy_from_file(&self, path: String) -> Result { self.engine .borrow_mut() .add_policy_from_file(path) - .map_err(|e| Error::new(runtime_error(), format!("Failed to add policy: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to add policy: {e}"))) } fn add_data(&self, ruby_hash: magnus::RHash) -> Result<(), Error> { let data_value: regorus::Value = serde_magnus::deserialize(ruby_hash).map_err(|e| { Error::new( runtime_error(), - format!("Failed to deserialize Ruby value: {}", e), + format!("Failed to deserialize Ruby value: {e}"), ) })?; self.engine .borrow_mut() .add_data(data_value) - .map_err(|e| Error::new(runtime_error(), format!("Failed to add data: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to add data: {e}"))) } fn add_data_json(&self, json_string: String) -> Result<(), Error> { self.engine .borrow_mut() .add_data_json(&json_string) - .map_err(|e| Error::new(runtime_error(), format!("Failed to add data json: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to add data json: {e}"))) } fn add_data_from_json_file(&self, path: String) -> Result<(), Error> { let json_data = regorus::Value::from_json_file(path).map_err(|e| { Error::new( runtime_error(), - format!("Failed to parse JSON data file: {}", e), + format!("Failed to parse JSON data file: {e}"), ) })?; self.engine.borrow_mut().add_data(json_data).map_err(|e| { Error::new( runtime_error(), - format!("Failed to add data from file: {}", e), + format!("Failed to add data from file: {e}"), ) }) } @@ -115,7 +115,7 @@ impl Engine { let input_value: regorus::Value = serde_magnus::deserialize(ruby_hash).map_err(|e| { Error::new( runtime_error(), - format!("Failed to deserialize Ruby value: {}", e), + format!("Failed to deserialize Ruby value: {e}"), ) })?; @@ -127,14 +127,14 @@ impl Engine { self.engine .borrow_mut() .set_input_json(&json_string) - .map_err(|e| Error::new(runtime_error(), format!("Failed to set input JSON: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to set input JSON: {e}"))) } fn add_input_from_json_file(&self, path: String) -> Result<(), Error> { let json_data = regorus::Value::from_json_file(path).map_err(|e| { Error::new( runtime_error(), - format!("Failed to parse JSON input file: {}", e), + format!("Failed to parse JSON input file: {e}"), ) })?; @@ -147,12 +147,12 @@ impl Engine { .engine .borrow_mut() .eval_query(query, false) - .map_err(|e| Error::new(runtime_error(), format!("Failed to evaluate query: {}", e)))?; + .map_err(|e| Error::new(runtime_error(), format!("Failed to evaluate query: {e}")))?; serde_magnus::serialize(&results).map_err(|e| { Error::new( runtime_error(), - format!("Failed to serailzie query results: {}", e), + format!("Failed to serailzie query results: {e}"), ) }) } @@ -165,14 +165,14 @@ impl Engine { .map_err(|e| { Error::new( runtime_error(), - format!("Failed to evaluate query as json: {}", e), + format!("Failed to evaluate query as json: {e}"), ) })?; serde_json::to_string(&results).map_err(|e| { Error::new( runtime_error(), - format!("Failed to serialize query results: {}", e), + format!("Failed to serialize query results: {e}"), ) }) } @@ -180,7 +180,7 @@ impl Engine { fn eval_rule(&self, query: String) -> Result, Error> { let result = self.engine.borrow_mut().eval_rule(query).map_err(|e| { - Error::new(runtime_error(), format!("Failed to evaluate rule: {}", e)) + Error::new(runtime_error(), format!("Failed to evaluate rule: {e}")) })?; match result { @@ -190,7 +190,7 @@ impl Engine { .map_err(|e| { magnus::Error::new( runtime_error(), - format!("Failed to serialize the rule evaluation result: {}", e), + format!("Failed to serialize the rule evaluation result: {e}"), ) }), } @@ -200,7 +200,7 @@ impl Engine { self.engine .borrow_mut() .eval_bool_query(query, false) - .map_err(|e| Error::new(runtime_error(), format!("Failed to evaluate query: {}", e))) + .map_err(|e| Error::new(runtime_error(), format!("Failed to evaluate query: {e}"))) } fn eval_allow_query(&self, query: String) -> Result { @@ -226,14 +226,14 @@ impl Engine { .map_err(|e| { Error::new( runtime_error(), - format!("Failed to get coverage report as json: {}", e), + format!("Failed to get coverage report as json: {e}"), ) })?; serde_json::to_string(&report).map_err(|e| { Error::new( runtime_error(), - format!("Failed to serialize coverage report: {}", e), + format!("Failed to serialize coverage report: {e}"), ) }) } @@ -247,14 +247,14 @@ impl Engine { .map_err(|e| { Error::new( runtime_error(), - format!("Failed to get coverage report: {}", e), + format!("Failed to get coverage report: {e}"), ) })?; report.to_string_pretty().map_err(|e| { Error::new( runtime_error(), - format!("Failed to convert report to colored string: {}", e), + format!("Failed to convert report to colored string: {e}"), ) }) } @@ -275,7 +275,7 @@ impl Engine { self.engine.borrow_mut().take_prints().map_err(|e| { Error::new( runtime_error(), - format!("Failed to gather print statement: {}", e), + format!("Failed to gather print statement: {e}"), ) }) } diff --git a/build.rs b/build.rs index f98b0dcd..6fa5c076 100644 --- a/build.rs +++ b/build.rs @@ -23,7 +23,7 @@ fn main() -> Result<()> { .output() .expect("`git rev-parse HEAD` failed."); let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + println!("cargo:rustc-env=GIT_HASH={git_hash}"); } // Rerun only if build.rs changes. diff --git a/src/builtins/encoding.rs b/src/builtins/encoding.rs index 73b8888f..2eda12b9 100644 --- a/src/builtins/encoding.rs +++ b/src/builtins/encoding.rs @@ -339,7 +339,7 @@ fn yaml_marshal(span: &Span, params: &[Ref], 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())) } diff --git a/src/builtins/numbers.rs b/src/builtins/numbers.rs index 5c7de3a4..4f4dc394 100644 --- a/src/builtins/numbers.rs +++ b/src/builtins/numbers.rs @@ -34,7 +34,7 @@ pub fn arithmetic_operation( v2: Value, strict: bool, ) -> Result { - 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)?; diff --git a/src/builtins/objects.rs b/src/builtins/objects.rs index d946ba56..c326fd1d 100644 --- a/src/builtins/objects.rs +++ b/src/builtins/objects.rs @@ -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]) { diff --git a/src/interpreter.rs b/src/interpreter.rs index fc991bf7..dca92770 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -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)?; diff --git a/src/number.rs b/src/number.rs index afe01046..e725c40b 100644 --- a/src/number.rs +++ b/src/number.rs @@ -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()) } }