9741: minor: Replace useless types r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-07-31 12:30:09 +00:00 committed by GitHub
commit bcc3241c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -86,7 +86,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
target, target,
move |edit| { move |edit| {
let match_expr = { let match_expr = {
let else_arm = make_else_arm(else_block, &cond_bodies, ctx); let else_arm = make_else_arm(ctx, else_block, &cond_bodies);
let make_match_arm = |(pat, body): (_, ast::BlockExpr)| { let make_match_arm = |(pat, body): (_, ast::BlockExpr)| {
let body = body.reset_indent().indent(IndentLevel(1)); let body = body.reset_indent().indent(IndentLevel(1));
match pat { match pat {
@ -119,12 +119,12 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
} }
fn make_else_arm( fn make_else_arm(
else_block: Option<ast::BlockExpr>,
cond_bodies: &Vec<(Either<ast::Pat, ast::Expr>, ast::BlockExpr)>,
ctx: &AssistContext, ctx: &AssistContext,
else_block: Option<ast::BlockExpr>,
conditionals: &[(Either<ast::Pat, ast::Expr>, ast::BlockExpr)],
) -> ast::MatchArm { ) -> ast::MatchArm {
if let Some(else_block) = else_block { if let Some(else_block) = else_block {
let pattern = if let [(Either::Left(pat), _)] = &**cond_bodies { let pattern = if let [(Either::Left(pat), _)] = conditionals {
ctx.sema ctx.sema
.type_of_pat(&pat) .type_of_pat(&pat)
.and_then(|ty| TryEnum::from_ty(&ctx.sema, &ty)) .and_then(|ty| TryEnum::from_ty(&ctx.sema, &ty))

View file

@ -34,8 +34,8 @@ impl UsageSearchResult {
self.references.len() self.references.len()
} }
pub fn iter(&self) -> impl Iterator<Item = (&FileId, &Vec<FileReference>)> + '_ { pub fn iter(&self) -> impl Iterator<Item = (&FileId, &[FileReference])> + '_ {
self.references.iter() self.references.iter().map(|(file_id, refs)| (file_id, &**refs))
} }
pub fn file_ranges(&self) -> impl Iterator<Item = FileRange> + '_ { pub fn file_ranges(&self) -> impl Iterator<Item = FileRange> + '_ {

View file

@ -218,7 +218,7 @@ mod vec_token_tree {
use super::{TokenTree, TokenTreeDef}; use super::{TokenTree, TokenTreeDef};
use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer}; use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer};
pub(super) fn serialize<S>(value: &Vec<TokenTree>, serializer: S) -> Result<S::Ok, S::Error> pub(super) fn serialize<S>(value: &[TokenTree], serializer: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {