From: Greg Burri Date: Tue, 30 Aug 2022 14:30:45 +0000 (+0200) Subject: Update dependencies and clean the main for chapter 2 X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=683c47fb3d9fe64fc91dd8cd60dab88790ba879a;p=rust_in_action.git Update dependencies and clean the main for chapter 2 --- diff --git a/ch2-str-simple-pattern/Cargo.lock b/ch2-str-simple-pattern/Cargo.lock index 3a88348..4ad8383 100644 --- a/ch2-str-simple-pattern/Cargo.lock +++ b/ch2-str-simple-pattern/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "aho-corasick" version = "0.7.18" @@ -11,9 +13,9 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] @@ -31,9 +33,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "ch2-str-simple-pattern" @@ -45,9 +47,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -69,21 +71,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.97" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "memchr" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -92,9 +94,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "strsim" @@ -113,9 +115,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "vec_map" diff --git a/ch2-str-simple-pattern/src/main.rs b/ch2-str-simple-pattern/src/main.rs index 51fccf0..7da24ef 100644 --- a/ch2-str-simple-pattern/src/main.rs +++ b/ch2-str-simple-pattern/src/main.rs @@ -8,18 +8,17 @@ use std::{ fs::File, io::{ self, BufReader, prelude::* } }; use regex::Regex; -use clap::{ App, Arg }; fn main() { - let args = App::new("grep-lite") + let args = clap::App::new("grep-lite") .version("0.1") .about("searches for patterns") - .arg(Arg::with_name("pattern") + .arg(clap::Arg::with_name("pattern") .help("The pattern to search for") .takes_value(true) .required(true) ) - .arg(Arg::with_name("file") + .arg(clap::Arg::with_name("file") .help("File to search into. Read from stding if not given") .takes_value(true) .required(false) @@ -56,7 +55,7 @@ Process text lines from the given reader and try to find the given pattern. ``` */ -fn process_lines(reader: T, pattern_re: Regex) { +fn process_lines(reader: T, pattern_re: Regex) { for (i, line_result) in reader.lines().enumerate() { match line_result { Ok(line) => {