mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
chore: fmt + docs
This commit is contained in:
parent
218390b9fb
commit
4a36129c7a
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
|
|
||||||
// Assist: add_type_ascription
|
// Assist: add_type_ascription
|
||||||
//
|
//
|
||||||
// Adds `: _` before the assignment operator to prompt the user for a type
|
// Adds `: _` before the assignment operator to prompt the user for a type.
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// fn make<T>() -> T { todo!() }
|
// fn make<T>() -> T { todo!() }
|
||||||
|
@ -28,7 +28,7 @@ pub(crate) fn add_type_ascription(acc: &mut Assists, ctx: &AssistContext) -> Opt
|
||||||
let let_stmt = ctx.find_node_at_offset::<ast::LetStmt>()?;
|
let let_stmt = ctx.find_node_at_offset::<ast::LetStmt>()?;
|
||||||
if let_stmt.colon_token().is_some() {
|
if let_stmt.colon_token().is_some() {
|
||||||
mark::hit!(add_type_ascription_already_typed);
|
mark::hit!(add_type_ascription_already_typed);
|
||||||
return None
|
return None;
|
||||||
}
|
}
|
||||||
let type_pos = let_stmt.pat()?.syntax().last_token()?.text_range().end();
|
let type_pos = let_stmt.pat()?.syntax().last_token()?.text_range().end();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue