Skip to content

Commit

Permalink
Inline a few methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Mar 31, 2021
1 parent 8331dbe commit 5773e51
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_data_structures/src/memmap.rs
Expand Up @@ -13,13 +13,15 @@ pub struct Mmap(Vec<u8>);

#[cfg(not(target_arch = "wasm32"))]
impl Mmap {
#[inline]
pub unsafe fn map(file: File) -> io::Result<Self> {
memmap2::Mmap::map(&file).map(Mmap)
}
}

#[cfg(target_arch = "wasm32")]
impl Mmap {
#[inline]
pub unsafe fn map(mut file: File) -> io::Result<Self> {
use std::io::Read;

Expand All @@ -32,6 +34,7 @@ impl Mmap {
impl Deref for Mmap {
type Target = [u8];

#[inline]
fn deref(&self) -> &[u8] {
&*self.0
}
Expand Down

0 comments on commit 5773e51

Please sign in to comment.