Skip to content

Commit

Permalink
Merge pull request #861 from petertseng/warn
Browse files Browse the repository at this point in the history
decimal, isbn-verifier, react, rectangles: Heed Rust 1.37.0 warnings
  • Loading branch information
petertseng authored Aug 28, 2019
2 parents 7c2ee05 + f737a77 commit 62a872c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion exercises/decimal/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Decimal {
let mut decimal_index = None;
for ch in input.chars() {
match ch {
'0'...'9' | '-' | '+' => {
'0'..='9' | '-' | '+' => {
digits.push(ch);
if let Some(idx) = decimal_index.as_mut() {
*idx += 1;
Expand Down
2 changes: 1 addition & 1 deletion exercises/isbn-verifier/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn is_valid_isbn(isbn: &str) -> bool {
let mut coefficient = 10;
for (position, c) in isbn.char_indices() {
let digit_value = match c {
'0'...'9' => c.to_digit(10).unwrap(),
'0'..='9' => c.to_digit(10).unwrap(),
'X' if is_X_valid(&position, &isbn_type) => 10,
'-' if is_dash_valid(&position, &isbn_type) => continue,
_ => return false,
Expand Down
4 changes: 2 additions & 2 deletions exercises/react/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ struct ComputeCell<'a, T: Copy> {
cell: Cell<T>,

dependencies: Vec<CellID>,
f: Box<Fn(&[T]) -> T + 'a>,
f: Box<dyn Fn(&[T]) -> T + 'a>,
callbacks_issued: usize,
callbacks: HashMap<CallbackID, Box<FnMut(T) -> () + 'a>>,
callbacks: HashMap<CallbackID, Box<dyn FnMut(T) -> () + 'a>>,
}

impl<T: Copy> Cell<T> {
Expand Down
2 changes: 1 addition & 1 deletion exercises/rectangles/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn count(lines: &[&str]) -> usize {
total
}

fn scan_connected(area: &Area) -> Connections {
fn scan_connected(area: &dyn Area) -> Connections {
let mut conns = Connections{
lines: HashSet::new(),
points: HashMap::new()
Expand Down

0 comments on commit 62a872c

Please sign in to comment.