From 91b57a3f28776aae34cbfb8c0729856a6d2ca548 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 10 Mar 2023 02:01:18 +0900 Subject: [PATCH] Fix clippy warnings --- common/src/str.rs | 4 ++-- rust-toolchain.toml | 2 +- vm/src/stdlib/io.rs | 19 ++++--------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/common/src/str.rs b/common/src/str.rs index febab87f4..7e2024d0f 100644 --- a/common/src/str.rs +++ b/common/src/str.rs @@ -245,10 +245,10 @@ pub mod levenshtein { if a == b { return 0; } - if (b'A'..=b'Z').contains(&a) { + if a.is_ascii_uppercase() { a += b'a' - b'A'; } - if (b'A'..=b'Z').contains(&b) { + if b.is_ascii_uppercase() { b += b'a' - b'A'; } if a == b { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 588ffd578..292fe499e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.67.1" +channel = "stable" diff --git a/vm/src/stdlib/io.rs b/vm/src/stdlib/io.rs index 087d01008..86dfc1e19 100644 --- a/vm/src/stdlib/io.rs +++ b/vm/src/stdlib/io.rs @@ -1879,8 +1879,9 @@ mod _io { write_through: bool, } - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Copy, Clone, Default)] enum Newlines { + #[default] Universal, Passthrough, Lf, @@ -1888,13 +1889,6 @@ mod _io { Crlf, } - impl Default for Newlines { - #[inline] - fn default() -> Self { - Newlines::Universal - } - } - impl Newlines { /// returns position where the new line starts if found, otherwise position at which to /// continue the search after more is read into the buffer @@ -2054,8 +2048,9 @@ mod _io { data: PendingWritesData, } - #[derive(Debug)] + #[derive(Debug, Default)] enum PendingWritesData { + #[default] None, One(PendingWrite), Many(Vec), @@ -2076,12 +2071,6 @@ mod _io { } } - impl Default for PendingWritesData { - fn default() -> Self { - PendingWritesData::None - } - } - impl PendingWrites { fn push(&mut self, write: PendingWrite) { self.num_bytes += write.as_bytes().len();