summaryrefslogtreecommitdiff
path: root/exercises/13_error_handling/errors2.rs
diff options
context:
space:
mode:
authorMo <76752051+mo8it@users.noreply.github.com>2024-04-18 13:02:35 +0200
committerGitHub <noreply@github.com>2024-04-18 13:02:35 +0200
commit819dea250034a5658d0fe3306f6c35fc49961e17 (patch)
tree122060cdc0ef3f81d367e0afc7b0e3e9d29d33ee /exercises/13_error_handling/errors2.rs
parentc613b70363c60c6f4305d09c7394c96cdc6b69e4 (diff)
parent01e6732e4d920d9a1859e05fa28382e4307571af (diff)
Merge pull request #1949 from rust-lang/third-party-exercises
Support for third-party exercises
Diffstat (limited to 'exercises/13_error_handling/errors2.rs')
-rw-r--r--exercises/13_error_handling/errors2.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/exercises/13_error_handling/errors2.rs b/exercises/13_error_handling/errors2.rs
index 88d1bf4..e39aa95 100644
--- a/exercises/13_error_handling/errors2.rs
+++ b/exercises/13_error_handling/errors2.rs
@@ -1,5 +1,3 @@
-// errors2.rs
-//
// Say we're writing a game where you can buy items with tokens. All items cost
// 5 tokens, and whenever you purchase items there is a processing fee of 1
// token. A player of the game will type in how many items they want to buy, and
@@ -15,9 +13,6 @@
//
// There are at least two ways to implement this that are both correct-- but one
// is a lot shorter!
-//
-// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a
-// hint.
use std::num::ParseIntError;
@@ -29,6 +24,10 @@ pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
Ok(qty * cost_per_item + processing_fee)
}
+fn main() {
+ // You can optionally experiment here.
+}
+
#[cfg(test)]
mod tests {
use super::*;