From 6d90817284bb5afdae1fc198b3315869d5098303 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 6 Mar 2023 08:59:21 +0100 Subject: [PATCH] Simplify: Replace `library_filename` function with `format!` call --- examples/c++-dataflow/run.rs | 13 +------------ examples/c-dataflow/run.rs | 13 +------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/examples/c++-dataflow/run.rs b/examples/c++-dataflow/run.rs index b76c52d3..5ce1a681 100644 --- a/examples/c++-dataflow/run.rs +++ b/examples/c++-dataflow/run.rs @@ -257,7 +257,7 @@ async fn build_cxx_operator( link.arg("-fms-runtime-lib=static"); } link.arg("-o") - .arg(Path::new("../build").join(library_filename(out_name))); + .arg(Path::new("../build").join(format!("{DLL_PREFIX}{out_name}{DLL_SUFFIX}"))); if let Some(parent) = paths[0].parent() { link.current_dir(parent); } @@ -267,14 +267,3 @@ async fn build_cxx_operator( Ok(()) } - -// taken from `rust_libloading` crate by Simonas Kazlauskas, licensed under the ISC license ( -// see https://github.com/nagisa/rust_libloading/blob/master/LICENSE) -pub fn library_filename>(name: S) -> OsString { - let name = name.as_ref(); - let mut string = OsString::with_capacity(name.len() + DLL_PREFIX.len() + DLL_SUFFIX.len()); - string.push(DLL_PREFIX); - string.push(name); - string.push(DLL_SUFFIX); - string -} diff --git a/examples/c-dataflow/run.rs b/examples/c-dataflow/run.rs index 724729fc..31fddd38 100644 --- a/examples/c-dataflow/run.rs +++ b/examples/c-dataflow/run.rs @@ -117,21 +117,10 @@ async fn build_c_operator() -> eyre::Result<()> { let mut link = tokio::process::Command::new("clang"); link.arg("-shared").arg("build/operator.o"); link.arg("-o") - .arg(Path::new("build").join(library_filename("operator"))); + .arg(Path::new("build").join(format!("{DLL_PREFIX}operator{DLL_SUFFIX}"))); if !link.status().await?.success() { bail!("failed to link c operator"); }; Ok(()) } - -// taken from `rust_libloading` crate by Simonas Kazlauskas, licensed under the ISC license ( -// see https://github.com/nagisa/rust_libloading/blob/master/LICENSE) -pub fn library_filename>(name: S) -> OsString { - let name = name.as_ref(); - let mut string = OsString::with_capacity(name.len() + DLL_PREFIX.len() + DLL_SUFFIX.len()); - string.push(DLL_PREFIX); - string.push(name); - string.push(DLL_SUFFIX); - string -}