Fix wasm warnings

This commit is contained in:
Nicolas Luck
2023-10-17 22:07:38 +02:00
parent 2776beb842
commit 0c9740fe52
4 changed files with 20 additions and 6 deletions

View File

@@ -49,7 +49,6 @@ use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn eval_code(s: &str) -> String {
use web_sys::console;
use machine::mock_wam::*;
let mut wam = Machine::with_test_streams();

View File

@@ -21,7 +21,9 @@ use std::fmt::Debug;
use std::fs::{File, OpenOptions};
use std::hash::Hash;
use std::io;
use std::io::{BufRead, Cursor, ErrorKind, Read, Seek, SeekFrom, Write};
use std::io::{Cursor, ErrorKind, Read, Seek, SeekFrom, Write};
#[cfg(feature = "http")]
use std::io::BufRead;
use std::mem;
use std::net::{Shutdown, TcpStream};
use std::ops::{Deref, DerefMut};

View File

@@ -51,14 +51,20 @@ use std::env;
use std::ffi::CString;
use std::fs;
use std::hash::{BuildHasher, BuildHasherDefault};
use std::io::{ErrorKind, Read, BufRead, Write};
use std::io::{ErrorKind, Read, Write};
#[cfg(feature = "http")]
use std::io::BufRead;
use std::iter::{once, FromIterator};
use std::mem;
use std::net::{SocketAddr, TcpListener, TcpStream, ToSocketAddrs};
use std::net::{TcpListener, TcpStream};
#[cfg(feature = "http")]
use std::net::{SocketAddr, ToSocketAddrs};
use std::num::NonZeroU32;
use std::ops::Sub;
use std::process;
#[cfg(feature = "http")]
use std::str::FromStr;
#[cfg(feature = "http")]
use std::sync::{Mutex, Arc, Condvar};
use chrono::{offset::Local, DateTime};
@@ -100,7 +106,7 @@ use warp::hyper::{HeaderMap, Method};
use warp::{Buf, Filter};
#[cfg(feature = "http")]
use reqwest::Url;
//use hyper_util::rt::TokioIo;
#[cfg(feature = "http")]
use futures::future;
#[cfg(feature = "repl")]

View File

@@ -24,7 +24,9 @@ use rustyline::history::DefaultHistory;
use rustyline::{Config, Editor};
use std::collections::VecDeque;
use std::io::{Cursor, Error, ErrorKind, Read};
use std::io::{Cursor, Read};
#[cfg(feature = "repl")]
use std::io::{Error, ErrorKind};
use std::sync::Arc;
type SubtermDeque = VecDeque<(usize, usize)>;
@@ -83,6 +85,7 @@ impl MachineState {
}
static mut PROMPT: bool = false;
#[cfg(feature = "repl")]
const HISTORY_FILE: &'static str = ".scryer_history";
pub(crate) fn set_prompt(value: bool) {
@@ -91,6 +94,7 @@ pub(crate) fn set_prompt(value: bool) {
}
}
#[cfg(feature = "repl")]
#[inline]
fn get_prompt() -> &'static str {
unsafe {
@@ -107,6 +111,7 @@ pub struct ReadlineStream {
#[cfg(feature = "repl")]
rl: Editor<Helper, DefaultHistory>,
pending_input: CharReader<Cursor<String>>,
#[allow(dead_code)]
add_history: bool,
}
@@ -145,6 +150,7 @@ impl ReadlineStream {
}
}
#[allow(unused_variables)]
pub fn set_atoms_for_completion(&mut self, atoms: &Arc<AtomTable>) {
#[cfg(feature = "repl")]
{
@@ -215,6 +221,7 @@ impl ReadlineStream {
}
}
#[allow(dead_code)]
#[cfg(not(feature = "repl"))]
fn save_history(&mut self) {}