mirror of
https://github.com/isar/rusqlite.git
synced 2025-08-19 20:39:44 +08:00
Clippy
This commit is contained in:
@@ -98,15 +98,15 @@ mod build_bundled {
|
||||
#[cfg(not(feature = "buildtime_bindgen"))]
|
||||
{
|
||||
use std::fs;
|
||||
fs::copy(format!("{}/bindgen_bundled_version.rs", lib_name), out_path)
|
||||
fs::copy(format!("{lib_name}/bindgen_bundled_version.rs"), out_path)
|
||||
.expect("Could not copy bindings to output directory");
|
||||
}
|
||||
// println!("cargo:rerun-if-changed=sqlite3/sqlite3.c");
|
||||
// println!("cargo:rerun-if-changed=sqlcipher/sqlite3.c");
|
||||
println!("cargo:rerun-if-changed={}/sqlite3.c", lib_name);
|
||||
println!("cargo:rerun-if-changed={lib_name}/sqlite3.c");
|
||||
println!("cargo:rerun-if-changed=sqlite3/wasm32-wasi-vfs.c");
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.file(format!("{}/sqlite3.c", lib_name))
|
||||
cfg.file(format!("{lib_name}/sqlite3.c"))
|
||||
.flag("-DSQLITE_CORE")
|
||||
.flag("-DSQLITE_DEFAULT_FOREIGN_KEYS=1")
|
||||
.flag("-DSQLITE_ENABLE_API_ARMOR")
|
||||
@@ -261,12 +261,12 @@ mod build_bundled {
|
||||
}
|
||||
|
||||
if let Ok(limit) = env::var("SQLITE_MAX_VARIABLE_NUMBER") {
|
||||
cfg.flag(&format!("-DSQLITE_MAX_VARIABLE_NUMBER={}", limit));
|
||||
cfg.flag(&format!("-DSQLITE_MAX_VARIABLE_NUMBER={limit}"));
|
||||
}
|
||||
println!("cargo:rerun-if-env-changed=SQLITE_MAX_VARIABLE_NUMBER");
|
||||
|
||||
if let Ok(limit) = env::var("SQLITE_MAX_EXPR_DEPTH") {
|
||||
cfg.flag(&format!("-DSQLITE_MAX_EXPR_DEPTH={}", limit));
|
||||
cfg.flag(&format!("-DSQLITE_MAX_EXPR_DEPTH={limit}"));
|
||||
}
|
||||
println!("cargo:rerun-if-env-changed=SQLITE_MAX_EXPR_DEPTH");
|
||||
|
||||
@@ -275,7 +275,7 @@ mod build_bundled {
|
||||
if extra.starts_with("-D") || extra.starts_with("-U") {
|
||||
cfg.flag(extra);
|
||||
} else if extra.starts_with("SQLITE_") {
|
||||
cfg.flag(&format!("-D{}", extra));
|
||||
cfg.flag(&format!("-D{extra}"));
|
||||
} else {
|
||||
panic!("Don't understand {} in LIBSQLITE3_FLAGS", extra);
|
||||
}
|
||||
@@ -285,13 +285,13 @@ mod build_bundled {
|
||||
|
||||
cfg.compile(lib_name);
|
||||
|
||||
println!("cargo:lib_dir={}", out_dir);
|
||||
println!("cargo:lib_dir={out_dir}");
|
||||
}
|
||||
|
||||
fn env(name: &str) -> Option<OsString> {
|
||||
let prefix = env::var("TARGET").unwrap().to_uppercase().replace('-', "_");
|
||||
let prefixed = format!("{}_{}", prefix, name);
|
||||
let var = env::var_os(&prefixed);
|
||||
let prefixed = format!("{prefix}_{name}");
|
||||
let var = env::var_os(prefixed);
|
||||
|
||||
match var {
|
||||
None => env::var_os(name),
|
||||
@@ -334,7 +334,7 @@ impl From<HeaderLocation> for String {
|
||||
match header {
|
||||
HeaderLocation::FromEnvironment => {
|
||||
let prefix = env_prefix();
|
||||
let mut header = env::var(format!("{}_INCLUDE_DIR", prefix)).unwrap_or_else(|_| {
|
||||
let mut header = env::var(format!("{prefix}_INCLUDE_DIR")).unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"{}_INCLUDE_DIR must be set if {}_LIB_DIR is set",
|
||||
prefix, prefix
|
||||
@@ -404,10 +404,10 @@ mod build_linked {
|
||||
// `links=` value in our Cargo.toml) to get this value. This might be
|
||||
// useful if you need to ensure whatever crypto library sqlcipher relies
|
||||
// on is available, for example.
|
||||
println!("cargo:link-target={}", link_lib);
|
||||
println!("cargo:link-target={link_lib}");
|
||||
|
||||
if win_target() && cfg!(feature = "winsqlite3") {
|
||||
println!("cargo:rustc-link-lib=dylib={}", link_lib);
|
||||
println!("cargo:rustc-link-lib=dylib={link_lib}");
|
||||
return HeaderLocation::Wrapper;
|
||||
}
|
||||
|
||||
@@ -418,8 +418,8 @@ mod build_linked {
|
||||
env::set_var("PKG_CONFIG_PATH", pkgconfig_path);
|
||||
if pkg_config::Config::new().probe(link_lib).is_err() {
|
||||
// Otherwise just emit the bare minimum link commands.
|
||||
println!("cargo:rustc-link-lib={}={}", find_link_mode(), link_lib);
|
||||
println!("cargo:rustc-link-search={}", dir);
|
||||
println!("cargo:rustc-link-lib={}={link_lib}", find_link_mode());
|
||||
println!("cargo:rustc-link-search={dir}");
|
||||
}
|
||||
return HeaderLocation::FromEnvironment;
|
||||
}
|
||||
@@ -444,7 +444,7 @@ mod build_linked {
|
||||
// request and hope that the library exists on the system paths. We used to
|
||||
// output /usr/lib explicitly, but that can introduce other linking problems;
|
||||
// see https://github.com/rusqlite/rusqlite/issues/207.
|
||||
println!("cargo:rustc-link-lib={}={}", find_link_mode(), link_lib);
|
||||
println!("cargo:rustc-link-lib={}={link_lib}", find_link_mode());
|
||||
HeaderLocation::Wrapper
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user