@@ -4,13 +4,9 @@ use base_db::{
44 CrateGraphBuilder , DependencyBuilder , LibraryRoots , LocalRoots , SourceDatabase , SourceRoot ,
55 all_crates,
66} ;
7- use hir:: {
8- ChangeWithProcMacros , HasAttrs , InFile , Semantics ,
9- db:: DefDatabase ,
10- } ;
7+ use hir:: { ChangeWithProcMacros , HasAttrs , InFile , Semantics , db:: DefDatabase } ;
118use ide_db:: {
12- FxHashMap ,
13- FilePosition , RootDatabase ,
9+ FilePosition , FxHashMap , RootDatabase ,
1410 defs:: Definition ,
1511 range_mapper:: RangeMapper ,
1612 rust_doc:: is_rust_fence,
@@ -19,18 +15,15 @@ use ide_db::{
1915use syntax:: {
2016 AstNode , AstToken ,
2117 SyntaxKind :: { ASSOC_ITEM_LIST , ITEM_LIST , SOURCE_FILE } ,
22- SyntaxNode , SyntaxToken , TextRange , TextSize ,
23- ast,
24- match_ast,
18+ SyntaxNode , SyntaxToken , TextRange , TextSize , ast, match_ast,
2519} ;
2620
2721use crate :: { CompletionConfig , CompletionItem } ;
2822
2923const RUSTDOC_FENCE_LENGTH : usize = 3 ;
3024const RUSTDOC_FENCES : [ & str ; 2 ] = [ "```" , "~~~" ] ;
3125const DOCTEST_WRAPPER_NAME : & str = "__ra_doctest_completion" ;
32- const DOCTEST_WRAPPER_PREFIX : & str =
33- "\n #[allow(dead_code)]\n fn __ra_doctest_completion() {\n " ;
26+ const DOCTEST_WRAPPER_PREFIX : & str = "\n #[allow(dead_code)]\n fn __ra_doctest_completion() {\n " ;
3427const DOCTEST_WRAPPER_SUFFIX : & str = "\n }\n " ;
3528
3629pub ( crate ) fn complete_doctest (
@@ -44,8 +37,9 @@ pub(crate) fn complete_doctest(
4437 let file = sema. parse ( editioned_file_id) . syntax ( ) . clone ( ) ;
4538 let token = file. token_at_offset ( position. offset ) . left_biased ( ) ?;
4639
47- let analysis =
48- hir:: attach_db_allow_change ( db, || DoctestCompletionAnalysis :: new ( & sema, position. file_id , token) ) ?;
40+ let analysis = hir:: attach_db_allow_change ( db, || {
41+ DoctestCompletionAnalysis :: new ( & sema, position. file_id , token)
42+ } ) ?;
4943 let doctest_offset = analysis. map_offset_down ( position. offset ) ?;
5044
5145 let completions = hir:: attach_db_allow_change ( & analysis. db , || {
0 commit comments