Skip to content

Commit 491a318

Browse files
committed
add errors project; fix build in previous session
1 parent 8a9100a commit 491a318

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[workspace]
2-
members = ["./ownership-and-borrowing", "options-and-results"]
2+
members = ["./ownership-and-borrowing", "options-and-results", "errors"]

errors/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "errors"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

errors/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}

options-and-results/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ fn add_one_safely(v: u8) -> Result<u8, &'static str> {
55
}
66

77
fn main() -> Result<(), &'static str> {
8-
std::env::args()
9-
.is_empty()
8+
(std::env::args().len() == 1)
109
.then(|| "need two args")
11-
.map(Err)
10+
.map(Err::<(), _>)
1211
.transpose()?;
1312
println!("{}", add_one_safely(255)?);
1413
Ok(())

0 commit comments

Comments
 (0)