Skip to content

Commit 30ba2a8

Browse files
bors[bot]austinbes
andauthored
Merge #58
58: Fix warnings in build scripts and examples r=korken89 a=austinglaser Fixes #57 The build scripts were missing `dyn` on the boxed error type; fixing those is a no-brainer. Additionally, there were warnings about unused `Result`s in the logging apps. I chose to explicitly ignore them (preserving the precise behavior which before had been implicit). But there might be an argument for `unwrap`ing them instead, or demonstrating more idiomatic error-handling. In any case, it may be worth adding some discussion about how error handling is basically being ignored here in favor of communicating other concepts. Apologies if it's already there - I'm still working through the book myself. Would anyone be interested in a section on idiomatic error handling in embedded rust? Is that a better fit for the embedded book rather than the embedonomicon? I'll admit that I don't really know much about this topic myself yet, but I'm interested to learn, and I'd be happy to strike up a dialogue with some folks who do have ideas there, do some drafting, and get some feedback/editing. If anyone's interested in this I'll open a separate issue to discuss in more depth. Co-authored-by: Austin Glaser <austin@boulderes.com>
2 parents c99004b + 3c726a5 commit 30ba2a8

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

ci/asm/rt/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{env, error::Error, fs::File, io::Write, path::PathBuf};
22

33
use cc::Build;
44

5-
fn main() -> Result<(), Box<Error>> {
5+
fn main() -> Result<(), Box<dyn Error>> {
66
// build directory for this crate
77
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
88

ci/asm/rt2/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
path::PathBuf,
77
};
88

9-
fn main() -> Result<(), Box<Error>> {
9+
fn main() -> Result<(), Box<dyn Error>> {
1010
// build directory for this crate
1111
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
1212

ci/logging/app/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ fn main() -> ! {
1414
#[export_name = "Hello, world!"]
1515
static A: u8 = 0;
1616

17-
writeln!(hstdout, "{:#x}", &A as *const u8 as usize);
17+
let _ = writeln!(hstdout, "{:#x}", &A as *const u8 as usize);
1818

1919
#[export_name = "Goodbye"]
2020
static B: u8 = 0;
2121

22-
writeln!(hstdout, "{:#x}", &B as *const u8 as usize);
22+
let _ = writeln!(hstdout, "{:#x}", &B as *const u8 as usize);
2323

2424
debug::exit(debug::EXIT_SUCCESS);
2525

ci/logging/app3/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fn main() -> ! {
2727
let hstdout = hio::hstdout().unwrap();
2828
let mut logger = Logger { hstdout };
2929

30-
log!(logger, "Hello, world!");
30+
let _ = log!(logger, "Hello, world!");
3131

32-
log!(logger, "Goodbye");
32+
let _ = log!(logger, "Goodbye");
3333

3434
debug::exit(debug::EXIT_SUCCESS);
3535

ci/logging/app4/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn main() -> ! {
1515
let hstdout = hio::hstdout().unwrap();
1616
let mut logger = Logger { hstdout };
1717

18-
warn!(logger, "Hello, world!"); // <- CHANGED!
18+
let _ = warn!(logger, "Hello, world!"); // <- CHANGED!
1919

20-
error!(logger, "Goodbye"); // <- CHANGED!
20+
let _ = error!(logger, "Goodbye"); // <- CHANGED!
2121

2222
debug::exit(debug::EXIT_SUCCESS);
2323

ci/logging/log/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, error::Error, fs::File, io::Write, path::PathBuf};
22

3-
fn main() -> Result<(), Box<Error>> {
3+
fn main() -> Result<(), Box<dyn Error>> {
44
// Put the linker script somewhere the linker can find it
55
let out = PathBuf::from(env::var("OUT_DIR")?);
66

ci/main/rt/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, error::Error, fs::File, io::Write, path::PathBuf};
22

3-
fn main() -> Result<(), Box<Error>> {
3+
fn main() -> Result<(), Box<dyn Error>> {
44
// build directory for this crate
55
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
66

0 commit comments

Comments
 (0)