Skip to content

Minor alloc-related cleanups #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion uefi-test-runner/src/boot/memory.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use uefi::table::boot::{AllocateType, BootServices, MemoryType};

use crate::alloc::vec::Vec;
use alloc::vec::Vec;

pub fn test(bt: &BootServices) {
info!("Testing memory functions");
Expand Down
6 changes: 3 additions & 3 deletions uefi/src/data_types/owned_strs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::chars::{Char16, NUL_16};
use super::strs::{CStr16, FromSliceWithNulError};
use crate::alloc::vec::Vec;
use crate::data_types::strs::EqStrUntilNul;
use crate::data_types::UnalignedSlice;
use crate::polyfill::vec_into_raw_parts;
use alloc::vec::Vec;
use core::fmt;
use core::ops;

Expand Down Expand Up @@ -155,8 +155,8 @@ impl<StrType: AsRef<str> + ?Sized> EqStrUntilNul<StrType> for CString16 {
#[cfg(test)]
mod tests {
use super::*;
use crate::alloc::string::String;
use crate::alloc::vec;
use alloc::string::String;
use alloc::vec;

#[test]
fn test_cstring16_from_str() {
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/data_types/strs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::alloc::string::String;
use alloc::string::String;
use uefi_macros::{cstr16, cstr8};

// Tests if our CStr8 type can be constructed from a valid core::ffi::CStr
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/data_types/unaligned_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::marker::PhantomData;
use core::mem::MaybeUninit;

#[cfg(feature = "alloc")]
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

/// Slice backed by a potentially-unaligned pointer.
///
Expand Down
2 changes: 0 additions & 2 deletions uefi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
#![deny(clippy::all)]
#![deny(clippy::must_use_candidate)]

// Enable once we use vec![] or similar
// #[cfg_attr(feature = "alloc", macro_use)]
#[cfg(feature = "alloc")]
extern crate alloc;

Expand Down
2 changes: 1 addition & 1 deletion uefi/src/proto/media/file/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ impl FileProtocolInfo for FileSystemVolumeLabel {}
#[cfg(test)]
mod tests {
use super::*;
use crate::alloc::vec;
use crate::table::runtime::TimeParams;
use crate::table::runtime::{Daylight, Time};
use crate::CString16;
use alloc::vec;

fn validate_layout<T: InfoInternal + ?Sized>(info: &T, name: &[Char16]) {
// Check the hardcoded struct alignment.
Expand Down