Skip to content

Commit 81f0cab

Browse files
committed
style: fix clippy warnings.
1 parent af18dbc commit 81f0cab

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

cli/src/commands/check.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::{fs, io};
55
use anyhow::Context;
66
use clap::{arg, value_parser, ArgAction, ArgMatches, Command};
77
use crossterm::tty::IsTty;
8-
use regex;
98
use superconsole::{Component, Line, Lines, Span};
109
use yansi::Color::{Green, Red, Yellow};
1110
use yansi::Paint;
@@ -115,7 +114,7 @@ pub fn exec_check(args: &ArgMatches, config: &Config) -> anyhow::Result<()> {
115114
MetaValueType::String => {
116115
let message = if let Some(regexp) = &config.regexp {
117116
// Make sure that the regexp is valid.
118-
let _ = regex::bytes::Regex::new(&regexp)?;
117+
let _ = regex::bytes::Regex::new(regexp)?;
119118
format!("`{identifier}` must be a string that matches `/{regexp}/`")
120119
} else {
121120
format!("`{identifier}` must be a string")
@@ -124,10 +123,10 @@ pub fn exec_check(args: &ArgMatches, config: &Config) -> anyhow::Result<()> {
124123
|meta| {
125124
match (&meta.value, &config.regexp) {
126125
(MetaValue::String((s, _)), Some(regexp)) => {
127-
regex::Regex::new(&regexp).unwrap().is_match(s)
126+
regex::Regex::new(regexp).unwrap().is_match(s)
128127
}
129128
(MetaValue::Bytes((s, _)), Some(regexp)) => {
130-
regex::bytes::Regex::new(&regexp).unwrap().is_match(s)
129+
regex::bytes::Regex::new(regexp).unwrap().is_match(s)
131130
}
132131
(MetaValue::String(_), None) => true,
133132
(MetaValue::Bytes(_), None) => true,

lib/src/compiler/report.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ fn level_as_text(level: &Level) -> &'static str {
524524
Level::INFO => "info",
525525
Level::NOTE => "note",
526526
Level::HELP => "help",
527-
_ => panic!("unsupported level {:?}", level),
527+
_ => panic!("unsupported level {level:?}"),
528528
}
529529
}
530530

lib/src/modules/pe/parser.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,8 +1914,7 @@ impl<'a> PE<'a> {
19141914
if let Ok(rva) = TryInto::<u32>::try_into(thunk) {
19151915
func.name = self
19161916
.parse_at_rva(rva, Self::parse_import_by_name)
1917-
.and_then(|s| str::from_utf8(s).ok())
1918-
.map(|s| s.to_string());
1917+
.and_then(|s| String::from_utf8(s.to_vec()).ok())
19191918
}
19201919
}
19211920

0 commit comments

Comments
 (0)