clear rustc warnings (#3051)
This commit is contained in:
@@ -82,7 +82,7 @@ pub trait CopierTarget: IndexMut<usize, Output = HeapCellValue> {
|
||||
// returns the tail location of the pstr on success
|
||||
fn as_slice_from<'a>(&'a self, from: usize) -> Box<dyn Iterator<Item = u8> + 'a>;
|
||||
fn copy_pstr_to_threshold(&mut self, pstr_loc: usize) -> Result<usize, usize>;
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter, usize>;
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter<'_>, usize>;
|
||||
fn copy_slice_to_end(&mut self, bounds: Range<usize>) -> Result<(), usize>;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::collections::VecDeque;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
#[derive(Debug, Clone)]//, PartialOrd, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, Clone)] //, PartialOrd, PartialEq, Eq, Hash)]
|
||||
pub struct BranchNumber {
|
||||
branch_num: Rational,
|
||||
delta: Rational,
|
||||
|
||||
@@ -94,7 +94,7 @@ pub struct HeapStringScan<'a> {
|
||||
}
|
||||
|
||||
// The heap_slice should be inside the heap
|
||||
unsafe fn scan_slice_to_str(heap_slice: &[u8]) -> HeapStringScan {
|
||||
unsafe fn scan_slice_to_str(heap_slice: &[u8]) -> HeapStringScan<'_> {
|
||||
let string_len = heap_slice
|
||||
.iter()
|
||||
.position(|b| *b == 0u8)
|
||||
@@ -117,7 +117,7 @@ unsafe fn scan_slice_to_str(heap_slice: &[u8]) -> HeapStringScan {
|
||||
|
||||
// Same as scan_slice_to_str but assumes that the slice is from the start of a string.
|
||||
// Can be used on strings out of the heap.
|
||||
unsafe fn scan_slice_to_str_from_start(heap_slice: &[u8]) -> HeapStringScan {
|
||||
unsafe fn scan_slice_to_str_from_start(heap_slice: &[u8]) -> HeapStringScan<'_> {
|
||||
let string_len = heap_slice
|
||||
.iter()
|
||||
.position(|b| *b == 0u8)
|
||||
@@ -529,7 +529,7 @@ impl<'a> SizedHeap for HeapWriter<'a> {
|
||||
self.section.cell_len()
|
||||
}
|
||||
|
||||
fn scan_slice_to_str(&self, slice_loc: usize) -> HeapStringScan {
|
||||
fn scan_slice_to_str(&self, slice_loc: usize) -> HeapStringScan<'_> {
|
||||
let HeapStringScan { string, tail_idx } = unsafe {
|
||||
let slice = std::slice::from_raw_parts(
|
||||
self.section.heap_ptr.byte_add(slice_loc),
|
||||
@@ -612,7 +612,7 @@ impl Heap {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter, usize> {
|
||||
pub fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter<'_>, usize> {
|
||||
let section;
|
||||
let len = heap_index!(num_cells);
|
||||
|
||||
@@ -1064,7 +1064,7 @@ impl SizedHeap for Heap {
|
||||
self.cell_len()
|
||||
}
|
||||
|
||||
fn scan_slice_to_str(&self, slice_loc: usize) -> HeapStringScan {
|
||||
fn scan_slice_to_str(&self, slice_loc: usize) -> HeapStringScan<'_> {
|
||||
let HeapStringScan { string, tail_idx } = unsafe {
|
||||
let slice = std::slice::from_raw_parts(
|
||||
self.inner.ptr.add(slice_loc),
|
||||
|
||||
@@ -561,7 +561,7 @@ impl Machine {
|
||||
}
|
||||
|
||||
/// Runs a query.
|
||||
pub fn run_query(&mut self, query: impl Into<String>) -> QueryState {
|
||||
pub fn run_query(&mut self, query: impl Into<String>) -> QueryState<'_> {
|
||||
let mut parser = Parser::new(
|
||||
Stream::from_owned_string(query.into(), &mut self.machine_st.arena),
|
||||
&mut self.machine_st,
|
||||
|
||||
@@ -1361,7 +1361,7 @@ impl<'a> MachinePreludeView<'a> {
|
||||
pub(super) fn composite_op_dir(
|
||||
&self,
|
||||
compilation_target: &CompilationTarget,
|
||||
) -> CompositeOpDir {
|
||||
) -> CompositeOpDir<'_, '_> {
|
||||
match compilation_target {
|
||||
CompilationTarget::User => CompositeOpDir::new(&self.indices.op_dir, None),
|
||||
CompilationTarget::Module(ref module_name) => {
|
||||
|
||||
@@ -136,7 +136,7 @@ impl IndexPtr {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]// , Ord, Hash, PartialOrd, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy)] // , Ord, Hash, PartialOrd, Eq, PartialEq)]
|
||||
pub struct CodeIndex(CodeIndexOffset);
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
|
||||
@@ -352,7 +352,7 @@ impl<'a> CopierTarget for CopyTerm<'a> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter, usize> {
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter<'_>, usize> {
|
||||
self.state.heap.reserve(num_cells)
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ impl<'a> CopierTarget for CopyBallTerm<'a> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter, usize> {
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter<'_>, usize> {
|
||||
self.stub.reserve(num_cells)
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ impl<'a> CopierTarget for TermCopyingMockWAM<'a> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter, usize> {
|
||||
fn reserve(&mut self, num_cells: usize) -> Result<HeapWriter<'_>, usize> {
|
||||
self.wam.machine_st.heap.reserve(num_cells)
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ pub(crate) fn get_structure_index(value: HeapCellValue) -> Option<CodeIndex> {
|
||||
|
||||
impl Machine {
|
||||
#[inline]
|
||||
fn prelude_view_and_machine_st(&mut self) -> (MachinePreludeView, &mut MachineState) {
|
||||
fn prelude_view_and_machine_st(&mut self) -> (MachinePreludeView<'_>, &mut MachineState) {
|
||||
(
|
||||
MachinePreludeView {
|
||||
indices: &mut self.indices,
|
||||
|
||||
@@ -5,8 +5,6 @@ use crate::machine::machine_errors::CycleSearchResult;
|
||||
use crate::machine::system_calls::BrentAlgState;
|
||||
use crate::types::*;
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct HeapPStrIter<'a> {
|
||||
pub heap: &'a Heap,
|
||||
@@ -209,55 +207,6 @@ impl<'a> Iterator for HeapPStrIter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PStrCharsIter<'a> {
|
||||
pub iter: HeapPStrIter<'a>,
|
||||
pub item: Option<PStrIteratee>,
|
||||
}
|
||||
|
||||
impl<'a> Deref for PStrCharsIter<'a> {
|
||||
type Target = HeapPStrIter<'a>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.iter
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for PStrCharsIter<'a> {
|
||||
type Item = char;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
while let Some(item) = self.item {
|
||||
match item {
|
||||
PStrIteratee::Char { value, .. } => {
|
||||
self.item = self.iter.next();
|
||||
return Some(value);
|
||||
}
|
||||
PStrIteratee::PStrSlice {
|
||||
slice_loc,
|
||||
slice_len,
|
||||
} => {
|
||||
let s = self.iter.heap.slice_to_str(slice_loc, slice_len);
|
||||
|
||||
match s.chars().next() {
|
||||
Some(c) => {
|
||||
self.item = Some(PStrIteratee::PStrSlice {
|
||||
slice_loc: slice_loc + c.len_utf8(),
|
||||
slice_len: slice_len - c.len_utf8(),
|
||||
});
|
||||
return Some(c);
|
||||
}
|
||||
None => {
|
||||
self.item = self.iter.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user