Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Auto merge of #22 - m-n:onecpp, r=kbknapp
Browse files Browse the repository at this point in the history
fix: Batch results by language, not file extension

Fixes some extensions creating multiple entries for the same language, as reported by @byteprelude in #19.
  • Loading branch information
homu committed Dec 28, 2015
2 parents 1840551 + 1828538 commit 5a3d61d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/count/counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<'c> Counts<'c> {
let mut found = false;
debugln!("Searching for previous entries of that type");
for l in self.counts.iter_mut() {
if l.lang.extension() == extension {
if l.lang == pos_lang {
debugln!("Found");
found = true;
l.add_file(PathBuf::from(&file));
Expand Down
23 changes: 1 addition & 22 deletions src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt as StdFmt;

use comment::Comment;

#[derive(Debug)]
#[derive(Debug, Eq, PartialEq)]
pub enum Language {
C,
Header,
Expand Down Expand Up @@ -73,27 +73,6 @@ impl Language {
}
}

pub fn extension(&self) -> &str {
match *self {
Language::Cpp => "cpp",
Language::Hpp => "hpp",
Language::C => "c",
Language::Header => "h",
Language::Css => "css",
Language::Java => "java",
Language::JavaScript => "js",
Language::Rust => "rs",
Language::Xml => "xml",
Language::Html => "html",
Language::Python => "py",
Language::Ruby => "rb",
Language::Php => "php",
Language::Perl => "pl",
Language::Toml => "toml",
Language::Go => "go",
}
}

pub fn is_unsafe(&self) -> bool {
match *self {
Language::C |
Expand Down

0 comments on commit 5a3d61d

Please sign in to comment.