Fix unused warnings when not compiled with elf_support

Former-commit-id: a6b38f3affdbfbb436b1ec0d3ec33406f71f9ba2
This commit is contained in:
Michel Heily 2020-04-30 09:12:45 +03:00
parent 08bda05d52
commit 96f3858c96
2 changed files with 5 additions and 0 deletions

View file

@ -86,11 +86,13 @@ impl GamepakBuilder {
pub fn build(mut self) -> GBAResult<Cartridge> { pub fn build(mut self) -> GBAResult<Cartridge> {
let (bytes, symbols) = if let Some(bytes) = self.bytes { let (bytes, symbols) = if let Some(bytes) = self.bytes {
match load_from_bytes(bytes.to_vec())? { match load_from_bytes(bytes.to_vec())? {
#[cfg(feature = "elf_support")]
LoadRom::Elf { data, symbols } => Ok((data, Some(symbols))), LoadRom::Elf { data, symbols } => Ok((data, Some(symbols))),
LoadRom::Raw(data) => Ok((data, None)), LoadRom::Raw(data) => Ok((data, None)),
} }
} else if let Some(path) = &self.path { } else if let Some(path) = &self.path {
match load_from_file(&path)? { match load_from_file(&path)? {
#[cfg(feature = "elf_support")]
LoadRom::Elf { data, symbols } => Ok((data, Some(symbols))), LoadRom::Elf { data, symbols } => Ok((data, Some(symbols))),
LoadRom::Raw(data) => Ok((data, None)), LoadRom::Raw(data) => Ok((data, None)),
} }

View file

@ -1,4 +1,6 @@
use super::super::{GBAError, GBAResult}; use super::super::{GBAError, GBAResult};
#[cfg(feature = "elf_support")]
use std::collections::HashMap; use std::collections::HashMap;
use std::io::prelude::*; use std::io::prelude::*;
use std::io::Cursor; use std::io::Cursor;
@ -11,6 +13,7 @@ use zip::ZipArchive;
use goblin; use goblin;
pub enum LoadRom { pub enum LoadRom {
#[cfg(feature = "elf_support")]
Elf { Elf {
data: Vec<u8>, data: Vec<u8>,
symbols: HashMap<String, u32>, symbols: HashMap<String, u32>,