Skip to content

Commit

Permalink
Remove dependency on once_cell.
Browse files Browse the repository at this point in the history
  • Loading branch information
mleonhard committed Oct 27, 2024
1 parent 08f7702 commit 436979f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["web", "http", "server", "async", "threaded"]
license = "MIT OR Apache-2.0"
name = "servlin"
repository = "https://github.com/mleonhard/servlin"
version = "0.5.0"
version = "0.5.1"

[features]
default = []
Expand All @@ -22,7 +22,6 @@ futures-io = "0.3"
futures-lite = "2"
include_dir = { version = "0.7", optional = true }
#libflate = "1"
once_cell = "1"
permit = "^0.2"
rand = { version = "0.8", features = ["small_rng"] }
safe-regex = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Symbols:
Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 🔒 servlin 0.5.0
0/0 0/0 0/0 0/0 0/0 🔒 servlin 0.5.1
0/0 0/0 0/0 0/0 0/0 🔒 ├── async-fs 2.1.2
4/4 222/222 40/40 0/0 13/13 ☢️ │ ├── async-lock 3.4.0
0/0 2/2 0/0 0/0 0/0 ☢️ │ │ ├── event-listener-strategy 0.5.2
Expand Down Expand Up @@ -165,7 +165,6 @@ Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 ❓ │ └── futures-io 0.3.31
0/0 0/0 0/0 0/0 0/0 ❓ ├── futures-io 0.3.31
0/0 0/0 0/0 0/0 0/0 ❓ ├── futures-lite 2.3.0
0/0 74/117 5/9 0/0 2/4 ☢️ ├── once_cell 1.20.2
0/0 0/0 0/0 0/0 0/0 🔒 ├── permit 0.2.1
0/0 32/32 0/0 0/0 0/0 ☢️ ├── rand 0.8.5
1/90 10/596 0/2 0/0 5/69 ☢️ │ ├── libc 0.2.161
Expand Down Expand Up @@ -220,6 +219,7 @@ Functions Expressions Impls Traits Methods Dependency
See [rust-webserver-comparison.md](https://github.com/mleonhard/servlin/blob/main/rust-webserver-comparison.md).

# Changelog
- v0.5.1 2024-10-26 - Remove dependency on `once_cell`.
- v0.5.0 2024-10-21 - Remove `LogFileWriterBuilder`.
- v0.4.3 - Implement `From<Cow<'_, str>>` and `From<&Path>` for `TagValue`.
- v0.4.2 - Implement `Seek` for `BodyReader`.
Expand Down
2 changes: 1 addition & 1 deletion check-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cat Readme.md |perl -0777 -pe 's/(# Cargo Geiger Safety Report).+?```.+?```/$1/s
cargo readme --no-title --no-indent-headings >Readme.md.tmp
diff Readme.md.pruned Readme.md.tmp || (
set +x
echo "ERROR: Readme.md is stale" >&2
echo "ERROR: $(pwd)/Readme.md is stale" >&2
exit 1
)
rm -f Readme.md.pruned Readme.md.tmp
Expand Down
4 changes: 2 additions & 2 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -e
set -x
time cargo check --all-targets --all-features
time cargo build --all-targets --all-features
time cargo fmt -- --check
time cargo clippy --all-targets --all-features -- -D clippy::pedantic
time cargo fmt --all
time cargo clippy --all-targets --all-features --allow-dirty --allow-staged --fix -- -D clippy::pedantic
time cargo test --all-targets --all-features
time cargo test --doc --all-features
./check-readme.sh
Expand Down
5 changes: 5 additions & 0 deletions git-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
set -e
set -x
../check-all.sh "$@"
git push --follow-tags
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
//! See [rust-webserver-comparison.md](https://github.com/mleonhard/servlin/blob/main/rust-webserver-comparison.md).
//!
//! # Changelog
//! - v0.5.1 2024-10-26 - Remove dependency on `once_cell`.
//! - v0.5.0 2024-10-21 - Remove `LogFileWriterBuilder`.
//! - v0.4.3 - Implement `From<Cow<'_, str>>` and `From<&Path>` for `TagValue`.
//! - v0.4.2 - Implement `Seek` for `BodyReader`.
Expand Down
4 changes: 1 addition & 3 deletions src/log/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ impl GlobalLoggerState {
}
}

pub static GLOBAL_LOGGER: once_cell::sync::OnceCell<Mutex<GlobalLoggerState>> =
once_cell::sync::OnceCell::new();
pub static GLOBAL_LOGGER: Mutex<GlobalLoggerState> = Mutex::new(GlobalLoggerState::None);

thread_local! {
pub static THREAD_LOCAL_TAGS: RefCell<Vec<Tag>> = const { RefCell::new(Vec::new()) };
Expand All @@ -109,7 +108,6 @@ pub struct GlobalLoggerAlreadySetError {}
#[allow(clippy::module_name_repetitions)]
pub fn lock_global_logger() -> MutexGuard<'static, GlobalLoggerState> {
GLOBAL_LOGGER
.get_or_init(|| Mutex::new(GlobalLoggerState::None))
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
}
Expand Down

0 comments on commit 436979f

Please sign in to comment.