summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2021-08-18 20:37:38 +0200
committerMartin Nordholts <enselic@gmail.com>2021-08-19 07:19:12 +0200
commited09f90e5e3b0b2bed93a591157b8b3a73e07ef8 (patch)
treed2a46a29191b14e6c880c303052bd093b03f06d2
parentcbd96237fde1f1ef94d60c0bc6e6e5e754ac1879 (diff)
Fix all lints that are new with Rust 1.54
They are all of the following type: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
-rw-r--r--src/assets.rs2
-rw-r--r--src/bin/bat/app.rs2
-rw-r--r--src/bin/bat/assets.rs4
-rw-r--r--src/bin/bat/main.rs2
-rw-r--r--src/controller.rs8
-rw-r--r--src/input.rs2
-rw-r--r--src/printer.rs12
7 files changed, 16 insertions, 16 deletions
diff --git a/src/assets.rs b/src/assets.rs
index 71a63bbc..a5f31cef 100644
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -408,7 +408,7 @@ impl SerializedSyntaxSet {
fn deserialize(&self) -> Result<SyntaxSet> {
match self {
SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data)),
- SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(&path, "syntax set"),
+ SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(path, "syntax set"),
}
}
}
diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
index f20bd502..bef66070 100644
--- a/src/bin/bat/app.rs
+++ b/src/bin/bat/app.rs
@@ -301,7 +301,7 @@ impl App {
.map(|style_str| {
style_str
.split(',')
- .map(|x| StyleComponent::from_str(&x))
+ .map(|x| StyleComponent::from_str(x))
.collect::<Result<Vec<StyleComponent>>>()
})
.transpose()?;
diff --git a/src/bin/bat/assets.rs b/src/bin/bat/assets.rs
index b50575dd..5e75492f 100644
--- a/src/bin/bat/assets.rs
+++ b/src/bin/bat/assets.rs
@@ -25,7 +25,7 @@ pub fn clear_assets() {
pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
let cache_dir = PROJECT_DIRS.cache_dir();
- if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
+ if let Some(metadata) = AssetsMetadata::load_from_folder(cache_dir)? {
if !metadata.is_compatible_with(crate_version!()) {
return Err(format!(
"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
}
let custom_assets = if use_custom_assets {
- HighlightingAssets::from_cache(&cache_dir).ok()
+ HighlightingAssets::from_cache(cache_dir).ok()
} else {
None
};
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index 6264bc9d..dda762d8 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -226,7 +226,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
- let controller = Controller::new(&config, &assets);
+ let controller = Controller::new(config, &assets);
controller.run(inputs)
}
diff --git a/src/controller.rs b/src/controller.rs
index a4d88c63..5e74c89e 100644
--- a/src/controller.rs
+++ b/src/controller.rs
@@ -45,7 +45,7 @@ impl<'b> Controller<'b> {
// Do not launch the pager if NONE of the input files exist
let mut paging_mode = self.config.paging_mode;
if self.config.paging_mode != PagingMode::Never {
- let call_pager = inputs.iter().any(|ref input| {
+ let call_pager = inputs.iter().any(|input| {
if let InputKind::OrdinaryFile(ref path) = input.kind {
Path::new(path).exists()
} else {
@@ -124,11 +124,11 @@ impl<'b> Controller<'b> {
};
let mut printer: Box<dyn Printer> = if self.config.loop_through {
- Box::new(SimplePrinter::new(&self.config))
+ Box::new(SimplePrinter::new(self.config))
} else {
Box::new(InteractivePrinter::new(
- &self.config,
- &self.assets,
+ self.config,
+ self.assets,
&mut opened_input,
#[cfg(feature = "git")]
&line_changes,
diff --git a/src/input.rs b/src/input.rs
index 012701ad..786a9e05 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -51,7 +51,7 @@ impl InputDescription {
pub fn title(&self) -> &String {
match self.title.as_ref() {
- Some(ref title) => title,
+ Some(title) => title,
None => &self.name,
}
}
diff --git a/src/printer.rs b/src/printer.rs
index f07d2db1..0b37cd2e 100644
--- a/src/printer.rs
+++ b/src/printer.rs
@@ -372,19 +372,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
line_buffer: &[u8],
) -> Result<()> {
let line = if self.config.show_nonprintable {
- replace_nonprintable(&line_buffer, self.config.tab_width)
+ replace_nonprintable(line_buffer, self.config.tab_width)
} else {
match self.content_type {
Some(ContentType::BINARY) | None => {
return Ok(());
}
Some(ContentType::UTF_16LE) => UTF_16LE
- .decode(&line_buffer, DecoderTrap::Replace)
+ .decode(line_buffer, DecoderTrap::Replace)
.map_err(|_| "Invalid UTF-16LE")?,
Some(ContentType::UTF_16BE) => UTF_16BE
- .decode(&line_buffer, DecoderTrap::Replace)
+ .decode(line_buffer, DecoderTrap::Replace)
.map_err(|_| "Invalid UTF-16BE")?,
- _ => String::from_utf8_lossy(&line_buffer).to_string(),
+ _ => String::from_utf8_lossy(line_buffer).to_string(),
}
};
@@ -420,7 +420,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
let decorations = self
.decorations
.iter()
- .map(|ref d| d.generate(line_number, false, self))
+ .map(|d| d.generate(line_number, false, self))
.collect::<Vec<_>>();
for deco in decorations {
@@ -531,7 +531,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
"{} ",
self.decorations
.iter()
- .map(|ref d| d
+ .map(|d| d
.generate(line_number, true, self)
.text)
.collect::<Vec<String>>()