Fix warnings

This commit is contained in:
bakaq
2024-09-06 17:56:12 -03:00
parent ada9ba98cc
commit d32f3ee2f3
17 changed files with 10 additions and 214 deletions

View File

@@ -95,11 +95,6 @@ pub struct ChunkInfo {
vars: Vec<VarInfo>,
}
#[derive(Debug)]
pub struct BranchArm {
pub arm_terms: Vec<QueryTerm>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct BranchInfo {
branch_num: BranchNumber,

View File

@@ -1,3 +1,5 @@
#![allow(dead_code)]
use crate::atom_table::*;
use crate::machine::heap::*;
use crate::types::*;

View File

@@ -572,15 +572,6 @@ impl MachineState {
stub,
)
}
SessionError::QueryCannotBeDefinedAsFact => {
let error_atom = atom!("query_cannot_be_defined_as_fact");
self.permission_error(
Permission::Create,
atom!("static_procedure"),
functor!(error_atom),
)
}
}
}
@@ -710,9 +701,7 @@ impl MachineError {
pub enum CompilationError {
Arithmetic(ArithmeticError),
ParserError(ParserError),
CannotParseCyclicTerm,
ExceededMaxArity,
ExpectedRel,
InadmissibleFact,
InadmissibleQueryTerm,
InvalidDirective(DirectiveError),
@@ -722,7 +711,6 @@ pub enum CompilationError {
InvalidRuleHead,
InvalidUseModuleDecl,
InvalidModuleResolution(Atom),
UnreadableTerm,
}
#[derive(Debug)]
@@ -765,15 +753,9 @@ impl CompilationError {
CompilationError::Arithmetic(..) => {
functor!(atom!("arithmetic_error"))
}
CompilationError::CannotParseCyclicTerm => {
functor!(atom!("cannot_parse_cyclic_term"))
}
CompilationError::ExceededMaxArity => {
functor!(atom!("exceeded_max_arity"))
}
CompilationError::ExpectedRel => {
functor!(atom!("expected_relation"))
}
CompilationError::InadmissibleFact => {
// TODO: type_error(callable, _).
functor!(atom!("inadmissible_fact"))
@@ -806,9 +788,6 @@ impl CompilationError {
CompilationError::ParserError(ref err) => {
functor!(err.as_atom())
}
CompilationError::UnreadableTerm => {
functor!(atom!("unreadable_term"))
}
}
}
}
@@ -1063,7 +1042,6 @@ pub enum SessionError {
NamelessEntry,
OpIsInfixAndPostFix(Atom),
PredicateNotMultifileOrDiscontiguous(CompilationTarget, PredicateKey),
QueryCannotBeDefinedAsFact,
}
impl From<std::io::Error> for SessionError {

View File

@@ -256,31 +256,16 @@ impl MachineState {
unifier.unify_internal();
}
pub fn unify_structure(&mut self, s1: usize, value: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_structure(s1, value);
}
pub fn unify_atom(&mut self, atom: Atom, value: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_atom(atom, value);
}
pub fn unify_list(&mut self, l1: usize, value: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_list(l1, value);
}
pub fn unify_complete_string(&mut self, atom: Atom, value: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_complete_string(atom, value);
}
pub fn unify_partial_string(&mut self, value_1: HeapCellValue, value_2: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_partial_string(value_1, value_2);
}
pub fn unify_char(&mut self, c: char, value: HeapCellValue) {
let mut unifier = DefaultUnifier::from(self);
unifier.unify_char(c, value);

View File

@@ -1,9 +1,6 @@
pub use crate::arena::*;
pub use crate::atom_table::*;
use crate::heap_print::*;
pub use crate::machine::heap::*;
pub use crate::machine::machine_state::*;
pub use crate::machine::stack::*;
pub use crate::machine::streams::*;
pub use crate::machine::*;
pub use crate::parser::ast::*;
@@ -23,9 +20,10 @@ use std::ops::{Deref, DerefMut, Index, IndexMut};
pub struct MockWAM {
pub machine_st: MachineState,
pub op_dir: OpDir,
pub flags: MachineFlags,
//pub flags: MachineFlags,
}
#[allow(dead_code)]
impl MockWAM {
pub fn new() -> Self {
let op_dir = default_op_dir();
@@ -33,7 +31,7 @@ impl MockWAM {
Self {
machine_st: MachineState::new(),
op_dir,
flags: MachineFlags::default(),
//flags: MachineFlags::default(),
}
}

View File

@@ -271,14 +271,6 @@ impl Machine {
.unwrap()
}
fn throw_session_error(&mut self, err: SessionError, key: PredicateKey) {
let err = self.machine_st.session_error(err);
let stub = functor_stub(key.0, key.1);
let err = self.machine_st.error_form(err, stub);
self.machine_st.throw_exception(err);
}
pub(crate) fn run_module_predicate(
&mut self,
module_name: Atom,
@@ -358,15 +350,6 @@ impl Machine {
}
}
fn set_user_input(&mut self, input: String) {
self.user_input = Stream::from_owned_string(input, &mut self.machine_st.arena);
}
fn get_user_output(&self) -> String {
let output_bytes: Vec<_> = self.user_output.bytes().map(|b| b.unwrap()).collect();
String::from_utf8(output_bytes).unwrap()
}
pub(crate) fn configure_modules(&mut self) {
fn update_call_n_indices(
loader: &Module,

View File

@@ -103,11 +103,6 @@ impl<'a> HeapPStrIter<'a> {
self.focus.is_string_terminator(self.heap)
}
#[inline(always)]
pub fn num_steps(&self) -> usize {
self.brent_st.num_steps()
}
#[inline(always)]
pub fn chars(mut self) -> PStrCharsIter<'a> {
let item = self.next();

View File

@@ -528,11 +528,6 @@ impl From<TypedArenaPtr<ReadlineStream>> for Stream {
}
impl Stream {
#[inline]
pub fn from_readline_stream(stream: ReadlineStream, arena: &mut Arena) -> Stream {
Stream::Readline(arena_alloc!(StreamLayout::new(stream), arena))
}
#[inline]
pub fn from_owned_string(string: String, arena: &mut Arena) -> Stream {
Stream::Byte(arena_alloc!(