Ver Fonte

Fixed error display (unwrapped). Use usize.

I end up having lots of "as usize" for the index.  Just use usize.
Steve Thielemann há 4 meses atrás
pai
commit
9e0f0cafc0
2 ficheiros alterados com 4 adições e 2 exclusões
  1. 3 1
      src/main.rs
  2. 1 1
      sudoku/src/group.rs

+ 3 - 1
src/main.rs

@@ -60,9 +60,11 @@ fn main() {
         let result = load_ksudoku(filename.to_path_buf());
         if result.is_err() {
             println!("Failed to load file: {}", filename.display());
-            println!("{:?}", result.err());
+            // Safe to unrap error.
+            println!("{:?}", result.unwrap_err());
             return;
         }
+        
         let puzzle = result.unwrap();
         // Ksudoku is stored TLD.
         s.load_from_tld('b', '_', puzzle.as_str());

+ 1 - 1
sudoku/src/group.rs

@@ -12,7 +12,7 @@ const WIDTH: u8 = 9;
 /// Define a Group of sudoku positions.
 /// This defines rows, columns, and cells for analysis.
 #[derive(PartialEq)]
-pub struct Group(pub [u8; WIDTH as usize]);
+pub struct Group(pub [usize; WIDTH as usize]);
 
 /*
 pub struct Group {