Skip to content

Commit 511b59b

Browse files
fangyi-zhoufacebook-github-bot
authored andcommitted
Fix some clippy issues on main (#731)
Summary: Ran `cargo clippy --fix` and also applied fixes manually for preferring `matches!` macros Pull Request resolved: #731 Reviewed By: stroxler Differential Revision: D78774596 Pulled By: migeed-z fbshipit-source-id: ec4e1507423cd5725379664dcbe65e35044d1540
1 parent cac6690 commit 511b59b

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

crates/pyrefly_config/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub enum ConfigSource {
6767
}
6868

6969
impl ConfigSource {
70-
pub fn root<'a>(&'a self) -> Option<&'a Path> {
70+
pub fn root(&self) -> Option<&Path> {
7171
match &self {
7272
Self::File(path) | Self::Marker(path) => path.parent(),
7373
Self::Synthetic => None,
@@ -387,14 +387,14 @@ impl ConfigFile {
387387
self.python_environment.python_platform.as_ref().unwrap()
388388
}
389389

390-
pub fn search_path<'a>(&'a self) -> impl Iterator<Item = &'a PathBuf> + Clone {
390+
pub fn search_path(&self) -> impl Iterator<Item = &PathBuf> + Clone {
391391
self.search_path_from_args
392392
.iter()
393393
.chain(self.search_path_from_file.iter())
394394
.chain(self.import_root.iter())
395395
}
396396

397-
pub fn site_package_path<'a>(&'a self) -> impl Iterator<Item = &'a PathBuf> + Clone {
397+
pub fn site_package_path(&self) -> impl Iterator<Item = &PathBuf> + Clone {
398398
// we can use unwrap here, because the value in the root config must
399399
// be set in `ConfigFile::configure()`.
400400
self.python_environment

crates/pyrefly_config/src/migration/pyright.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ pub enum DiagnosticLevel {
119119

120120
impl DiagnosticLevel {
121121
fn to_bool(&self) -> bool {
122-
match self {
123-
Self::None => false,
124-
_ => true,
125-
}
122+
!matches!(self, Self::None)
126123
}
127124
}
128125

crates/pyrefly_config/src/util.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ impl<T> ConfigOrigin<T> {
142142
/// We only serialize if the value is `Some(ConfigFile)`. All other
143143
/// [`Option`] and [`ConfigOrigin`] variants are not serialized.
144144
pub(crate) fn should_skip_serializing_option(origin: &Option<Self>) -> bool {
145-
match origin {
146-
Some(Self::ConfigFile(_)) => false,
147-
_ => true,
148-
}
145+
!matches!(origin, Some(Self::ConfigFile(_)))
149146
}
150147
}
151148

pyrefly/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async fn main() -> ExitCode {
5858
Err(e) => {
5959
// If you return a Result from main, and RUST_BACKTRACE=1 is set, then
6060
// it will print a backtrace - which is not what we want.
61-
eprintln!("{:#}", e);
61+
eprintln!("{e:#}");
6262
ExitCode::FAILURE
6363
}
6464
}

0 commit comments

Comments
 (0)