Kaynağa Gözat

Fixed error display (unwrapped). Use usize.

I end up having lots of "as usize" for the index.  Just use usize.
Steve Thielemann 4 ay önce
ebeveyn
işleme
9e0f0cafc0
2 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  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 {