Skip to content

Commit

Permalink
Use no_std compatible types
Browse files Browse the repository at this point in the history
std::env -> core::option_env
  • Loading branch information
TTWNO committed Jun 5, 2024
1 parent b7dfcb0 commit a4d5457
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
// Copyright (C) 2019-2023 Daniel Mueller <[email protected]>
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#![no_std]

extern crate proc_macro;
extern crate alloc;

use alloc::{
string::String,
vec,
vec::Vec,
};

use proc_macro::TokenStream;
use proc_macro2::TokenStream as Tokens;
Expand Down Expand Up @@ -199,10 +208,8 @@ fn expand_tracing_init(attribute_args: &AttributeArgs) -> Tokens {
let __internal_event_filter = {
use ::test_log::tracing_subscriber::fmt::format::FmtSpan;

match ::std::env::var_os("RUST_LOG_SPAN_EVENTS") {
match ::core::option_env!("RUST_LOG_SPAN_EVENTS") {
Some(mut value) => {
value.make_ascii_lowercase();
let value = value.to_str().expect("test-log: RUST_LOG_SPAN_EVENTS must be valid UTF-8");
value
.split(",")
.map(|filter| match filter.trim() {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#![deny(missing_docs)]
#![no_std]

//! A crate providing a replacement #[[macro@test]] attribute that
//! initializes logging and/or tracing infrastructure before running
Expand Down

0 comments on commit a4d5457

Please sign in to comment.