@@ -29,7 +29,7 @@ struct Completer<'a> {
2929impl < ' a > liner:: Completer for Completer < ' a > {
3030 fn completions ( & mut self , start : & str ) -> Vec < String > {
3131 let mut completions = Vec :: new ( ) ;
32- for ( name, _func ) in self . commands {
32+ for name in self . commands . keys ( ) {
3333 if name. starts_with ( start) {
3434 completions. push ( name. to_string ( ) ) ;
3535 }
@@ -118,7 +118,7 @@ fn commands() -> CommandMap {
118118 } ;
119119
120120 mcu. xram[ addr] = value;
121-
121+
122122 eprintln!( "xram {:04X}: {:02X}" , addr, mcu. xram[ addr] ) ;
123123 }
124124 } else {
@@ -164,9 +164,7 @@ fn timers(ec: &mut Ec) {
164164
165165 // Timer 0 running
166166 if tcon & 1 << 4 != 0 {
167- if tmod & 0x0F != 0x01 {
168- panic ! ( "unimplemented TMOD 0x{:02X}" , tmod) ;
169- }
167+ assert ! ( tmod & 0x0F == 0x01 , "unimplemented TMOD 0x{:02X}" , tmod) ;
170168
171169 if ec. steps % 12 == 0 {
172170 let tl = 0x8A ;
@@ -190,9 +188,7 @@ fn timers(ec: &mut Ec) {
190188
191189 // Timer 1 running
192190 if tcon & 1 << 6 != 0 {
193- if tmod & 0xF0 != 0x10 {
194- panic ! ( "unimplemented TMOD 0x{:02X}" , tmod) ;
195- }
191+ assert ! ( tmod & 0xF0 == 0x10 , "unimplemented TMOD 0x{:02X}" , tmod) ;
196192
197193 if ec. steps % 12 == 0 {
198194 let tl = 0x8B ;
@@ -222,7 +218,7 @@ fn main() {
222218 RUNNING . store ( false , Ordering :: SeqCst ) ;
223219 } ) . expect ( "failed to set ctrl-c handler" ) ;
224220
225- let pmem_path = env:: args ( ) . nth ( 1 ) . unwrap_or ( "ec.rom" . to_string ( ) ) ;
221+ let pmem_path = env:: args ( ) . nth ( 1 ) . unwrap_or_else ( || "ec.rom" . to_string ( ) ) ;
226222
227223 let mut pmem = fs:: read ( & pmem_path) . expect ( "failed to read ec.rom" ) ;
228224
0 commit comments