From f4c30aee08b695d884e2e545e74f8a7a90d5d9a2 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 16 Oct 2023 00:52:35 -0400 Subject: [PATCH] Update regex-capi, format-args * Update edition and set MSRV for regex-capi * Inline a few format-args in the same crate --- regex-capi/Cargo.toml | 3 ++- regex-capi/src/error.rs | 2 +- regex-capi/src/macros.rs | 4 ++-- regex-capi/src/rure.rs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/regex-capi/Cargo.toml b/regex-capi/Cargo.toml index 78867f4635..5ba88782f2 100644 --- a/regex-capi/Cargo.toml +++ b/regex-capi/Cargo.toml @@ -11,7 +11,8 @@ description = """ A C API for Rust's regular expression library. """ workspace = ".." -edition = "2018" +edition = "2021" +rust-version = "1.65" [lib] name = "rure" diff --git a/regex-capi/src/error.rs b/regex-capi/src/error.rs index 7b91fb9d38..c2af420844 100644 --- a/regex-capi/src/error.rs +++ b/regex-capi/src/error.rs @@ -60,7 +60,7 @@ ffi_fn! { ffi_fn! { fn rure_error_message(err: *mut Error) -> *const c_char { let err = unsafe { &mut *err }; - let cmsg = match CString::new(format!("{}", err)) { + let cmsg = match CString::new(format!("{err}")) { Ok(msg) => msg, Err(err) => { // I guess this can probably happen if the regex itself has a diff --git a/regex-capi/src/macros.rs b/regex-capi/src/macros.rs index 7807cf8535..6de0b6827e 100644 --- a/regex-capi/src/macros.rs +++ b/regex-capi/src/macros.rs @@ -20,8 +20,8 @@ macro_rules! ffi_fn { }; let _ = writeln!( &mut io::stderr(), - "panic unwind caught, aborting: {:?}", - msg); + "panic unwind caught, aborting: {msg:?}" + ); unsafe { abort() } } } diff --git a/regex-capi/src/rure.rs b/regex-capi/src/rure.rs index 9e17668e26..8fe697dbec 100644 --- a/regex-capi/src/rure.rs +++ b/regex-capi/src/rure.rs @@ -82,7 +82,7 @@ ffi_fn! { let re = rure_compile( pat, len, RURE_DEFAULT_FLAGS, ptr::null(), &mut err); if err.is_err() { - let _ = writeln!(&mut io::stderr(), "{}", err); + let _ = writeln!(&mut io::stderr(), "{err}"); let _ = writeln!( &mut io::stderr(), "aborting from rure_compile_must"); unsafe { abort() } @@ -579,7 +579,7 @@ ffi_fn! { let mut err = Error::new(ErrorKind::None); let esc = rure_escape(pat, len, &mut err); if err.is_err() { - let _ = writeln!(&mut io::stderr(), "{}", err); + let _ = writeln!(&mut io::stderr(), "{err}"); let _ = writeln!( &mut io::stderr(), "aborting from rure_escape_must"); unsafe { abort() }