mirror of
https://github.com/extism/extism.git
synced 2026-01-10 06:18:00 -05:00
chore: clippy
This commit is contained in:
@@ -16,7 +16,7 @@ fn main() {
|
||||
|
||||
let res = plugin.call::<&str, &str>("try_read", "").unwrap();
|
||||
|
||||
println!("{:?}", res);
|
||||
println!("{res:?}");
|
||||
|
||||
println!("-----------------------------------------------------");
|
||||
|
||||
@@ -30,7 +30,7 @@ fn main() {
|
||||
);
|
||||
let res2 = plugin.call::<&str, &str>("try_write", &line).unwrap();
|
||||
|
||||
println!("{:?}", res2);
|
||||
println!("{res2:?}");
|
||||
|
||||
println!("done!");
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ fn main() {
|
||||
let res = plugin
|
||||
.call::<&str, &str>("reflect", "Hello, world!")
|
||||
.unwrap();
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ fn main() {
|
||||
println!("Dumping logs");
|
||||
|
||||
for line in LOGS.lock().unwrap().iter() {
|
||||
print!("{}", line);
|
||||
print!("{line}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,6 @@ fn main() {
|
||||
let res = plugin
|
||||
.call::<&str, &str>("count_vowels", "Hello, world!")
|
||||
.unwrap();
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ pub fn set_log_callback<F: 'static + Clone + Fn(&str)>(
|
||||
let x = tracing_subscriber::EnvFilter::builder()
|
||||
.with_default_directive(tracing::Level::ERROR.into());
|
||||
if is_level {
|
||||
x.parse_lossy(format!("extism={}", filter))
|
||||
x.parse_lossy(format!("extism={filter}"))
|
||||
} else {
|
||||
x.parse_lossy(filter)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::*;
|
||||
fn hex(data: &[u8]) -> String {
|
||||
let mut s = String::new();
|
||||
for &byte in data {
|
||||
write!(&mut s, "{:02x}", byte).unwrap();
|
||||
write!(&mut s, "{byte:02x}").unwrap();
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
@@ -963,8 +963,7 @@ impl Plugin {
|
||||
}
|
||||
Err(msg) => {
|
||||
res = Err(Error::msg(format!(
|
||||
"unable to load error message from memory: {}",
|
||||
msg,
|
||||
"unable to load error message from memory: {msg}",
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,7 +871,7 @@ fn set_log_file(log_file: impl Into<std::path::PathBuf>, filter: &str) -> Result
|
||||
let x = tracing_subscriber::EnvFilter::builder()
|
||||
.with_default_directive(tracing::Level::ERROR.into());
|
||||
if is_level {
|
||||
x.parse_lossy(format!("extism={}", filter))
|
||||
x.parse_lossy(format!("extism={filter}"))
|
||||
} else {
|
||||
x.parse_lossy(filter)
|
||||
}
|
||||
@@ -926,7 +926,7 @@ unsafe fn set_log_buffer(filter: &str) -> Result<(), Error> {
|
||||
let x = tracing_subscriber::EnvFilter::builder()
|
||||
.with_default_directive(tracing::Level::ERROR.into());
|
||||
if is_level {
|
||||
x.parse_lossy(format!("extism={}", filter))
|
||||
x.parse_lossy(format!("extism={filter}"))
|
||||
} else {
|
||||
x.parse_lossy(filter)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ fn test_issue_620() {
|
||||
// Call test method, this does not work
|
||||
let p = plugin.call::<(), String>("test", ()).unwrap();
|
||||
|
||||
println!("{}", p);
|
||||
println!("{p}");
|
||||
}
|
||||
|
||||
// https://github.com/extism/extism/issues/619
|
||||
@@ -53,5 +53,5 @@ fn test_issue_775() {
|
||||
Ok(code) => Err(code),
|
||||
}
|
||||
.unwrap();
|
||||
println!("{}", p);
|
||||
println!("{p}");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ fn run_thread(p: Pool, i: u64) -> std::thread::JoinHandle<()> {
|
||||
.unwrap()
|
||||
.call("count_vowels", "abc")
|
||||
.unwrap();
|
||||
println!("{}", s);
|
||||
println!("{s}");
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -134,8 +134,7 @@ fn it_works() {
|
||||
let native_avg: std::time::Duration = native_sum / native_num_tests as u32;
|
||||
|
||||
println!(
|
||||
"native function call (avg, N = {}): {:?}",
|
||||
native_num_tests, native_avg
|
||||
"native function call (avg, N = {native_num_tests}): {native_avg:?}"
|
||||
);
|
||||
|
||||
let num_tests = test_times.len();
|
||||
@@ -145,7 +144,7 @@ fn it_works() {
|
||||
.unwrap();
|
||||
let avg: std::time::Duration = sum / num_tests as u32;
|
||||
|
||||
println!("wasm function call (avg, N = {}): {:?}", num_tests, avg);
|
||||
println!("wasm function call (avg, N = {num_tests}): {avg:?}");
|
||||
|
||||
// Check that log file was written to
|
||||
if log {
|
||||
@@ -212,7 +211,7 @@ fn test_cancel() {
|
||||
let _output: Result<&[u8], Error> = plugin.call("loop_forever", "abc123");
|
||||
let end = std::time::Instant::now();
|
||||
let time = end - start;
|
||||
println!("Cancelled plugin ran for {:?}", time);
|
||||
println!("Cancelled plugin ran for {time:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +270,7 @@ fn test_fuel_consumption() {
|
||||
assert!(output.is_err());
|
||||
|
||||
let fuel_consumed = plugin.fuel_consumed().unwrap();
|
||||
println!("Fuel consumed: {}", fuel_consumed);
|
||||
println!("Fuel consumed: {fuel_consumed}");
|
||||
assert!(fuel_consumed > 0);
|
||||
}
|
||||
|
||||
@@ -440,7 +439,7 @@ fn test_memory_max() {
|
||||
assert!(output.is_err());
|
||||
|
||||
let err = output.unwrap_err().root_cause().to_string();
|
||||
println!("{:?}", err);
|
||||
println!("{err:?}");
|
||||
assert_eq!(err, "oom");
|
||||
|
||||
// Should pass with memory.max set to a large enough number
|
||||
@@ -503,7 +502,7 @@ fn test_extism_error() {
|
||||
let mut plugin = Plugin::new(&manifest, [f], true).unwrap();
|
||||
let output: Result<String, Error> = plugin.call("count_vowels", "a".repeat(1024));
|
||||
assert!(output.is_err());
|
||||
println!("{:?}", output);
|
||||
println!("{output:?}");
|
||||
assert_eq!(output.unwrap_err().root_cause().to_string(), "TEST");
|
||||
}
|
||||
|
||||
@@ -823,7 +822,7 @@ fn test_http_response_headers() {
|
||||
.unwrap();
|
||||
let req = HttpRequest::new("https://extism.org");
|
||||
let Json(res): Json<HashMap<String, String>> = plugin.call("http_get", Json(req)).unwrap();
|
||||
println!("{:?}", res);
|
||||
println!("{res:?}");
|
||||
assert_eq!(res["content-type"], "text/html; charset=utf-8");
|
||||
}
|
||||
|
||||
@@ -838,6 +837,6 @@ fn test_http_response_headers_disabled() {
|
||||
.unwrap();
|
||||
let req = HttpRequest::new("https://extism.org");
|
||||
let Json(res): Json<HashMap<String, String>> = plugin.call("http_get", Json(req)).unwrap();
|
||||
println!("{:?}", res);
|
||||
println!("{res:?}");
|
||||
assert!(res.is_empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user