From fc975af8e9cf489d4579cf8ff014a823c1e059d5 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 31 Mar 2017 15:59:04 -0400 Subject: [PATCH] Enforce 79 column limit. Grr. --- src/app.rs | 11 ++++++----- src/args.rs | 2 +- src/decoder.rs | 3 ++- src/printer.rs | 9 ++++----- src/search_buffer.rs | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/app.rs b/src/app.rs index 19a243bf..d09160ac 100644 --- a/src/app.rs +++ b/src/app.rs @@ -388,10 +388,11 @@ lazy_static! { "Limit the number of matching lines per file searched to NUM."); doc!(h, "max-filesize", "Ignore files larger than NUM in size.", - "Ignore files larger than NUM in size. Does not ignore directories. \ + "Ignore files larger than NUM in size. Does not ignore \ + directories. \ \n\nThe input format accepts suffixes of K, M or G which \ - correspond to kilobytes, megabytes and gigabytes. If no suffix is \ - provided the input is treated as bytes. \ + correspond to kilobytes, megabytes and gigabytes. If no suffix \ + is provided the input is treated as bytes. \ \n\nExample: --max-filesize 50K or --max-filesize 80M"); doc!(h, "maxdepth", "Descend at most NUM directories.", @@ -496,8 +497,8 @@ lazy_static! { permits specifying one or more other type names (separated by a \ comma) that have been defined and its rules will automatically \ be imported into the type specified. For example, to create a \ - type called src that matches C++, Python and Markdown files, one \ - can use:\n\n\ + type called src that matches C++, Python and Markdown files, \ + one can use:\n\n\ --type-add 'src:include:cpp,py,md'\n\n\ Additional glob rules can still be added to the src type by \ using the --type-add flag again:\n\n\ diff --git a/src/args.rs b/src/args.rs index 0b1aaa9a..2d046fd6 100644 --- a/src/args.rs +++ b/src/args.rs @@ -837,7 +837,7 @@ impl<'a> ArgMatches<'a> { let caps = try!(re.captures(&max_filesize) .ok_or("invalid format for max-filesize argument")); - let value = try!(caps[1].parse::().map_err(|err| err.to_string())); + let value = try!(caps[1].parse::().map_err(|err|err.to_string())); let suffix = caps.get(2).map(|x| x.as_str()); match suffix { diff --git a/src/decoder.rs b/src/decoder.rs index 22186708..d718f55c 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -447,7 +447,8 @@ mod tests { test_trans_simple!(trans_simple_utf16be, "utf-16be", b"\x04\x16", "Ж"); test_trans_simple!(trans_simple_chinese, "chinese", b"\xA7\xA8", "Ж"); test_trans_simple!(trans_simple_korean, "korean", b"\xAC\xA8", "Ж"); - test_trans_simple!(trans_simple_big5_hkscs, "big5-hkscs", b"\xC7\xFA", "Ж"); + test_trans_simple!( + trans_simple_big5_hkscs, "big5-hkscs", b"\xC7\xFA", "Ж"); test_trans_simple!(trans_simple_gbk, "gbk", b"\xA7\xA8", "Ж"); test_trans_simple!(trans_simple_sjis, "sjis", b"\x84\x47", "Ж"); test_trans_simple!(trans_simple_eucjp, "euc-jp", b"\xA7\xA8", "Ж"); diff --git a/src/printer.rs b/src/printer.rs index 6667e992..c1fc0eb8 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -153,9 +153,6 @@ impl Printer { /// Replace every match in each matching line with the replacement string /// given. - /// - /// The replacement string syntax is documented here: - /// https://doc.rust-lang.org/regex/regex/bytes/struct.Captures.html#method.expand pub fn replace(mut self, replacement: Vec) -> Printer { self.replace = Some(replacement); self @@ -290,7 +287,8 @@ impl Printer { re.replace_all(&buf[start..end], replacer) }; if self.max_columns.map_or(false, |m| line.len() > m) { - let msg = format!("[Omitted long line with {} replacements]", count); + let msg = format!( + "[Omitted long line with {} replacements]", count); self.write_colored(msg.as_bytes(), |colors| colors.matched()); self.write_eol(); return; @@ -319,7 +317,8 @@ impl Printer { let mut last_written = 0; for m in re.find_iter(buf) { self.write(&buf[last_written..m.start()]); - self.write_colored(&buf[m.start()..m.end()], |colors| colors.matched()); + self.write_colored( + &buf[m.start()..m.end()], |colors| colors.matched()); last_written = m.end(); } self.write(&buf[last_written..]); diff --git a/src/search_buffer.rs b/src/search_buffer.rs index 4745c2f8..068b1205 100644 --- a/src/search_buffer.rs +++ b/src/search_buffer.rs @@ -3,8 +3,8 @@ The `search_buffer` module is responsible for searching a single file all in a single buffer. Typically, the source of the buffer is a memory map. This can be useful for when memory maps are faster than streaming search. -Note that this module doesn't quite support everything that `search_stream` does. -Notably, showing contexts. +Note that this module doesn't quite support everything that `search_stream` +Notdoes. ably, showing contexts. */ use std::cmp; use std::path::Path;