Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/generate_documentation_template.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/generate_documentation_template.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ide-assists/src/handlers/generate_documentation_template.rs b/crates/ide-assists/src/handlers/generate_documentation_template.rs index d22d8c831f..c91141f8eb 100644 --- a/crates/ide-assists/src/handlers/generate_documentation_template.rs +++ b/crates/ide-assists/src/handlers/generate_documentation_template.rs @@ -42,7 +42,7 @@ use crate::assist_context::{AssistContext, Assists}; // ``` pub(crate) fn generate_documentation_template( acc: &mut Assists, - ctx: &AssistContext, + ctx: &AssistContext<'_>, ) -> Option<()> { let name = ctx.find_node_at_offset::<ast::Name>()?; let ast_func = name.syntax().parent().and_then(ast::Fn::cast)?; @@ -94,7 +94,7 @@ pub(crate) fn generate_documentation_template( // /// ``` // pub fn add(a: i32, b: i32) -> i32 { a + b } // ``` -pub(crate) fn generate_doc_example(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { +pub(crate) fn generate_doc_example(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> { let tok: ast::Comment = ctx.find_token_at_offset()?; let node = tok.syntax().parent()?; let last_doc_token = @@ -126,7 +126,7 @@ pub(crate) fn generate_doc_example(acc: &mut Assists, ctx: &AssistContext) -> Op ) } -fn make_example_for_fn(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<String> { +fn make_example_for_fn(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> Option<String> { if !is_public(ast_func, ctx)? { // Doctests for private items can't actually name the item, so they're pretty useless. return None; @@ -176,7 +176,7 @@ fn make_example_for_fn(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<String Some(example) } -fn introduction_builder(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<String> { +fn introduction_builder(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> Option<String> { let hir_func = ctx.sema.to_def(ast_func)?; let container = hir_func.as_assoc_item(ctx.db())?.container(ctx.db()); if let hir::AssocItemContainer::Impl(imp) = container { @@ -270,7 +270,7 @@ fn safety_builder(ast_func: &ast::Fn) -> Option<Vec<String>> { } /// Checks if the function is public / exported -fn is_public(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<bool> { +fn is_public(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> Option<bool> { let hir_func = ctx.sema.to_def(ast_func)?; Some( hir_func.visibility(ctx.db()) == Visibility::Public @@ -279,7 +279,7 @@ fn is_public(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<bool> { } /// Checks that all parent modules of the function are public / exported -fn all_parent_mods_public(hir_func: &hir::Function, ctx: &AssistContext) -> bool { +fn all_parent_mods_public(hir_func: &hir::Function, ctx: &AssistContext<'_>) -> bool { let mut module = hir_func.module(ctx.db()); loop { if let Some(parent) = module.parent(ctx.db()) { @@ -294,7 +294,7 @@ fn all_parent_mods_public(hir_func: &hir::Function, ctx: &AssistContext) -> bool } /// Returns the name of the current crate -fn crate_name(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<String> { +fn crate_name(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> Option<String> { let krate = ctx.sema.scope(ast_func.syntax())?.krate(); Some(krate.display_name(ctx.db())?.to_string()) } @@ -351,7 +351,7 @@ fn self_partial_type(ast_func: &ast::Fn) -> Option<String> { } /// Helper function to determine if the function is in a trait implementation -fn is_in_trait_impl(ast_func: &ast::Fn, ctx: &AssistContext) -> bool { +fn is_in_trait_impl(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> bool { ctx.sema .to_def(ast_func) .and_then(|hir_func| hir_func.as_assoc_item(ctx.db())) @@ -360,7 +360,7 @@ fn is_in_trait_impl(ast_func: &ast::Fn, ctx: &AssistContext) -> bool { } /// Helper function to determine if the function definition is in a trait definition -fn is_in_trait_def(ast_func: &ast::Fn, ctx: &AssistContext) -> bool { +fn is_in_trait_def(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> bool { ctx.sema .to_def(ast_func) .and_then(|hir_func| hir_func.as_assoc_item(ctx.db())) @@ -462,7 +462,7 @@ fn string_vec_from(string_array: &[&str]) -> Vec<String> { } /// Helper function to build the path of the module in the which is the node -fn build_path(ast_func: &ast::Fn, ctx: &AssistContext) -> Option<String> { +fn build_path(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> Option<String> { let crate_name = crate_name(ast_func, ctx)?; let leaf = self_partial_type(ast_func) .or_else(|| ast_func.name().map(|n| n.to_string())) @@ -480,7 +480,7 @@ fn return_type(ast_func: &ast::Fn) -> Option<ast::Type> { } /// Helper function to determine if the function returns some data -fn returns_a_value(ast_func: &ast::Fn, ctx: &AssistContext) -> bool { +fn returns_a_value(ast_func: &ast::Fn, ctx: &AssistContext<'_>) -> bool { ctx.sema .to_def(ast_func) .map(|hir_func| hir_func.ret_type(ctx.db())) |