diff --git a/examples/async-task-multiple-prios.rs b/examples/async-task-multiple-prios.rs index 2f3a0f7b27..f614820cb5 100644 --- a/examples/async-task-multiple-prios.rs +++ b/examples/async-task-multiple-prios.rs @@ -24,8 +24,8 @@ mod app { struct Local {} #[init] - fn init(cx: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + fn init(_: init::Context) -> (Shared, Local) { + hprintln!("init"); async_task1::spawn().ok(); async_task2::spawn().ok(); @@ -51,8 +51,7 @@ mod app { *a += 1; *a }) - ) - .ok(); + ); } #[task(priority = 1, shared = [a, b])] @@ -63,8 +62,7 @@ mod app { *a += 1; *a }) - ) - .ok(); + ); } #[task(priority = 2, shared = [a, b])] @@ -75,8 +73,7 @@ mod app { *a += 1; *a }) - ) - .ok(); + ); } #[task(priority = 2, shared = [a, b])] @@ -87,7 +84,6 @@ mod app { *a += 1; *a }) - ) - .ok(); + ); } } diff --git a/examples/async-task.rs b/examples/async-task.rs index 210a86510d..780bc08157 100644 --- a/examples/async-task.rs +++ b/examples/async-task.rs @@ -24,7 +24,7 @@ mod app { #[init] fn init(_cx: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); async_task::spawn().unwrap(); async_task2::spawn().unwrap(); @@ -44,18 +44,18 @@ mod app { #[task(binds = UART1, shared = [a])] fn hw_task(cx: hw_task::Context) { let hw_task::SharedResources { a: _, .. } = cx.shared; - hprintln!("hello from hw").ok(); + hprintln!("hello from hw"); } #[task(shared = [a])] async fn async_task(cx: async_task::Context) { let async_task::SharedResources { a: _, .. } = cx.shared; - hprintln!("hello from async").ok(); + hprintln!("hello from async"); } #[task(priority = 2, shared = [a])] async fn async_task2(cx: async_task2::Context) { let async_task2::SharedResources { a: _, .. } = cx.shared; - hprintln!("hello from async2").ok(); + hprintln!("hello from async2"); } } diff --git a/examples/big-struct-opt.rs b/examples/big-struct-opt.rs index 4bf93b2af5..3100a0e22c 100644 --- a/examples/big-struct-opt.rs +++ b/examples/big-struct-opt.rs @@ -67,13 +67,13 @@ mod app { fn uart0(mut cx: uart0::Context) { cx.shared .big_struct - .lock(|b| hprintln!("uart0 data:{:?}", &b.data[0..5]).unwrap()); + .lock(|b| hprintln!("uart0 data:{:?}", &b.data[0..5])); } #[task(shared = [big_struct], priority = 2)] async fn async_task(mut cx: async_task::Context) { cx.shared .big_struct - .lock(|b| hprintln!("async_task data:{:?}", &b.data[0..5]).unwrap()); + .lock(|b| hprintln!("async_task data:{:?}", &b.data[0..5])); } } diff --git a/examples/binds.rs b/examples/binds.rs index ec25ccca88..d78dffbf5f 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -23,14 +23,14 @@ mod app { fn init(_: init::Context) -> (Shared, Local) { rtic::pend(Interrupt::UART0); - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}) } #[idle] fn idle(_: idle::Context) -> ! { - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); @@ -49,7 +49,6 @@ mod app { "foo called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); } } diff --git a/examples/complex.rs b/examples/complex.rs index df9c862214..ab3979244c 100644 --- a/examples/complex.rs +++ b/examples/complex.rs @@ -25,7 +25,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); ( Shared { @@ -39,31 +39,31 @@ mod app { #[idle(shared = [s2, s3])] fn idle(mut cx: idle::Context) -> ! { - hprintln!("idle p0 started").ok(); + hprintln!("idle p0 started"); rtic::pend(Interrupt::GPIOC); cx.shared.s3.lock(|s| { - hprintln!("idle enter lock s3 {}", s).ok(); - hprintln!("idle pend t0").ok(); + hprintln!("idle enter lock s3 {}", s); + hprintln!("idle pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3 - hprintln!("idle pend t1").ok(); + hprintln!("idle pend t1"); rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3 - hprintln!("idle pend t2").ok(); + hprintln!("idle pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("idle still in lock s3 {}", s).ok(); + hprintln!("idle still in lock s3 {}", s); }); - hprintln!("\nback in idle").ok(); + hprintln!("\nback in idle"); cx.shared.s2.lock(|s| { - hprintln!("enter lock s2 {}", s).ok(); - hprintln!("idle pend t0").ok(); + hprintln!("enter lock s2 {}", s); + hprintln!("idle pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 - hprintln!("idle pend t1").ok(); + hprintln!("idle pend t1"); rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing - hprintln!("idle pend t2").ok(); + hprintln!("idle pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("idle still in lock s2 {}", s).ok(); + hprintln!("idle still in lock s2 {}", s); }); - hprintln!("\nidle exit").ok(); + hprintln!("\nidle exit"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator @@ -81,9 +81,8 @@ mod app { "t0 p2 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .ok(); - hprintln!("t0 p2 exit").ok(); + ); + hprintln!("t0 p2 exit"); } #[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])] @@ -95,19 +94,18 @@ mod app { "t1 p3 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .ok(); + ); cx.shared.s4.lock(|s| { - hprintln!("t1 enter lock s4 {}", s).ok(); - hprintln!("t1 pend t0").ok(); + hprintln!("t1 enter lock s4 {}", s); + hprintln!("t1 pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 - hprintln!("t1 pend t2").ok(); + hprintln!("t1 pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("t1 still in lock s4 {}", s).ok(); + hprintln!("t1 still in lock s4 {}", s); }); - hprintln!("t1 p3 exit").ok(); + hprintln!("t1 p3 exit"); } #[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])] @@ -119,13 +117,12 @@ mod app { "t2 p4 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); cx.shared.s4.lock(|s| { - hprintln!("enter lock s4 {}", s).ok(); + hprintln!("enter lock s4 {}", s); *s += 1; }); - hprintln!("t3 p4 exit").ok(); + hprintln!("t3 p4 exit"); } } diff --git a/examples/destructure.rs b/examples/destructure.rs index 89336bfd74..dc5d8ef8ea 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -43,7 +43,7 @@ mod app { let b = cx.shared.b; let c = cx.shared.c; - hprintln!("foo: a = {}, b = {}, c = {}", a, b, c).unwrap(); + hprintln!("foo: a = {}, b = {}, c = {}", a, b, c); } // De-structure-ing syntax @@ -51,6 +51,6 @@ mod app { async fn bar(cx: bar::Context) { let bar::SharedResources { a, b, c, .. } = cx.shared; - hprintln!("bar: a = {}, b = {}, c = {}", a, b, c).unwrap(); + hprintln!("bar: a = {}, b = {}, c = {}", a, b, c); } } diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index c9fc108670..23b99d5ad5 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -10,7 +10,7 @@ use panic_semihosting as _; // Free function implementing the interrupt bound task `foo`. fn foo(_: app::foo::Context) { - hprintln!("foo called").ok(); + hprintln!("foo called"); } #[rtic::app(device = lm3s6965)] @@ -29,14 +29,14 @@ mod app { fn init(_: init::Context) -> (Shared, Local) { rtic::pend(Interrupt::UART0); - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}) } #[idle] fn idle(_: idle::Context) -> ! { - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); diff --git a/examples/extern_spawn.rs b/examples/extern_spawn.rs index 2d9d7b636a..8a3928d5b0 100644 --- a/examples/extern_spawn.rs +++ b/examples/extern_spawn.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; // Free function implementing the spawnable task `foo`. // Notice, you need to indicate an anonymous lifetime <'a_> async fn foo(_c: app::foo::Context<'_>) { - hprintln!("foo").unwrap(); + hprintln!("foo"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/generics.rs b/examples/generics.rs index a73b00fb22..7117349a1e 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -32,7 +32,7 @@ mod app { #[task(binds = UART0, shared = [shared], local = [state: u32 = 0])] fn uart0(c: uart0::Context) { - hprintln!("UART0(STATE = {})", *c.local.state).unwrap(); + hprintln!("UART0(STATE = {})", *c.local.state); // second argument has type `shared::shared` super::advance(c.local.state, c.shared.shared); @@ -44,7 +44,7 @@ mod app { #[task(binds = UART1, priority = 2, shared = [shared], local = [state: u32 = 0])] fn uart1(c: uart1::Context) { - hprintln!("UART1(STATE = {})", *c.local.state).unwrap(); + hprintln!("UART1(STATE = {})", *c.local.state); // second argument has type `shared::shared` super::advance(c.local.state, c.shared.shared); @@ -61,5 +61,5 @@ fn advance(state: &mut u32, mut shared: impl Mutex) { (old, *shared) }); - hprintln!("shared: {} -> {}", old, new).unwrap(); + hprintln!("shared: {} -> {}", old, new); } diff --git a/examples/hardware.rs b/examples/hardware.rs index 8e4f423b7a..d3ceab9ed6 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -24,7 +24,7 @@ mod app { // `init` returns because interrupts are disabled rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}) } @@ -33,7 +33,7 @@ mod app { fn idle(_: idle::Context) -> ! { // interrupts are enabled again; the `UART0` handler runs at this point - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); @@ -53,7 +53,6 @@ mod app { "UART0 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); } } diff --git a/examples/idle-wfi.rs b/examples/idle-wfi.rs index dd2d43f7c7..a68fe84560 100644 --- a/examples/idle-wfi.rs +++ b/examples/idle-wfi.rs @@ -19,7 +19,7 @@ mod app { #[init] fn init(mut cx: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); // Set the ARM SLEEPONEXIT bit to go to sleep after handling interrupts // See https://developer.arm.com/docs/100737/0100/power-management/sleep-mode/sleep-on-exit-bit @@ -33,7 +33,7 @@ mod app { // Locals in idle have lifetime 'static let _x: &'static mut u32 = cx.local.x; - hprintln!("idle").unwrap(); + hprintln!("idle"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/idle.rs b/examples/idle.rs index 9a7a7275a9..78f169777a 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -19,7 +19,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}) } @@ -29,7 +29,7 @@ mod app { // Locals in idle have lifetime 'static let _x: &'static mut u32 = cx.local.x; - hprintln!("idle").unwrap(); + hprintln!("idle"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/init.rs b/examples/init.rs index d37903ea50..1e362be702 100644 --- a/examples/init.rs +++ b/examples/init.rs @@ -32,7 +32,7 @@ mod app { // to indicate that this is a critical section let _cs_token: bare_metal::CriticalSection = cx.cs; - hprintln!("init").unwrap(); + hprintln!("init"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/locals.rs b/examples/locals.rs index a35b4c9275..4e3b98bc86 100644 --- a/examples/locals.rs +++ b/examples/locals.rs @@ -45,7 +45,7 @@ mod app { let local_to_idle = cx.local.local_to_idle; *local_to_idle += 1; - hprintln!("idle: local_to_idle = {}", local_to_idle).unwrap(); + hprintln!("idle: local_to_idle = {}", local_to_idle); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator @@ -69,7 +69,7 @@ mod app { // error: no `local_to_bar` field in `foo::LocalResources` // cx.local.local_to_bar += 1; - hprintln!("foo: local_to_foo = {}", local_to_foo).unwrap(); + hprintln!("foo: local_to_foo = {}", local_to_foo); } // `local_to_bar` can only be accessed from this context @@ -81,6 +81,6 @@ mod app { // error: no `local_to_foo` field in `bar::LocalResources` // cx.local.local_to_foo += 1; - hprintln!("bar: local_to_bar = {}", local_to_bar).unwrap(); + hprintln!("bar: local_to_bar = {}", local_to_bar); } } diff --git a/examples/lock.rs b/examples/lock.rs index 50b6aaaefd..3c1a5142a1 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -30,7 +30,7 @@ mod app { // when omitted priority is assumed to be `1` #[task(shared = [shared])] async fn foo(mut c: foo::Context) { - hprintln!("A").unwrap(); + hprintln!("A"); // the lower priority task requires a critical section to access the data c.shared.shared.lock(|shared| { @@ -40,7 +40,7 @@ mod app { // bar will *not* run right now due to the critical section bar::spawn().unwrap(); - hprintln!("B - shared = {}", *shared).unwrap(); + hprintln!("B - shared = {}", *shared); // baz does not contend for `shared` so it's allowed to run now baz::spawn().unwrap(); @@ -48,7 +48,7 @@ mod app { // critical section is over: bar can now start - hprintln!("E").unwrap(); + hprintln!("E"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } @@ -62,11 +62,11 @@ mod app { *shared }); - hprintln!("D - shared = {}", shared).unwrap(); + hprintln!("D - shared = {}", shared); } #[task(priority = 3)] async fn baz(_: baz::Context) { - hprintln!("C").unwrap(); + hprintln!("C"); } } diff --git a/examples/multilock.rs b/examples/multilock.rs index 7bea2d37c4..2eb285ea9b 100644 --- a/examples/multilock.rs +++ b/examples/multilock.rs @@ -48,7 +48,7 @@ mod app { *s2 += 1; *s3 += 1; - hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3).unwrap(); + hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3); }); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/not-sync.rs b/examples/not-sync.rs index eb5c9f8fab..28a48f2321 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -32,7 +32,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); foo::spawn().unwrap(); bar::spawn().unwrap(); @@ -56,12 +56,12 @@ mod app { #[task(shared = [&shared])] async fn foo(c: foo::Context) { let shared: &NotSync = c.shared.shared; - hprintln!("foo a {}", shared.data).unwrap(); + hprintln!("foo a {}", shared.data); } #[task(shared = [&shared])] async fn bar(c: bar::Context) { let shared: &NotSync = c.shared.shared; - hprintln!("foo a {}", shared.data).unwrap(); + hprintln!("foo a {}", shared.data); } } diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index b506e44130..09cb23a594 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -31,13 +31,13 @@ mod app { #[task(shared = [&key])] async fn foo(cx: foo::Context) { let key: &u32 = cx.shared.key; - hprintln!("foo(key = {:#x})", key).unwrap(); + hprintln!("foo(key = {:#x})", key); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2, shared = [&key])] async fn bar(cx: bar::Context) { - hprintln!("bar(key = {:#x})", cx.shared.key).unwrap(); + hprintln!("bar(key = {:#x})", cx.shared.key); } } diff --git a/examples/preempt.rs b/examples/preempt.rs index aad9125301..960fc57111 100644 --- a/examples/preempt.rs +++ b/examples/preempt.rs @@ -26,21 +26,21 @@ mod app { #[task(priority = 1)] async fn foo(_: foo::Context) { - hprintln!("foo - start").unwrap(); + hprintln!("foo - start"); baz::spawn().unwrap(); - hprintln!("foo - end").unwrap(); + hprintln!("foo - end"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2)] async fn bar(_: bar::Context) { - hprintln!(" bar").unwrap(); + hprintln!(" bar"); } #[task(priority = 2)] async fn baz(_: baz::Context) { - hprintln!(" baz - start").unwrap(); + hprintln!(" baz - start"); bar::spawn().unwrap(); - hprintln!(" baz - end").unwrap(); + hprintln!(" baz - end"); } } diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs index dd1f76e5a7..316f6d8c53 100644 --- a/examples/ramfunc.rs +++ b/examples/ramfunc.rs @@ -33,7 +33,7 @@ mod app { #[inline(never)] #[task] async fn foo(_: foo::Context) { - hprintln!("foo").unwrap(); + hprintln!("foo"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs index a4478ce6b4..2acbbc36fc 100644 --- a/examples/resource-user-struct.rs +++ b/examples/resource-user-struct.rs @@ -55,7 +55,7 @@ mod app { *shared }); - hprintln!("UART0: shared = {}", shared).unwrap(); + hprintln!("UART0: shared = {}", shared); } // `shared` can be accessed from this context @@ -66,6 +66,6 @@ mod app { *shared }); - hprintln!("UART1: shared = {}", shared).unwrap(); + hprintln!("UART1: shared = {}", shared); } } diff --git a/examples/shared.rs b/examples/shared.rs index fdc1b1c5c7..fd31cfb28a 100644 --- a/examples/shared.rs +++ b/examples/shared.rs @@ -34,7 +34,7 @@ mod app { fn idle(mut c: idle::Context) -> ! { loop { if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) { - hprintln!("received message: {}", byte).unwrap(); + hprintln!("received message: {}", byte); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } else { diff --git a/examples/spawn.rs b/examples/spawn.rs index 266ace8630..384f0a0057 100644 --- a/examples/spawn.rs +++ b/examples/spawn.rs @@ -20,7 +20,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local) { - hprintln!("init").unwrap(); + hprintln!("init"); foo::spawn().unwrap(); (Shared {}, Local {}) @@ -28,7 +28,7 @@ mod app { #[task] async fn foo(_: foo::Context) { - hprintln!("foo").unwrap(); + hprintln!("foo"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/static.rs b/examples/static.rs index 9c981db3e9..822224e373 100644 --- a/examples/static.rs +++ b/examples/static.rs @@ -38,7 +38,7 @@ mod app { loop { // Lock-free access to the same underlying queue! if let Some(data) = c.local.c.dequeue() { - hprintln!("received message: {}", data).unwrap(); + hprintln!("received message: {}", data); // Run foo until data if data == 3 { diff --git a/examples/task.rs b/examples/task.rs index fe1408b4ac..50287edd30 100644 --- a/examples/task.rs +++ b/examples/task.rs @@ -27,31 +27,31 @@ mod app { #[task] async fn foo(_: foo::Context) { - hprintln!("foo - start").unwrap(); + hprintln!("foo - start"); // spawns `bar` onto the task scheduler // `foo` and `bar` have the same priority so `bar` will not run until // after `foo` terminates bar::spawn().unwrap(); - hprintln!("foo - middle").unwrap(); + hprintln!("foo - middle"); // spawns `baz` onto the task scheduler // `baz` has higher priority than `foo` so it immediately preempts `foo` baz::spawn().unwrap(); - hprintln!("foo - end").unwrap(); + hprintln!("foo - end"); } #[task] async fn bar(_: bar::Context) { - hprintln!("bar").unwrap(); + hprintln!("bar"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2)] async fn baz(_: baz::Context) { - hprintln!("baz").unwrap(); + hprintln!("baz"); } }