fix: make rustfmt happy

This commit is contained in:
Aloxaf 2022-10-13 14:49:33 +08:00
parent 8aa690ab25
commit 6a3f037ae2
3 changed files with 4 additions and 8 deletions

View File

@ -4,7 +4,7 @@ use crate::directories::PROJECT_DIRS;
use anyhow::Result;
use syntect::dumps;
use syntect::highlighting::ThemeSet;
use syntect::parsing::{SyntaxSet};
use syntect::parsing::SyntaxSet;
const DEFAULT_SYNTAXSET: &'static [u8] = include_bytes!("../assets/syntaxes.bin");
const DEFAULT_THEMESET: &'static [u8] = include_bytes!("../assets/themes.bin");
@ -32,11 +32,8 @@ impl HighlightingAssets {
pub fn add_from_folder<P: AsRef<Path>>(&mut self, path: P) -> Result<()> {
let path = path.as_ref();
self.theme_set
.add_from_folder(path.join("themes"))?;
let mut builder = self.syntax_set
.clone()
.into_builder();
self.theme_set.add_from_folder(path.join("themes"))?;
let mut builder = self.syntax_set.clone().into_builder();
builder.add_from_folder(path.join("syntaxes"), true)?;
self.syntax_set = builder.build();
Ok(())

View File

@ -201,7 +201,6 @@ pub struct Config {
// Draw a custom text on the bottom right corner
// #[structopt(long)]
// watermark: Option<String>,
/// build syntax definition and theme cache
#[structopt(long)]
pub build_cache: Option<PathBuf>,

View File

@ -88,7 +88,7 @@ fn run() -> Result<(), Error> {
let mut ha = HighlightingAssets::new();
ha.add_from_folder(path)?;
ha.dump_to_file()?;
return Ok(())
return Ok(());
} else if config.list_themes {
for i in ts.themes.keys() {
println!("{}", i);