mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 21:25:25 +00:00
Observe unsafeness only for replace_derive_with_manual_impl
This commit is contained in:
parent
477b987179
commit
824df43d2d
3 changed files with 6 additions and 34 deletions
|
|
@ -5,7 +5,7 @@ use syntax::{
|
|||
SyntaxKind::WHITESPACE,
|
||||
T,
|
||||
ast::{self, AstNode, HasName, make},
|
||||
ted,
|
||||
ted::{self, Position},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
@ -223,6 +223,10 @@ fn impl_def_from_trait(
|
|||
let first_assoc_item =
|
||||
add_trait_assoc_items_to_impl(sema, &trait_items, trait_, &impl_def, &target_scope);
|
||||
|
||||
if trait_.is_unsafe(sema.db) {
|
||||
ted::insert(Position::first_child_of(impl_def.syntax()), make::token(T![unsafe]));
|
||||
}
|
||||
|
||||
// Generate a default `impl` function body for the derived trait.
|
||||
if let ast::AssocItem::Fn(ref func) = first_assoc_item {
|
||||
let _ = gen_trait_fn_body(func, trait_path, adt, None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue