fix build

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-01-17 14:33:06 +01:00
parent bb5500dded
commit 5b94713317
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,61 @@
From 13d6bb3973f45811cebd926e4a64489b23f19172 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Wed, 17 Jan 2018 13:54:42 +0100
Subject: [PATCH] fix build with features enabled
Since 8817762d7b8f5cd10886147b828f95d19dc2a80a, build fails with any
features enabled..
error[E0308]: mismatched types
--> src/main.rs:95:30
|
95 | match_output(format, &languages);
| ^^^^^^^^^^
| |
| expected struct `tokei::Languages`, found reference
| help: consider removing the borrow: `languages`
|
= note: expected type `tokei::Languages`
found type `&tokei::Languages`
Problem is that when no features enabled, match_output() doesn't need
to "eat" `tokei::Languages`, but in real version of match_output it
must not be borrowed.
Fixes: https://github.com/Aaronepower/tokei/issues/177
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
src/input.rs | 3 ++-
src/main.rs | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/input.rs b/src/input.rs
index baf4e92..86697fd 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -171,7 +171,8 @@ mod io {
process::exit(1);
}
- pub fn match_output(_format: &str, _languages: &Languages) -> ! {
+ #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
+ pub fn match_output(_format: &str, _languages: Languages) -> ! {
eprintln!("{}", OUTPUT_ERROR);
process::exit(1);
}
diff --git a/src/main.rs b/src/main.rs
index cad9b2f..a3d86b3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -92,7 +92,7 @@ fn main() {
languages.get_statistics(&paths, ignored_directories);
if let Some(format) = output_option {
- match_output(format, &languages);
+ match_output(format, languages);
}
println!("{}", ROW);
--
2.15.1

View File

@ -16,6 +16,8 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{
# Initial patched metadata
# * Bump env_logger to 0.5.0, https://github.com/Aaronepower/tokei/pull/176
Patch0: tokei-7.0.0-fix-metadata.diff
# https://github.com/Aaronepower/tokei/pull/178
Patch0001: 0001-fix-build-with-features-enabled.patch
ExclusiveArch: %{rust_arches}