]> Repositorios git - scryer-prolog.git/commitdiff
Fix wasm warnings
authorNicolas Luck <[email protected]>
Tue, 17 Oct 2023 20:07:38 +0000 (22:07 +0200)
committerNicolas Luck <[email protected]>
Tue, 17 Oct 2023 20:07:38 +0000 (22:07 +0200)
src/lib.rs
src/machine/streams.rs
src/machine/system_calls.rs
src/read.rs

index 87a0f8ade60835626e86b1b0b1c67ac4a7a7c230..3579fcf2348c55cc7f9283404606842c194176da 100644 (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();
index 1dfbfaa914dac7ce5a39239d56a623d4c83de31c..4f9550506a64da8e4f52c58973dd95ac3c598ae0 100644 (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};
index 17a86e9824fc11bc46f032c90b224f3a6b56dd31..61df25e7fdf5a21ccc042cd438f043fdb9877ab3 100644 (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")]
index 1baf8720ee74f57e9d3872637e3b947a064e6b54..4955c670087a85e65298d3d7fc84358faf4daffc 100644 (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) {}