mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-31 10:11:07 +00:00
Run 'cargo fmt'
This commit is contained in:
parent
81488adf8b
commit
8e18786556
3
build.rs
3
build.rs
@ -19,7 +19,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
// Read environment variables.
|
// Read environment variables.
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
|
static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
|
||||||
static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME);
|
static ref EXECUTABLE_NAME: &'static str =
|
||||||
|
option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates a file from a liquid template.
|
/// Generates a file from a liquid template.
|
||||||
|
@ -250,9 +250,7 @@ impl App {
|
|||||||
.map(|values| values.collect());
|
.map(|values| values.collect());
|
||||||
|
|
||||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||||
Some(ref filenames) => {
|
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||||
Box::new(filenames.iter().map(|name| Some(OsStr::new(*name))))
|
|
||||||
}
|
|
||||||
None => Box::new(std::iter::repeat(None)),
|
None => Box::new(std::iter::repeat(None)),
|
||||||
};
|
};
|
||||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||||
|
@ -53,5 +53,6 @@ pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HighlightingAssets::from_cache(&cache_dir).unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
Ok(HighlightingAssets::from_cache(&cache_dir)
|
||||||
|
.unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
|||||||
return Err(format!(
|
return Err(format!(
|
||||||
"Unable to write config file to: {}",
|
"Unable to write config file to: {}",
|
||||||
config_file.to_string_lossy()
|
config_file.to_string_lossy()
|
||||||
).into());
|
)
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,10 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String {
|
|||||||
fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> {
|
fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> {
|
||||||
let str_from_utf8 = |seq| std::str::from_utf8(seq).ok();
|
let str_from_utf8 = |seq| std::str::from_utf8(seq).ok();
|
||||||
|
|
||||||
let decoded = input.get(0..1).and_then(str_from_utf8).map(|c| (c, 1))
|
let decoded = input
|
||||||
|
.get(0..1)
|
||||||
|
.and_then(str_from_utf8)
|
||||||
|
.map(|c| (c, 1))
|
||||||
.or_else(|| input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2)))
|
.or_else(|| input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2)))
|
||||||
.or_else(|| input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3)))
|
.or_else(|| input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3)))
|
||||||
.or_else(|| input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));
|
.or_else(|| input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user