Skip to content

Commit 7c7c454

Browse files
committed
Replace useless types
1 parent 0cf28ce commit 7c7c454

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

crates/ide_assists/src/handlers/replace_if_let_with_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
8686
target,
8787
move |edit| {
8888
let match_expr = {
89-
let else_arm = make_else_arm(else_block, &cond_bodies, ctx);
89+
let else_arm = make_else_arm(ctx, else_block, &cond_bodies);
9090
let make_match_arm = |(pat, body): (_, ast::BlockExpr)| {
9191
let body = body.reset_indent().indent(IndentLevel(1));
9292
match pat {
@@ -119,12 +119,12 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext)
119119
}
120120

121121
fn make_else_arm(
122-
else_block: Option<ast::BlockExpr>,
123-
cond_bodies: &Vec<(Either<ast::Pat, ast::Expr>, ast::BlockExpr)>,
124122
ctx: &AssistContext,
123+
else_block: Option<ast::BlockExpr>,
124+
conditionals: &[(Either<ast::Pat, ast::Expr>, ast::BlockExpr)],
125125
) -> ast::MatchArm {
126126
if let Some(else_block) = else_block {
127-
let pattern = if let [(Either::Left(pat), _)] = &**cond_bodies {
127+
let pattern = if let [(Either::Left(pat), _)] = conditionals {
128128
ctx.sema
129129
.type_of_pat(&pat)
130130
.and_then(|ty| TryEnum::from_ty(&ctx.sema, &ty))

crates/ide_db/src/search.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ impl UsageSearchResult {
3434
self.references.len()
3535
}
3636

37-
pub fn iter(&self) -> impl Iterator<Item = (&FileId, &Vec<FileReference>)> + '_ {
38-
self.references.iter()
37+
pub fn iter(&self) -> impl Iterator<Item = (&FileId, &[FileReference])> + '_ {
38+
self.references.iter().map(|(file_id, refs)| (file_id, &**refs))
3939
}
4040

4141
pub fn file_ranges(&self) -> impl Iterator<Item = FileRange> + '_ {

crates/proc_macro_api/src/rpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ mod vec_token_tree {
218218
use super::{TokenTree, TokenTreeDef};
219219
use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer};
220220

221-
pub(super) fn serialize<S>(value: &Vec<TokenTree>, serializer: S) -> Result<S::Ok, S::Error>
221+
pub(super) fn serialize<S>(value: &[TokenTree], serializer: S) -> Result<S::Ok, S::Error>
222222
where
223223
S: Serializer,
224224
{

0 commit comments

Comments
 (0)