on master help sign in
Fix all lints that are new with Rust 1.54
ed09f90Martin Nordholts
src/assets.rs+1−1
@@ -408,7 +408,7 @@ impl SerializedSyntaxSet {
408 fn deserialize(&self) -> Result<SyntaxSet> {
408 fn deserialize(&self) -> Result<SyntaxSet> {
409 match self {
409 match self {
410 SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data)),
410 SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data)),
411− SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(&path, "syntax set"),
411+ SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(path, "syntax set"),
412 }
412 }
413 }
413 }
414}
414}
src/bin/bat/app.rs+1−1
@@ -301,7 +301,7 @@ impl App {
301 .map(|style_str| {
301 .map(|style_str| {
302 style_str
302 style_str
303 .split(',')
303 .split(',')
304− .map(|x| StyleComponent::from_str(&x))
304+ .map(|x| StyleComponent::from_str(x))
305 .collect::<Result<Vec<StyleComponent>>>()
305 .collect::<Result<Vec<StyleComponent>>>()
306 })
306 })
307 .transpose()?;
307 .transpose()?;
src/bin/bat/assets.rs+2−2
@@ -25,7 +25,7 @@ pub fn clear_assets() {
25
25
26pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
26pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
27 let cache_dir = PROJECT_DIRS.cache_dir();
27 let cache_dir = PROJECT_DIRS.cache_dir();
28− if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
28+ if let Some(metadata) = AssetsMetadata::load_from_folder(cache_dir)? {
29 if !metadata.is_compatible_with(crate_version!()) {
29 if !metadata.is_compatible_with(crate_version!()) {
30 return Err(format!(
30 return Err(format!(
31 "The binary caches for the user-customized syntaxes and themes \
31 "The binary caches for the user-customized syntaxes and themes \
@@ -42,7 +42,7 @@ pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<Highlighti
42 }
42 }
43
43
44 let custom_assets = if use_custom_assets {
44 let custom_assets = if use_custom_assets {
45− HighlightingAssets::from_cache(&cache_dir).ok()
45+ HighlightingAssets::from_cache(cache_dir).ok()
46 } else {
46 } else {
47 None
47 None
48 };
48 };
src/bin/bat/main.rs+1−1
@@ -226,7 +226,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
226
226
227fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
227fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
228 let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
228 let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
229− let controller = Controller::new(&config, &assets);
229+ let controller = Controller::new(config, &assets);
230 controller.run(inputs)
230 controller.run(inputs)
231}
231}
232
232
src/controller.rs+4−4
@@ -45,7 +45,7 @@ impl<'b> Controller<'b> {
45 // Do not launch the pager if NONE of the input files exist
45 // Do not launch the pager if NONE of the input files exist
46 let mut paging_mode = self.config.paging_mode;
46 let mut paging_mode = self.config.paging_mode;
47 if self.config.paging_mode != PagingMode::Never {
47 if self.config.paging_mode != PagingMode::Never {
48− let call_pager = inputs.iter().any(|ref input| {
48+ let call_pager = inputs.iter().any(|input| {
49 if let InputKind::OrdinaryFile(ref path) = input.kind {
49 if let InputKind::OrdinaryFile(ref path) = input.kind {
50 Path::new(path).exists()
50 Path::new(path).exists()
51 } else {
51 } else {
@@ -124,11 +124,11 @@ impl<'b> Controller<'b> {
124 };
124 };
125
125
126 let mut printer: Box<dyn Printer> = if self.config.loop_through {
126 let mut printer: Box<dyn Printer> = if self.config.loop_through {
127− Box::new(SimplePrinter::new(&self.config))
127+ Box::new(SimplePrinter::new(self.config))
128 } else {
128 } else {
129 Box::new(InteractivePrinter::new(
129 Box::new(InteractivePrinter::new(
130− &self.config,
130+ self.config,
131− &self.assets,
131+ self.assets,
132 &mut opened_input,
132 &mut opened_input,
133 #[cfg(feature = "git")]
133 #[cfg(feature = "git")]
134 &line_changes,
134 &line_changes,
src/input.rs+1−1
@@ -51,7 +51,7 @@ impl InputDescription {
51
51
52 pub fn title(&self) -> &String {
52 pub fn title(&self) -> &String {
53 match self.title.as_ref() {
53 match self.title.as_ref() {
54− Some(ref title) => title,
54+ Some(title) => title,
55 None => &self.name,
55 None => &self.name,
56 }
56 }
57 }
57 }
src/printer.rs+6−6
@@ -372,19 +372,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
372 line_buffer: &[u8],
372 line_buffer: &[u8],
373 ) -> Result<()> {
373 ) -> Result<()> {
374 let line = if self.config.show_nonprintable {
374 let line = if self.config.show_nonprintable {
375− replace_nonprintable(&line_buffer, self.config.tab_width)
375+ replace_nonprintable(line_buffer, self.config.tab_width)
376 } else {
376 } else {
377 match self.content_type {
377 match self.content_type {
378 Some(ContentType::BINARY) | None => {
378 Some(ContentType::BINARY) | None => {
379 return Ok(());
379 return Ok(());
380 }
380 }
381 Some(ContentType::UTF_16LE) => UTF_16LE
381 Some(ContentType::UTF_16LE) => UTF_16LE
382− .decode(&line_buffer, DecoderTrap::Replace)
382+ .decode(line_buffer, DecoderTrap::Replace)
383 .map_err(|_| "Invalid UTF-16LE")?,
383 .map_err(|_| "Invalid UTF-16LE")?,
384 Some(ContentType::UTF_16BE) => UTF_16BE
384 Some(ContentType::UTF_16BE) => UTF_16BE
385− .decode(&line_buffer, DecoderTrap::Replace)
385+ .decode(line_buffer, DecoderTrap::Replace)
386 .map_err(|_| "Invalid UTF-16BE")?,
386 .map_err(|_| "Invalid UTF-16BE")?,
387− _ => String::from_utf8_lossy(&line_buffer).to_string(),
387+ _ => String::from_utf8_lossy(line_buffer).to_string(),
388 }
388 }
389 };
389 };
390
390
@@ -420,7 +420,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
420 let decorations = self
420 let decorations = self
421 .decorations
421 .decorations
422 .iter()
422 .iter()
423− .map(|ref d| d.generate(line_number, false, self))
423+ .map(|d| d.generate(line_number, false, self))
424 .collect::<Vec<_>>();
424 .collect::<Vec<_>>();
425
425
426 for deco in decorations {
426 for deco in decorations {
@@ -531,7 +531,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
531 "{} ",
531 "{} ",
532 self.decorations
532 self.decorations
533 .iter()
533 .iter()
534− .map(|ref d| d
534+ .map(|d| d
535 .generate(line_number, true, self)
535 .generate(line_number, true, self)
536 .text)
536 .text)
537 .collect::<Vec<String>>()
537 .collect::<Vec<String>>()