Skip to content

Commit

Permalink
Run cargo clippy --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Oct 16, 2023
1 parent fc76778 commit 92f736c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions client/src/bin/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ fn main() -> anyhow::Result<()> {
};

let client = reqwest::blocking::Client::new();
let template = match &opts.template {
Some(template) => Some(collect(&language, template)),
None => None,
};
let template = opts.template.as_ref().map(|template| collect(&language, template));
let body = client
.post(format!("{}/api/submit", ENV.public_url))
.json(&SubmitRequest {
Expand Down
4 changes: 2 additions & 2 deletions core/src/bin/compute_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn read_file_lines(s: &Path) -> anyhow::Result<Vec<String>> {
let mut file = File::open(s)?;
let mut s = String::new();
file.read_to_string(&mut s)?;
Ok(s.lines().map(|l| String::from(l)).collect::<Vec<String>>())
Ok(s.lines().map(String::from).collect::<Vec<String>>())
}

fn main() -> anyhow::Result<()> {
Expand Down Expand Up @@ -56,7 +56,7 @@ fn main() -> anyhow::Result<()> {
.iter()
.map(|l| l.as_str())
.collect::<Vec<&str>>(),
template_kind.as_ref().map(|v| v.as_slice()),
template_kind.as_deref(),
);

for is_left in [true, false] {
Expand Down
4 changes: 2 additions & 2 deletions core/src/lang/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn tokenize(path: &Path) -> anyhow::Result<Vec<Token>> {
return lang.tokenizer.tokenize(path);
}
}
return Err(anyhow!("Unsupported file extension: {:?}", path));
Err(anyhow!("Unsupported file extension: {:?}", path))
}

pub fn tokenize_str(content: &str, language: Language) -> anyhow::Result<Vec<Token>> {
Expand All @@ -90,5 +90,5 @@ pub fn tokenize_str(content: &str, language: Language) -> anyhow::Result<Vec<Tok
return lang.tokenizer.tokenize_str(content);
}
}
return Err(anyhow!("Unsupported language: {:?}", language));
Err(anyhow!("Unsupported language: {:?}", language))
}
2 changes: 1 addition & 1 deletion core/src/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub fn compute_matching_blocks_from_text(
&token_right,
&token_kind_right,
&lines_right,
template_kind.as_ref().map(|v| v.as_slice()),
template_kind.as_deref(),
);

let mut res = vec![];
Expand Down

0 comments on commit 92f736c

Please sign in to comment.