]> Repositorios git - scryer-prolog.git/commitdiff
fix failing clippy checks, remove unnecessary code
authorMark Thom <[email protected]>
Fri, 26 Apr 2024 02:05:22 +0000 (20:05 -0600)
committerMark Thom <[email protected]>
Fri, 26 Apr 2024 02:05:22 +0000 (20:05 -0600)
src/arena.rs
src/machine/machine_indices.rs
src/machine/system_calls.rs
src/parser/char_reader.rs

index bd4d294c8f5046793d73c49c4a75cf09c65097b6..7bae991cf3bc436ee713b324bfe03e43b4391eb0 100644 (file)
@@ -24,10 +24,7 @@ use std::sync::RwLock;
 macro_rules! arena_alloc {
     ($e:expr, $arena:expr) => {{
         let result = $e;
-        #[allow(unused_unsafe)]
-        unsafe {
-            ArenaAllocated::alloc($arena, result)
-        }
+        ArenaAllocated::alloc($arena, result)
     }};
 }
 
@@ -35,10 +32,7 @@ macro_rules! arena_alloc {
 macro_rules! float_alloc {
     ($e:expr, $arena:expr) => {{
         let result = $e;
-        #[allow(unused_unsafe)]
-        unsafe {
-            $arena.f64_tbl.build_with(result).as_ptr()
-        }
+        unsafe { $arena.f64_tbl.build_with(result).as_ptr() }
     }};
 }
 
@@ -746,8 +740,6 @@ impl Drop for Arena {
                 ptr = slab.next;
             }
         }
-
-        self.base = None;
     }
 }
 
index 1ae2527b753577ed6e73aea77771fa77383e944d..830cc91f2990000a7df935303422b81041595a53 100644 (file)
@@ -298,9 +298,11 @@ impl IndexStore {
             _ => self
                 .get_meta_predicate_spec(key.0, key.1, &compilation_target)
                 .map(|meta_specs| {
-                    meta_specs.iter().find(|meta_spec| match meta_spec {
-                        MetaSpec::Colon | MetaSpec::RequiresExpansionWithArgument(_) => true,
-                        _ => false,
+                    meta_specs.iter().find(|meta_spec| {
+                        matches!(
+                            meta_spec,
+                            MetaSpec::Colon | MetaSpec::RequiresExpansionWithArgument(_)
+                        )
                     })
                 })
                 .map(|meta_spec_opt| meta_spec_opt.is_some())
index 8dafa43e558737cb1092005407ea3ee3d45b9bc4..80b579e7918ee0c2d14359f030e50cd7f3055c55 100644 (file)
@@ -428,14 +428,12 @@ impl BrentAlgState {
 
                 pstr_chars = pstr.as_str_from(n).chars().count() - 1;
 
-                if heap[h].get_tag() == HeapCellValueTag::PStrOffset {
-                    if heap[h_offset].get_tag() == HeapCellValueTag::CStr {
-                        return if pstr_chars < max_steps {
-                            CycleSearchResult::ProperList(pstr_chars + 1)
-                        } else {
-                            let offset = max_steps as usize + n;
-                            CycleSearchResult::PStrLocation(max_steps, h_offset, offset)
-                        }
+                if heap[h].get_tag() == HeapCellValueTag::PStrOffset && heap[h_offset].get_tag() == HeapCellValueTag::CStr {
+                    return if pstr_chars < max_steps {
+                        CycleSearchResult::ProperList(pstr_chars + 1)
+                    } else {
+                        let offset = max_steps + n;
+                        CycleSearchResult::PStrLocation(max_steps, h_offset, offset)
                     }
                 }
 
index a6dd75db46b3a10a76f08cc0aa59af74d2a1d0c4..bc9c16010d3dd8d45ae16c65deb4f05d47ef25e7 100644 (file)
@@ -327,12 +327,11 @@ impl<R: Read> Read for CharReader<R> {
             return self.inner.read_vectored(bufs);
         }
 
-        let nread = {
-            self.refresh_buffer()?;
-            (&self.buf[self.pos..]).read_vectored(bufs)?
-        };
+        self.refresh_buffer()?;
 
+        let nread = (&self.buf[self.pos..]).read_vectored(bufs)?;
         self.consume(nread);
+
         Ok(nread)
     }
 }