src: cargo clippy and fmt the project
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
parent
3ed972e672
commit
689db9548a
5 changed files with 12 additions and 11 deletions
|
|
@ -1,11 +1,11 @@
|
|||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use std::path::Path;
|
||||
|
||||
use syntect::highlighting::ThemeSet;
|
||||
use syntect::html::highlighted_html_for_string;
|
||||
use syntect::parsing::SyntaxSet;
|
||||
|
||||
pub fn get_pretty_body(path: &PathBuf, ext: &String) -> String {
|
||||
pub fn get_pretty_body(path: &Path, ext: &str) -> String {
|
||||
let ss = SyntaxSet::load_defaults_newlines();
|
||||
|
||||
let mut theme_cursor =
|
||||
|
|
@ -16,7 +16,6 @@ pub fn get_pretty_body(path: &PathBuf, ext: &String) -> String {
|
|||
let syntax = ss
|
||||
.find_syntax_by_token(ext)
|
||||
.unwrap_or_else(|| ss.find_syntax_plain_text());
|
||||
let html = highlighted_html_for_string(&content, &ss, syntax, &theme);
|
||||
|
||||
html
|
||||
highlighted_html_for_string(&content, &ss, syntax, &theme)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct PasteIdSyntax<'a> {
|
|||
|
||||
fn valid_syn(syn: &str) -> bool {
|
||||
let mut flag = false;
|
||||
let split: Vec<&str> = syn.split(".").collect();
|
||||
let split: Vec<&str> = syn.split('.').collect();
|
||||
if split.len() == 2 {
|
||||
for s in split {
|
||||
if s.chars().all(char::is_alphanumeric) {
|
||||
|
|
@ -22,10 +22,10 @@ fn valid_syn(syn: &str) -> bool {
|
|||
|
||||
impl<'a> PasteIdSyntax<'a> {
|
||||
pub fn get_fname(&self) -> &str {
|
||||
&self.syn_id.split(".").collect::<Vec<&str>>()[0]
|
||||
self.syn_id.split('.').collect::<Vec<&str>>()[0]
|
||||
}
|
||||
pub fn get_ext(&self) -> &str {
|
||||
&self.syn_id.split(".").collect::<Vec<&str>>()[1]
|
||||
self.syn_id.split('.').collect::<Vec<&str>>()[1]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue