clean up to fix nightly clippy warnings and dedents (#3057)

This commit is contained in:
Jeong YunWon 2023-02-20 23:33:47 +09:00 committed by GitHub
parent 3ad257cfea
commit 35606d7b05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 207 additions and 218 deletions

View file

@ -78,16 +78,10 @@ impl<'a> Visitor<'a> for NewlineNormalizer {
let required_newlines = match self.trailer {
Trailer::FunctionDef | Trailer::ClassDef => self.depth.max_newlines(),
Trailer::Docstring if matches!(self.scope, Scope::Class) => 1,
Trailer::Import => {
if matches!(
stmt.node,
StmtKind::Import { .. } | StmtKind::ImportFrom { .. }
) {
0
} else {
1
}
}
Trailer::Import => usize::from(!matches!(
stmt.node,
StmtKind::Import { .. } | StmtKind::ImportFrom { .. }
)),
_ => 0,
};
let present_newlines = stmt