Skip to content

Commit 6cc6dee

Browse files
committed
clippy::useless_conversion
1 parent c9b4ac5 commit 6cc6dee

File tree

9 files changed

+16
-22
lines changed

9 files changed

+16
-22
lines changed

crates/hir_def/src/item_tree/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl<'a> Printer<'a> {
426426
w!(self, " {{");
427427
self.indented(|this| {
428428
for item in &**items {
429-
this.print_mod_item((*item).into());
429+
this.print_mod_item(*item);
430430
}
431431
});
432432
wln!(self, "}}");

crates/hir_def/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,7 @@ fn macro_call_as_call_id(
736736
db.upcast(),
737737
krate,
738738
MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
739-
)
740-
.into())
739+
))
741740
};
742741
Ok(res)
743742
}
@@ -765,8 +764,7 @@ fn derive_macro_as_call_id(
765764
derive_name: last_segment.to_string(),
766765
derive_attr_index: derive_attr.ast_index,
767766
},
768-
)
769-
.into();
767+
);
770768
Ok(res)
771769
}
772770

@@ -804,7 +802,6 @@ fn attr_macro_as_call_id(
804802
attr_args: arg,
805803
invoc_attr_index: macro_attr.id.ast_index,
806804
},
807-
)
808-
.into();
805+
);
809806
Ok(res)
810807
}

crates/hir_def/src/test_db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl TestDB {
325325
for diag in source_map.diagnostics() {
326326
let (ptr, message): (InFile<SyntaxNodePtr>, &str) = match diag {
327327
BodyDiagnostic::InactiveCode { node, .. } => {
328-
(node.clone().map(|it| it.into()), "InactiveCode")
328+
(node.clone().map(|it| it), "InactiveCode")
329329
}
330330
BodyDiagnostic::MacroError { node, message } => {
331331
(node.clone().map(|it| it.into()), message.as_str())

crates/hir_expand/src/builtin_derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ $0
325325
},
326326
};
327327

328-
let id: MacroCallId = db.intern_macro(loc).into();
328+
let id: MacroCallId = db.intern_macro(loc);
329329
let parsed = db.parse_or_expand(id.as_file()).unwrap();
330330

331331
// FIXME text() for syntax nodes parsed from token tree looks weird

crates/hir_expand/src/builtin_macro.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ fn include_expand(
430430
) -> ExpandResult<Option<ExpandedEager>> {
431431
let res = (|| {
432432
let path = parse_string(tt)?;
433-
let file_id = relative_file(db, arg_id.into(), &path, false)?;
433+
let file_id = relative_file(db, arg_id, &path, false)?;
434434

435435
let subtree = parse_to_token_tree(&db.file_text(file_id))
436436
.ok_or_else(|| mbe::ExpandError::ConversionError)?
@@ -480,7 +480,7 @@ fn include_str_expand(
480480
// it's unusual to `include_str!` a Rust file), but we can return an empty string.
481481
// Ideally, we'd be able to offer a precise expansion if the user asks for macro
482482
// expansion.
483-
let file_id = match relative_file(db, arg_id.into(), &path, true) {
483+
let file_id = match relative_file(db, arg_id, &path, true) {
484484
Ok(file_id) => file_id,
485485
Err(_) => {
486486
return ExpandResult::ok(Some(ExpandedEager::new(quote!(""))));
@@ -598,7 +598,7 @@ mod tests {
598598
},
599599
};
600600

601-
let id: MacroCallId = db.intern_macro(loc).into();
601+
let id: MacroCallId = db.intern_macro(loc);
602602
id.as_file()
603603
}
604604
Either::Right(expander) => {
@@ -635,7 +635,7 @@ mod tests {
635635
kind: MacroCallKind::FnLike { ast_id: call_id, fragment },
636636
};
637637

638-
let id: MacroCallId = db.intern_macro(loc).into();
638+
let id: MacroCallId = db.intern_macro(loc);
639639
id.as_file()
640640
}
641641
};

crates/hir_expand/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl TokenExpander {
5757
// We store the result in salsa db to prevent non-deterministic behavior in
5858
// some proc-macro implementation
5959
// See #4315 for details
60-
db.expand_proc_macro(id.into()).into()
60+
db.expand_proc_macro(id).into()
6161
}
6262
}
6363
}

crates/hir_expand/src/eager.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub fn expand_eager_macro(
128128
}),
129129
kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr },
130130
});
131-
let arg_file_id: MacroCallId = arg_id.into();
131+
let arg_file_id: MacroCallId = arg_id;
132132

133133
let parsed_args =
134134
diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0;
@@ -182,8 +182,7 @@ fn lazy_expand(
182182
db,
183183
krate,
184184
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
185-
)
186-
.into();
185+
);
187186

188187
let err = db.macro_expand_error(id);
189188
let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node));
@@ -216,8 +215,7 @@ fn eager_macro_recur(
216215
def,
217216
macro_resolver,
218217
diagnostic_sink,
219-
)?
220-
.into();
218+
)?;
221219
db.parse_or_expand(id.as_file())
222220
.expect("successful macro expansion should be parseable")
223221
.clone_for_update()

crates/hir_ty/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<T: HasInterner<Interner = Interner> + Fold<Interner>> TyBuilder<Binders<T>>
202202

203203
impl TyBuilder<Binders<Ty>> {
204204
pub fn def_ty(db: &dyn HirDatabase, def: TyDefId) -> TyBuilder<Binders<Ty>> {
205-
TyBuilder::subst_binders(db.ty(def.into()))
205+
TyBuilder::subst_binders(db.ty(def))
206206
}
207207

208208
pub fn impl_self_ty(db: &dyn HirDatabase, def: hir_def::ImplId) -> TyBuilder<Binders<Ty>> {

xtask/src/codegen/gen_lint_completions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
140140
.expect("should be prefixed by what it does")
141141
.strip_suffix(suffix_to_strip)
142142
.map(unescape)
143-
.expect("should be suffixed by comma")
144-
.into();
143+
.expect("should be suffixed by comma");
145144
}
146145
}
147146
clippy_lints.sort_by(|lint, lint2| lint.id.cmp(&lint2.id));

0 commit comments

Comments
 (0)