Skip to content

Commit

Permalink
Remove build.rs file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 6, 2023
1 parent dc32ab9 commit 7f09d72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 57 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ A lightweight logging facade for Rust
categories = ["development-tools::debugging"]
keywords = ["logging"]
exclude = ["rfcs/**/*"]
build = "build.rs"

[package.metadata.docs.rs]
features = ["std", "serde", "kv_unstable_std", "kv_unstable_sval", "kv_unstable_serde"]
Expand Down
46 changes: 0 additions & 46 deletions build.rs

This file was deleted.

20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,20 @@ mod serde;
#[cfg(feature = "kv_unstable")]
pub mod kv;

#[cfg(has_atomics)]
#[cfg(target_has_atomic = "ptr")]
use std::sync::atomic::{AtomicUsize, Ordering};

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
use std::cell::Cell;
#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
use std::sync::atomic::Ordering;

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
struct AtomicUsize {
v: Cell<usize>,
}

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
impl AtomicUsize {
const fn new(v: usize) -> AtomicUsize {
AtomicUsize { v: Cell::new(v) }
Expand All @@ -369,7 +369,7 @@ impl AtomicUsize {
self.v.set(val)
}

#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
fn compare_exchange(
&self,
current: usize,
Expand All @@ -387,7 +387,7 @@ impl AtomicUsize {

// Any platform without atomics is unlikely to have multiple cores, so
// writing via Cell will not be a race condition.
#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
unsafe impl Sync for AtomicUsize {}

// The LOGGER static holds a pointer to the global logger. It is protected by
Expand Down Expand Up @@ -1256,7 +1256,7 @@ pub fn max_level() -> LevelFilter {
/// An error is returned if a logger has already been set.
///
/// [`set_logger`]: fn.set_logger.html
#[cfg(all(feature = "std", atomic_cas))]
#[cfg(all(feature = "std", target_has_atomic = "ptr"))]
pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
set_logger_inner(|| Box::leak(logger))
}
Expand Down Expand Up @@ -1314,12 +1314,12 @@ pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
/// ```
///
/// [`set_logger_racy`]: fn.set_logger_racy.html
#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
pub fn set_logger(logger: &'static dyn Log) -> Result<(), SetLoggerError> {
set_logger_inner(|| logger)
}

#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
fn set_logger_inner<F>(make_logger: F) -> Result<(), SetLoggerError>
where
F: FnOnce() -> &'static dyn Log,
Expand Down

0 comments on commit 7f09d72

Please sign in to comment.