Skip to content

Commit f73981d

Browse files
committed
Remove std feature
There's no need for it, the only no_std environment is UEFI and it's unlikely there'll be another one. Maybe we could rename uefi to no_std in the future, but right now it makes no sense to duplicate it. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 6531f1c commit f73981d

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

framework_lib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ rust-version = "1.74"
88
build = "build.rs"
99

1010
[features]
11-
default = ["std"]
12-
std = ["hidapi", "rusb"]
11+
default = ["hidapi", "rusb"]
1312
rusb = ["dep:rusb"]
1413
hidapi = ["dep:hidapi"]
1514
uefi = [ "lazy_static/spin_no_std" ]

framework_lib/src/capsule.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use std::prelude::v1::*;
1212

1313
use core::prelude::rust_2021::derive;
14-
#[cfg(all(not(feature = "uefi"), feature = "std"))]
14+
#[cfg(not(feature = "uefi"))]
1515
use std::fs::File;
16-
#[cfg(all(not(feature = "uefi"), feature = "std"))]
16+
#[cfg(not(feature = "uefi"))]
1717
use std::io::prelude::*;
1818

1919
#[cfg(not(feature = "uefi"))]
@@ -180,7 +180,7 @@ pub fn dump_winux_image(data: &[u8], header: &DisplayCapsule, filename: &str) {
180180

181181
let image = &data[header_len..image_size];
182182

183-
#[cfg(all(not(feature = "uefi"), feature = "std"))]
183+
#[cfg(not(feature = "uefi"))]
184184
{
185185
let mut file = File::create(filename).unwrap();
186186
file.write_all(image).unwrap();

framework_lib/src/commandline/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod uefi;
1717

1818
#[cfg(not(feature = "uefi"))]
1919
use std::fs;
20-
#[cfg(all(not(feature = "uefi"), feature = "std"))]
20+
#[cfg(not(feature = "uefi"))]
2121
use std::io::prelude::*;
2222

2323
#[cfg(feature = "rusb")]
@@ -553,7 +553,7 @@ fn flash_ec(ec: &CrosEc, ec_bin_path: &str, flash_type: EcFlashType) {
553553
fn dump_ec_flash(ec: &CrosEc, dump_path: &str) {
554554
let flash_bin = ec.get_entire_ec_flash().unwrap();
555555

556-
#[cfg(all(not(feature = "uefi"), feature = "std"))]
556+
#[cfg(not(feature = "uefi"))]
557557
{
558558
let mut file = fs::File::create(dump_path).unwrap();
559559
file.write_all(&flash_bin).unwrap();

framework_lib/src/util.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use std::prelude::v1::*;
66
#[cfg(feature = "uefi")]
77
use core::prelude::rust_2021::derive;
88

9-
#[cfg(not(feature = "std"))]
9+
#[cfg(feature = "uefi")]
1010
use alloc::sync::Arc;
11-
#[cfg(not(feature = "std"))]
11+
#[cfg(feature = "uefi")]
1212
use spin::{Mutex, MutexGuard};
13-
#[cfg(feature = "std")]
13+
#[cfg(not(feature = "uefi"))]
1414
use std::sync::{Arc, Mutex, MutexGuard};
1515

1616
use crate::smbios;
@@ -74,9 +74,9 @@ pub struct Config {
7474

7575
impl Config {
7676
pub fn set(platform: Platform) {
77-
#[cfg(feature = "std")]
77+
#[cfg(not(feature = "uefi"))]
7878
let mut config = CONFIG.lock().unwrap();
79-
#[cfg(not(feature = "std"))]
79+
#[cfg(feature = "uefi")]
8080
let mut config = CONFIG.lock();
8181

8282
if (*config).is_none() {
@@ -87,9 +87,9 @@ impl Config {
8787
}
8888
}
8989
pub fn is_set() -> bool {
90-
#[cfg(feature = "std")]
90+
#[cfg(not(feature = "uefi"))]
9191
let config = CONFIG.lock().unwrap();
92-
#[cfg(not(feature = "std"))]
92+
#[cfg(feature = "uefi")]
9393
let config = CONFIG.lock();
9494

9595
(*config).is_some()
@@ -98,9 +98,9 @@ impl Config {
9898
pub fn get() -> MutexGuard<'static, Option<Self>> {
9999
trace!("Config::get() entry");
100100
let unset = {
101-
#[cfg(feature = "std")]
101+
#[cfg(not(feature = "uefi"))]
102102
let config = CONFIG.lock().unwrap();
103-
#[cfg(not(feature = "std"))]
103+
#[cfg(feature = "uefi")]
104104
let config = CONFIG.lock();
105105
(*config).is_none()
106106
};
@@ -115,9 +115,9 @@ impl Config {
115115
None
116116
};
117117

118-
#[cfg(feature = "std")]
118+
#[cfg(not(feature = "uefi"))]
119119
let mut config = CONFIG.lock().unwrap();
120-
#[cfg(not(feature = "std"))]
120+
#[cfg(feature = "uefi")]
121121
let mut config = CONFIG.lock();
122122

123123
if new_config.is_some() {

0 commit comments

Comments
 (0)