Stricter linting rule (#582)

This commit is contained in:
Yota Toyama
2026-09-26 01:34:38 +00:00
committed by GitHub
parent 4812241617
commit 82135e07a7
3 changed files with 74 additions and 62 deletions
+4
View File
@@ -28,3 +28,7 @@ dbg_macro = "deny"
missing_const_for_fn = "deny" missing_const_for_fn = "deny"
std_instead_of_alloc = "deny" std_instead_of_alloc = "deny"
std_instead_of_core = "deny" std_instead_of_core = "deny"
[lints.rust]
missing_docs = "deny"
warnings = "deny"
+33 -28
View File
@@ -1,8 +1,37 @@
//! A build script.
const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops"; const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops";
const LIB_GC_DIR: &str = "vendor/bdwgc"; const LIB_GC_DIR: &str = "vendor/bdwgc";
#[cfg(feature = "autotools")] cfg_select! {
fn main() { feature = "cmake" => {
fn main() {
use cmake::Config;
use std::path::Path;
let libatomic_include_path = Path::new(LIB_ATOMIC_OPS_DIR)
.join("src")
.canonicalize()
.unwrap()
.display()
.to_string()
.replace(r"\\?\", "");
let dst = Config::new(LIB_GC_DIR)
.profile("Release")
.define("GC_BUILD_SHARED_LIBS", "FALSE")
.cflag(format!("-I{}", libatomic_include_path))
.build();
println!(
"cargo:rustc-link-search=native={}",
dst.join("lib").display()
);
println!("cargo:rustc-link-lib=static=gc");
}
}
feature = "autotools" => {
fn main() {
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] { for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
std::process::Command::new("sh") std::process::Command::new("sh")
.arg("-c") .arg("-c")
@@ -42,30 +71,6 @@ fn main() {
.output() .output()
.unwrap(); .unwrap();
} }
} }
}
#[cfg(feature = "cmake")]
fn main() {
use cmake::Config;
use std::path::Path;
let libatomic_include_path = Path::new(LIB_ATOMIC_OPS_DIR)
.join("src")
.canonicalize()
.unwrap()
.display()
.to_string()
.replace(r"\\?\", "");
let dst = Config::new(LIB_GC_DIR)
.profile("Release")
.define("GC_BUILD_SHARED_LIBS", "FALSE")
.cflag(format!("-I{}", libatomic_include_path))
.build();
println!(
"cargo:rustc-link-search=native={}",
dst.join("lib").display()
);
println!("cargo:rustc-link-lib=static=gc");
} }
+5 -2
View File
@@ -3,8 +3,10 @@
mod error; mod error;
use core::alloc::{GlobalAlloc, Layout}; use core::{
use core::ptr::null; alloc::{GlobalAlloc, Layout},
ptr::null,
};
use libc::{c_int, c_void, size_t}; use libc::{c_int, c_void, size_t};
const GC_SUCCESS: c_int = 0; const GC_SUCCESS: c_int = 0;
@@ -38,6 +40,7 @@ unsafe extern "C" {
) -> *mut c_void; ) -> *mut c_void;
} }
/// An allocator.
pub struct Allocator; pub struct Allocator;
impl Allocator { impl Allocator {