mirror of
https://github.com/notohh/rustlings.git
synced 2025-08-10 05:13:17 -04:00
Fix warnings
This commit is contained in:
parent
a4c07ca948
commit
b87aa98634
18 changed files with 28 additions and 8 deletions
solutions/13_error_handling
|
@ -16,6 +16,7 @@
|
|||
|
||||
use std::num::ParseIntError;
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
|
||||
let processing_fee = 1;
|
||||
let cost_per_item = 5;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::comparison_chain)]
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum CreationError {
|
||||
Negative,
|
||||
|
|
|
@ -36,7 +36,7 @@ impl PositiveNonzeroInteger {
|
|||
fn new(value: i64) -> Result<Self, CreationError> {
|
||||
match value {
|
||||
x if x < 0 => Err(CreationError::Negative),
|
||||
x if x == 0 => Err(CreationError::Zero),
|
||||
0 => Err(CreationError::Zero),
|
||||
x => Ok(Self(x as u64)),
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ fn main() {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use std::num::IntErrorKind;
|
||||
|
||||
#[test]
|
||||
fn test_parse_error() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue