]> git.lizzy.rs Git - rust.git/commitdiff
avoid converting types into themselves via .into() (clippy::useless-conversion)
authorMatthias Krüger <matthias.krueger@famsik.de>
Wed, 17 Mar 2021 00:27:56 +0000 (01:27 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Wed, 17 Mar 2021 00:27:56 +0000 (01:27 +0100)
example: let x: String = String::from("hello world").into();

24 files changed:
crates/base_db/src/fixture.rs
crates/hir/src/attrs.rs
crates/hir/src/lib.rs
crates/hir/src/semantics.rs
crates/hir/src/source_analyzer.rs
crates/hir_def/src/attr.rs
crates/hir_ty/src/diagnostics/decl_check.rs
crates/hir_ty/src/diagnostics/expr.rs
crates/hir_ty/src/diagnostics/unsafe_check.rs
crates/hir_ty/src/traits/chalk/mapping.rs
crates/ide/src/diagnostics/fixes.rs
crates/ide_completion/src/completions.rs
crates/ide_completion/src/completions/postfix/format_like.rs
crates/ide_db/src/defs.rs
crates/ide_db/src/helpers/insert_use.rs
crates/mbe/src/benchmark.rs
crates/mbe/src/expander/matcher.rs
crates/mbe/src/syntax_bridge.rs
crates/mbe/src/tests.rs
crates/proc_macro_api/src/rpc.rs
crates/rust-analyzer/src/lsp_utils.rs
crates/rust-analyzer/src/to_proto.rs
crates/syntax/src/ast/edit.rs
crates/syntax/src/ted.rs

index cad6866aa3bacad6232e4cef965647beca4a10b2..8d4641355723a65d036532745d2cb207d6a010c1 100644 (file)
@@ -197,7 +197,7 @@ pub fn parse(ra_fixture: &str) -> ChangeFixture {
 
             change.change_file(file_id, Some(Arc::new(text)));
             let path = VfsPath::new_virtual_path(meta.path);
-            file_set.insert(file_id, path.into());
+            file_set.insert(file_id, path);
             files.push(file_id);
             file_id.0 += 1;
         }
index 9e6a3e15596ddb670f52736d3f8066c2333f3687..b9c6959214f8562c9d41ce02f0944e4348d83690 100644 (file)
@@ -124,5 +124,5 @@ fn resolve_doc_path(
         Some(Namespace::Macros) => return None,
         None => resolved.iter_items().find_map(|it| it.as_module_def_id())?,
     };
-    Some(def.into())
+    Some(def)
 }
index 12dd5fb383db5636e471339da3bae15416021b3c..861b7329ef32a7a4384e7a63a5158815e6feced8 100644 (file)
@@ -1335,7 +1335,7 @@ pub fn is_param(self, db: &dyn HirDatabase) -> bool {
 
     // FIXME: why is this an option? It shouldn't be?
     pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
-        let body = db.body(self.parent.into());
+        let body = db.body(self.parent);
         match &body[self.pat_id] {
             Pat::Bind { name, .. } => Some(name.clone()),
             _ => None,
@@ -1347,7 +1347,7 @@ pub fn is_self(self, db: &dyn HirDatabase) -> bool {
     }
 
     pub fn is_mut(self, db: &dyn HirDatabase) -> bool {
-        let body = db.body(self.parent.into());
+        let body = db.body(self.parent);
         matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. })
     }
 
@@ -1360,7 +1360,7 @@ pub fn module(self, db: &dyn HirDatabase) -> Module {
     }
 
     pub fn ty(self, db: &dyn HirDatabase) -> Type {
-        let def = DefWithBodyId::from(self.parent);
+        let def = self.parent;
         let infer = db.infer(def);
         let ty = infer[self.pat_id].clone();
         let krate = def.module(db.upcast()).krate();
@@ -1368,7 +1368,7 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type {
     }
 
     pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> {
-        let (_body, source_map) = db.body_with_source_map(self.parent.into());
+        let (_body, source_map) = db.body_with_source_map(self.parent);
         let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
         let root = src.file_syntax(db.upcast());
         src.map(|ast| {
@@ -1393,12 +1393,12 @@ pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody {
     }
 
     pub fn name(self, db: &dyn HirDatabase) -> Name {
-        let body = db.body(self.parent.into());
+        let body = db.body(self.parent);
         body[self.label_id].name.clone()
     }
 
     pub fn source(self, db: &dyn HirDatabase) -> InFile<ast::Label> {
-        let (_body, source_map) = db.body_with_source_map(self.parent.into());
+        let (_body, source_map) = db.body_with_source_map(self.parent);
         let src = source_map.label_syntax(self.label_id);
         let root = src.file_syntax(db.upcast());
         src.map(|ast| ast.to_node(&root))
index 03c9371b5ed5f1f9844c74d5eed9c121354258b6..00b076175ee061fa78a3eda8c1553a63b874e984 100644 (file)
@@ -835,7 +835,7 @@ pub fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef)) {
                 resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()),
                 resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(id.into()),
                 resolver::ScopeDef::Local(pat_id) => {
-                    let parent = resolver.body_owner().unwrap().into();
+                    let parent = resolver.body_owner().unwrap();
                     ScopeDef::Local(Local { parent, pat_id })
                 }
             };
index 117f32a9e197d4ac05852d2f75ef45d8ed0a427b..37d162b328a04b392d319884c5d7db5a522b1d0a 100644 (file)
@@ -484,7 +484,7 @@ fn resolve_hir_path_(
         resolver.resolve_path_in_value_ns_fully(db.upcast(), path.mod_path()).and_then(|val| {
             let res = match val {
                 ValueNs::LocalBinding(pat_id) => {
-                    let var = Local { parent: body_owner?.into(), pat_id };
+                    let var = Local { parent: body_owner?, pat_id };
                     PathResolution::Local(var)
                 }
                 ValueNs::FunctionId(it) => PathResolution::Def(Function::from(it).into()),
index 7b41b148c8b140a152a875ecef1828ed23bed1ae..b0b4b505214240c1d9ea7fed9f8f550d86e96bdc 100644 (file)
@@ -325,7 +325,7 @@ pub fn docs(&self) -> Option<Documentation> {
         if docs.is_empty() {
             None
         } else {
-            Some(Documentation(docs.into()))
+            Some(Documentation(docs))
         }
     }
 }
index 982ad5b9e0041982dd26748b4f76a2304b9267c4..bfe239793c6598a97f0b847c266c450051e65125 100644 (file)
@@ -203,7 +203,7 @@ fn create_incorrect_case_diagnostic_for_func(
             let diagnostic = IncorrectCase {
                 file: fn_src.file_id,
                 ident_type: IdentType::Function,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: replacement.expected_case,
                 ident_text: replacement.current_name.to_string(),
                 suggested_text: replacement.suggested_text,
@@ -261,7 +261,7 @@ fn create_incorrect_case_diagnostic_for_func(
             let diagnostic = IncorrectCase {
                 file: fn_src.file_id,
                 ident_type: IdentType::Argument,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: param_to_rename.expected_case,
                 ident_text: param_to_rename.current_name.to_string(),
                 suggested_text: param_to_rename.suggested_text,
@@ -313,7 +313,7 @@ fn create_incorrect_case_diagnostic_for_variables(
                         let diagnostic = IncorrectCase {
                             file: source_ptr.file_id,
                             ident_type: IdentType::Variable,
-                            ident: AstPtr::new(&name_ast).into(),
+                            ident: AstPtr::new(&name_ast),
                             expected_case: replacement.expected_case,
                             ident_text: replacement.current_name.to_string(),
                             suggested_text: replacement.suggested_text,
@@ -403,7 +403,7 @@ fn create_incorrect_case_diagnostic_for_struct(
             let diagnostic = IncorrectCase {
                 file: struct_src.file_id,
                 ident_type: IdentType::Structure,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: replacement.expected_case,
                 ident_text: replacement.current_name.to_string(),
                 suggested_text: replacement.suggested_text,
@@ -448,7 +448,7 @@ fn create_incorrect_case_diagnostic_for_struct(
             let diagnostic = IncorrectCase {
                 file: struct_src.file_id,
                 ident_type: IdentType::Field,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: field_to_rename.expected_case,
                 ident_text: field_to_rename.current_name.to_string(),
                 suggested_text: field_to_rename.suggested_text,
@@ -527,7 +527,7 @@ fn create_incorrect_case_diagnostic_for_enum(
             let diagnostic = IncorrectCase {
                 file: enum_src.file_id,
                 ident_type: IdentType::Enum,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: replacement.expected_case,
                 ident_text: replacement.current_name.to_string(),
                 suggested_text: replacement.suggested_text,
@@ -572,7 +572,7 @@ fn create_incorrect_case_diagnostic_for_enum(
             let diagnostic = IncorrectCase {
                 file: enum_src.file_id,
                 ident_type: IdentType::Variant,
-                ident: AstPtr::new(&ast_ptr).into(),
+                ident: AstPtr::new(&ast_ptr),
                 expected_case: variant_to_rename.expected_case,
                 ident_text: variant_to_rename.current_name.to_string(),
                 suggested_text: variant_to_rename.suggested_text,
@@ -617,7 +617,7 @@ fn validate_const(&mut self, const_id: ConstId) {
         let diagnostic = IncorrectCase {
             file: const_src.file_id,
             ident_type: IdentType::Constant,
-            ident: AstPtr::new(&ast_ptr).into(),
+            ident: AstPtr::new(&ast_ptr),
             expected_case: replacement.expected_case,
             ident_text: replacement.current_name.to_string(),
             suggested_text: replacement.suggested_text,
@@ -665,7 +665,7 @@ fn validate_static(&mut self, static_id: StaticId) {
         let diagnostic = IncorrectCase {
             file: static_src.file_id,
             ident_type: IdentType::StaticVariable,
-            ident: AstPtr::new(&ast_ptr).into(),
+            ident: AstPtr::new(&ast_ptr),
             expected_case: replacement.expected_case,
             ident_text: replacement.current_name.to_string(),
             suggested_text: replacement.suggested_text,
index b2bfd68d4e5c2ea833b492f7819570c6b0b8f7a6..71b2cade0881b71c4c81251ef5cb220c7afdb1ce 100644 (file)
@@ -44,7 +44,7 @@ pub(super) fn new(
     pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) {
         self.check_for_filter_map_next(db);
 
-        let body = db.body(self.owner.into());
+        let body = db.body(self.owner);
 
         for (id, expr) in body.exprs.iter() {
             if let Some((variant_def, missed_fields, true)) =
@@ -98,7 +98,7 @@ fn create_record_literal_missing_fields_diagnostic(
         missed_fields: Vec<LocalFieldId>,
     ) {
         // XXX: only look at source_map if we do have missing fields
-        let (_, source_map) = db.body_with_source_map(self.owner.into());
+        let (_, source_map) = db.body_with_source_map(self.owner);
 
         if let Ok(source_ptr) = source_map.expr_syntax(id) {
             let root = source_ptr.file_syntax(db.upcast());
@@ -128,7 +128,7 @@ fn create_record_pattern_missing_fields_diagnostic(
         missed_fields: Vec<LocalFieldId>,
     ) {
         // XXX: only look at source_map if we do have missing fields
-        let (_, source_map) = db.body_with_source_map(self.owner.into());
+        let (_, source_map) = db.body_with_source_map(self.owner);
 
         if let Ok(source_ptr) = source_map.pat_syntax(id) {
             if let Some(expr) = source_ptr.value.as_ref().left() {
@@ -175,7 +175,7 @@ fn check_for_filter_map_next(&mut self, db: &dyn HirDatabase) {
         };
 
         // Search function body for instances of .filter_map(..).next()
-        let body = db.body(self.owner.into());
+        let body = db.body(self.owner);
         let mut prev = None;
         for (id, expr) in body.exprs.iter() {
             if let Expr::MethodCall { receiver, .. } = expr {
@@ -192,7 +192,7 @@ fn check_for_filter_map_next(&mut self, db: &dyn HirDatabase) {
                 if function_id == *next_function_id {
                     if let Some(filter_map_id) = prev {
                         if *receiver == filter_map_id {
-                            let (_, source_map) = db.body_with_source_map(self.owner.into());
+                            let (_, source_map) = db.body_with_source_map(self.owner);
                             if let Ok(next_source_ptr) = source_map.expr_syntax(id) {
                                 self.sink.push(ReplaceFilterMapNextWithFindMap {
                                     file: next_source_ptr.file_id,
@@ -262,7 +262,7 @@ fn validate_call(&mut self, db: &dyn HirDatabase, call_id: ExprId, expr: &Expr)
         let mut arg_count = args.len();
 
         if arg_count != param_count {
-            let (_, source_map) = db.body_with_source_map(self.owner.into());
+            let (_, source_map) = db.body_with_source_map(self.owner);
             if let Ok(source_ptr) = source_map.expr_syntax(call_id) {
                 if is_method_call {
                     param_count -= 1;
@@ -287,7 +287,7 @@ fn validate_match(
         infer: Arc<InferenceResult>,
     ) {
         let (body, source_map): (Arc<Body>, Arc<BodySourceMap>) =
-            db.body_with_source_map(self.owner.into());
+            db.body_with_source_map(self.owner);
 
         let match_expr_ty = if infer.type_of_expr[match_expr].is_unknown() {
             return;
@@ -393,7 +393,7 @@ fn validate_results_in_tail_expr(&mut self, body_id: ExprId, id: ExprId, db: &dy
         };
 
         if params.len() > 0 && params[0] == mismatch.actual {
-            let (_, source_map) = db.body_with_source_map(self.owner.into());
+            let (_, source_map) = db.body_with_source_map(self.owner);
 
             if let Ok(source_ptr) = source_map.expr_syntax(id) {
                 self.sink.push(MissingOkOrSomeInTailExpr {
@@ -425,7 +425,7 @@ fn validate_missing_tail_expr(
             return;
         }
 
-        let (_, source_map) = db.body_with_source_map(self.owner.into());
+        let (_, source_map) = db.body_with_source_map(self.owner);
 
         if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) {
             self.sink
index 44a7e550647debda53baf7599ade10f8446772f3..1f49a49096eda96aa3821507e8767e85da4dab94 100644 (file)
@@ -29,7 +29,7 @@ pub(super) fn new(
     }
 
     pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) {
-        let def = self.owner.into();
+        let def = self.owner;
         let unsafe_expressions = unsafe_expressions(db, self.infer.as_ref(), def);
         let is_unsafe = match self.owner {
             DefWithBodyId::FunctionId(it) => db.function_data(it).qualifier.is_unsafe,
index 524814f4331462798c14d983e13affefd495e450..d969527dc90c2c08d04edb0aa63cac5d4876f89f 100644 (file)
@@ -52,7 +52,7 @@ fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Ty<Interner> {
 
             TyKind::Tuple(cardinality, substs) => {
                 let substitution = substs.to_chalk(db);
-                chalk_ir::TyKind::Tuple(cardinality.into(), substitution).intern(&Interner)
+                chalk_ir::TyKind::Tuple(cardinality, substitution).intern(&Interner)
             }
             TyKind::Raw(mutability, ty) => {
                 let ty = ty.to_chalk(db);
index cbfc66ab3c0fa1bb34d10c55fef1598ead5edbb3..2f840909c1c53dfe87960e2ae39500ef0067d7a5 100644 (file)
@@ -180,7 +180,7 @@ fn missing_record_expr_field_fix(
     let def_id = sema.resolve_variant(record_lit)?;
     let module;
     let def_file_id;
-    let record_fields = match VariantDef::from(def_id) {
+    let record_fields = match def_id {
         VariantDef::Struct(s) => {
             module = s.module(sema.db);
             let source = s.source(sema.db)?;
index 3b582ed07a331fdad3b41b613d8e8c72d53636c3..09882c4f310edef56ab2bde5fddf615d68944351 100644 (file)
@@ -56,7 +56,7 @@ pub(crate) fn add_to(self, acc: &mut Completions) {
 
 impl Completions {
     pub(crate) fn add(&mut self, item: CompletionItem) {
-        self.buf.push(item.into())
+        self.buf.push(item)
     }
 
     pub(crate) fn add_all<I>(&mut self, items: I)
index cee4eec108be0b8e3a656e21325528df1afbc966..3f1c6730b4642f940bb00997babfb2ebebbe4217 100644 (file)
@@ -89,7 +89,7 @@ enum State {
 impl FormatStrParser {
     pub(crate) fn new(input: String) -> Self {
         Self {
-            input: input.into(),
+            input: input,
             output: String::new(),
             extracted_expressions: Vec::new(),
             state: State::NotExpr,
index f86e5ce93ac1575d19c092fdce6d8ac62adc3f35..75167ff3942b6b444b4431d1eda35848a8c8a3d7 100644 (file)
@@ -181,7 +181,7 @@ pub fn classify(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<Name
                 },
                 ast::SelfParam(it) => {
                     let def = sema.to_def(&it)?;
-                    Some(NameClass::Definition(Definition::Local(def.into())))
+                    Some(NameClass::Definition(Definition::Local(def)))
                 },
                 ast::RecordField(it) => {
                     let field: hir::Field = sema.to_def(&it)?;
index df66d8ea04d04b71b1d9695caf50da8b1712f4d3..9e0cb91c3fc2f98e385e20ca47b3ee36989dbd03 100644 (file)
@@ -80,7 +80,7 @@ fn insert_pos_after_last_inner_element(&self) -> (InsertPosition<SyntaxElement>,
             })
             .last()
             .map(|last_inner_element| {
-                (InsertPosition::After(last_inner_element.into()), AddBlankLine::BeforeTwice)
+                (InsertPosition::After(last_inner_element), AddBlankLine::BeforeTwice)
             })
             .unwrap_or_else(|| self.first_insert_pos())
     }
index 503ad135568b5067f943879303417993a1d1127f..bd8ea6452c19a978bca43b21d8ec89b528f1cb71 100644 (file)
@@ -120,7 +120,7 @@ fn collect_from_op(op: &Op, parent: &mut tt::Subtree, seed: &mut usize) {
                 Some("pat") => parent.token_trees.push(make_ident("foo")),
                 Some("path") => parent.token_trees.push(make_ident("foo")),
                 Some("literal") => parent.token_trees.push(make_literal("1")),
-                Some("expr") => parent.token_trees.push(make_ident("foo").into()),
+                Some("expr") => parent.token_trees.push(make_ident("foo")),
                 Some("lifetime") => {
                     parent.token_trees.push(make_punct('\''));
                     parent.token_trees.push(make_ident("a"));
@@ -157,17 +157,15 @@ fn collect_from_op(op: &Op, parent: &mut tt::Subtree, seed: &mut usize) {
                     if i + 1 != cnt {
                         if let Some(sep) = separator {
                             match sep {
-                                Separator::Literal(it) => parent
-                                    .token_trees
-                                    .push(tt::Leaf::Literal(it.clone().into()).into()),
-                                Separator::Ident(it) => parent
-                                    .token_trees
-                                    .push(tt::Leaf::Ident(it.clone().into()).into()),
+                                Separator::Literal(it) => {
+                                    parent.token_trees.push(tt::Leaf::Literal(it.clone()).into())
+                                }
+                                Separator::Ident(it) => {
+                                    parent.token_trees.push(tt::Leaf::Ident(it.clone()).into())
+                                }
                                 Separator::Puncts(puncts) => {
                                     for it in puncts {
-                                        parent
-                                            .token_trees
-                                            .push(tt::Leaf::Punct(it.clone().into()).into())
+                                        parent.token_trees.push(tt::Leaf::Punct(it.clone()).into())
                                     }
                                 }
                             };
index 2c69e896850dc70743990e3f636e9574ca96c7dd..1bf7c2e81dc7e5a19f3dcf4fd9e11822f535a378 100644 (file)
@@ -722,7 +722,7 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen
                     input
                         .expect_literal()
                         .map(|literal| {
-                            let lit = tt::Leaf::from(literal.clone());
+                            let lit = literal.clone();
                             match neg {
                                 None => Some(lit.into()),
                                 Some(neg) => Some(tt::TokenTree::Subtree(tt::Subtree {
index b715ebfc4c9b39393df63299b72a9f79446ac838..85163c4b32b0df10b3916f8ee12029382cffeeca 100644 (file)
@@ -130,7 +130,7 @@ pub fn parse_exprs_with_sep(tt: &tt::Subtree, sep: char) -> Vec<tt::Subtree> {
         res.push(match expanded.value {
             None => break,
             Some(tt @ tt::TokenTree::Leaf(_)) => {
-                tt::Subtree { delimiter: None, token_trees: vec![tt.into()] }
+                tt::Subtree { delimiter: None, token_trees: vec![tt] }
             }
             Some(tt::TokenTree::Subtree(tt)) => tt,
         });
@@ -727,7 +727,7 @@ fn token(&mut self, kind: SyntaxKind, mut n_tokens: u8) {
             // Note: We always assume the semi-colon would be the last token in
             // other parts of RA such that we don't add whitespace here.
             if curr.spacing == tt::Spacing::Alone && curr.char != ';' {
-                self.inner.token(WHITESPACE, " ".into());
+                self.inner.token(WHITESPACE, " ");
                 self.text_pos += TextSize::of(' ');
             }
         }
index eca0bcc18b6212c172819e3828594c6252b2da4c..25c374b9b262e78d880fee751a858c354b9d1cfc 100644 (file)
@@ -35,7 +35,7 @@ fn check(macro_body: &str) {
     fn test_invalid_arms() {
         fn check(macro_body: &str, err: ParseError) {
             let m = parse_macro_arm(macro_body);
-            assert_eq!(m, Err(err.into()));
+            assert_eq!(m, Err(err));
         }
         check("invalid", ParseError::Expected("expected subtree".into()));
 
index 64cfdafc5140aa305eb0531fe4e0c99a2a39631b..9a68e2cc5139588a68f0b88b4b33ae579853e742 100644 (file)
@@ -236,13 +236,10 @@ fn fixture_token_tree() -> Subtree {
         subtree
             .token_trees
             .push(TokenTree::Leaf(Ident { text: "Foo".into(), id: TokenId(1) }.into()));
-        subtree.token_trees.push(TokenTree::Subtree(
-            Subtree {
-                delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }),
-                token_trees: vec![],
-            }
-            .into(),
-        ));
+        subtree.token_trees.push(TokenTree::Subtree(Subtree {
+            delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }),
+            token_trees: vec![],
+        }));
         subtree
     }
 
index 3ca7f80403e5efbe408525d04f48addbe8abb03a..2ac487632f792aa9598b677851117387c14d7448 100644 (file)
@@ -36,7 +36,7 @@ pub(crate) fn fraction(done: usize, total: usize) -> f64 {
 
 impl GlobalState {
     pub(crate) fn show_message(&mut self, typ: lsp_types::MessageType, message: String) {
-        let message = message.into();
+        let message = message;
         self.send_notification::<lsp_types::notification::ShowMessage>(
             lsp_types::ShowMessageParams { typ, message },
         )
index 70eaae5e8331000bc67b6fec73f85406c30d7997..c63fe2915e360705ced3c15d535fee36ca71ab99 100644 (file)
@@ -287,7 +287,7 @@ pub(crate) fn signature_help(
             let params = call_info
                 .parameter_ranges()
                 .iter()
-                .map(|it| [u32::from(it.start()).into(), u32::from(it.end()).into()])
+                .map(|it| [u32::from(it.start()), u32::from(it.end())])
                 .map(|label_offsets| lsp_types::ParameterInformation {
                     label: lsp_types::ParameterLabel::LabelOffsets(label_offsets),
                     documentation: None,
index 0b3b76d4a7daa149623e0041c1fe5b713da5c341..64fac13a73f83d2afeeda7cd4a737312db4e2219 100644 (file)
@@ -479,7 +479,7 @@ pub fn append_arm(&self, item: ast::MatchArm) -> ast::MatchArmList {
             Some(t) => t,
             None => return self.clone(),
         };
-        let position = InsertPosition::Before(r_curly.into());
+        let position = InsertPosition::Before(r_curly);
         let arm_ws = tokens::WsBuilder::new("    ");
         let match_indent = &leading_indent(self.syntax()).unwrap_or_default();
         let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent));
index 76f950ef9b62a0917ae86a39f179a94a300b56d6..442dfa14ae39ce5f6a92702494fc2f5a72cb3767 100644 (file)
@@ -122,5 +122,5 @@ fn ws_between(left: &SyntaxElement, right: &SyntaxElement) -> Option<SyntaxToken
     if right.kind() == T![;] || right.kind() == T![,] {
         return None;
     }
-    Some(make::tokens::single_space().into())
+    Some(make::tokens::single_space())
 }