work on testing
[pspp] / rust / src / lib.rs
index 49bc74ef84e2430245b16d6b5cb9b8704d267755..8bf72fe02c064c8dcb5f30ff44c8cd6208ec4ba2 100644 (file)
@@ -1,4 +1,3 @@
-#![allow(unused_variables)]
 use endian::{Endian, Parse, ToBytes};
 use flate2::read::ZlibDecoder;
 use num::Integer;
@@ -11,6 +10,7 @@ use std::{
 use thiserror::Error;
 
 pub mod endian;
+pub mod sack;
 
 #[derive(Error, Debug)]
 pub enum Error {
@@ -220,6 +220,7 @@ impl VarType {
 }
 
 trait State {
+    #[allow(clippy::type_complexity)]
     fn read(self: Box<Self>) -> Result<Option<(Record, Box<dyn State>)>, Error>;
 }
 
@@ -463,7 +464,7 @@ where
     R: Read + Seek,
 {
     fn seek(&mut self, pos: SeekFrom) -> Result<u64, IoError> {
-        unimplemented!();
+        self.reader.as_mut().unwrap().get_mut().seek(pos)
     }
 }
 
@@ -504,10 +505,10 @@ impl Iterator for Reader {
         match self.state.take()?.read() {
             Ok(Some((record, next_state))) => {
                 self.state = Some(next_state);
-                return Some(Ok(record));
+                Some(Ok(record))
             }
-            Ok(None) => return None,
-            Err(error) => return Some(Err(error)),
+            Ok(None) => None,
+            Err(error) => Some(Err(error)),
         }
     }
 }