mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-10-04 06:49:07 +00:00
remove refs (#1006)
This commit is contained in:
parent
0f85cfe35e
commit
f08c87a969
|
@ -147,7 +147,7 @@ impl Cli {
|
|||
Arg::new("streaming")
|
||||
.long("streaming")
|
||||
.takes_value(true)
|
||||
.possible_values(&["simple", "json"])
|
||||
.possible_values(["simple", "json"])
|
||||
.ignore_case(true)
|
||||
.help(
|
||||
"prints the (language, path, lines, blanks, code, comments) records as \
|
||||
|
@ -159,7 +159,7 @@ impl Cli {
|
|||
.long("sort")
|
||||
.short('s')
|
||||
.takes_value(true)
|
||||
.possible_values(&["files", "lines", "blanks", "code", "comments"])
|
||||
.possible_values(["files", "lines", "blanks", "code", "comments"])
|
||||
.ignore_case(true)
|
||||
.conflicts_with("rsort")
|
||||
.help("Sort languages based on column"),
|
||||
|
@ -169,7 +169,7 @@ impl Cli {
|
|||
.long("rsort")
|
||||
.short('r')
|
||||
.takes_value(true)
|
||||
.possible_values(&["files", "lines", "blanks", "code", "comments"])
|
||||
.possible_values(["files", "lines", "blanks", "code", "comments"])
|
||||
.ignore_case(true)
|
||||
.conflicts_with("sort")
|
||||
.help("Reverse sort languages based on column"),
|
||||
|
|
|
@ -224,9 +224,9 @@ mod tests {
|
|||
for variant in Format::iter() {
|
||||
let serialized = variant
|
||||
.print(&langs)
|
||||
.expect(&format!("Failed serializing variant: {:?}", variant));
|
||||
.unwrap_or_else(|_| panic!("Failed serializing variant: {:?}", variant));
|
||||
let deserialized = Format::parse(&serialized)
|
||||
.expect(&format!("Failed deserializing variant: {:?}", variant));
|
||||
.unwrap_or_else(|| panic!("Failed deserializing variant: {:?}", variant));
|
||||
assert_eq!(*langs, deserialized);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ impl LanguageType {
|
|||
|
||||
let mut stats = Report::new(path);
|
||||
|
||||
stats += self.parse_from_slice(&text, config);
|
||||
stats += self.parse_from_slice(text, config);
|
||||
|
||||
Ok(stats)
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ impl SyntaxCounter {
|
|||
String::from_utf8_lossy(&lines[start_of_code..end_of_code])
|
||||
);
|
||||
let stats =
|
||||
language.parse_from_slice(&lines[start_of_code..end_of_code].trim(), config);
|
||||
language.parse_from_slice(lines[start_of_code..end_of_code].trim(), config);
|
||||
|
||||
Some(FileContext::new(
|
||||
LanguageContext::Markdown { balanced, language },
|
||||
|
@ -603,6 +603,7 @@ impl SyntaxCounter {
|
|||
|
||||
#[inline]
|
||||
pub(crate) fn parse_end_of_quote(&mut self, window: &[u8]) -> Option<usize> {
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
if self._is_string_mode() && window.starts_with(self.quote?.as_bytes()) {
|
||||
let quote = self.quote.take().unwrap();
|
||||
trace!("End {:?}", quote);
|
||||
|
|
|
@ -136,7 +136,7 @@ mod tests {
|
|||
language::{languages::Languages, LanguageType},
|
||||
};
|
||||
|
||||
const FILE_CONTENTS: &[u8] = &*b"fn main() {}";
|
||||
const FILE_CONTENTS: &[u8] = b"fn main() {}";
|
||||
const FILE_NAME: &str = "main.rs";
|
||||
const IGNORE_PATTERN: &str = "*.rs";
|
||||
const LANGUAGE: &LanguageType = &LanguageType::Rust;
|
||||
|
@ -147,7 +147,7 @@ mod tests {
|
|||
let tmp_dir = TempDir::new().expect("Couldn't create temp dir");
|
||||
let path_name = tmp_dir.path().join("directory.rs");
|
||||
|
||||
fs::create_dir(&path_name).expect("Couldn't create directory.rs within temp");
|
||||
fs::create_dir(path_name).expect("Couldn't create directory.rs within temp");
|
||||
|
||||
super::get_all_files(
|
||||
&[tmp_dir.into_path().to_str().unwrap()],
|
||||
|
|
Loading…
Reference in a new issue