aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-12 14:08:20 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-12 14:08:20 +0000
commit74ecfc2729d2d0771304a4fed3afdfa2c2d99b43 (patch)
treeeacf6870c6fab537d787bc2764901028ce595f0a /crates
parenta36e310229f13d6959d6ce95c99b659700cefc9a (diff)
parent4fd361343449bcdf7af4642851dc5dbf772f1a68 (diff)
Merge #804
804: Fix some typos r=killercup a=killercup Cherry-picked and updated from my now-closed PR. All credit goes to [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker). Co-authored-by: Pascal Hertleif <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/lib.rs2
-rw-r--r--crates/ra_assists/src/remove_dbg.rs8
-rw-r--r--crates/ra_db/src/cancellation.rs2
-rw-r--r--crates/ra_hir/src/code_model_api.rs6
-rw-r--r--crates/ra_hir/src/expr/scope.rs2
-rw-r--r--crates/ra_hir/src/ids.rs16
-rw-r--r--crates/ra_hir/src/nameres.rs2
-rw-r--r--crates/ra_hir/src/nameres/lower.rs2
-rw-r--r--crates/ra_hir/src/path.rs2
-rw-r--r--crates/ra_ide_api/src/completion.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_fn_param.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs8
-rw-r--r--crates/ra_ide_api/src/hover.rs4
-rw-r--r--crates/ra_ide_api/src/impls.rs4
-rw-r--r--crates/ra_ide_api/src/lib.rs10
-rw-r--r--crates/ra_ide_api/src/mock_analysis.rs2
-rw-r--r--crates/ra_ide_api/src/references.rs6
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs12
-rw-r--r--crates/ra_mbe/src/lib.rs6
-rw-r--r--crates/ra_mbe/src/mbe_expander.rs2
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs2
-rw-r--r--crates/ra_vfs/src/io.rs4
-rw-r--r--crates/ra_vfs/src/lib.rs14
-rw-r--r--crates/test_utils/src/lib.rs4
-rw-r--r--crates/test_utils/src/marks.rs8
-rw-r--r--crates/thread_worker/src/lib.rs2
26 files changed, 69 insertions, 65 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index c607a5142..7bd9b5ae6 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -1,4 +1,4 @@
1//! `ra_assits` crate provides a bunch of code assists, aslo known as code 1//! `ra_assits` crate provides a bunch of code assists, also known as code
2//! actions (in LSP) or intentions (in IntelliJ). 2//! actions (in LSP) or intentions (in IntelliJ).
3//! 3//!
4//! An assist is a micro-refactoring, which is automatically activated in 4//! An assist is a micro-refactoring, which is automatically activated in
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs
index db260c6ca..2bed270a1 100644
--- a/crates/ra_assists/src/remove_dbg.rs
+++ b/crates/ra_assists/src/remove_dbg.rs
@@ -17,9 +17,9 @@ pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist>
17 17
18 let macro_range = macro_call.syntax().range(); 18 let macro_range = macro_call.syntax().range();
19 19
20 // If the cursor is inside the macrocall, we'll try to maintain 20 // If the cursor is inside the macro call, we'll try to maintain the cursor
21 // the cursor position by subtracting the length of dbg!( from the start 21 // position by subtracting the length of dbg!( from the start of the file
22 // of the filerange, otherwise we'll default to using the start of the macrocall 22 // range, otherwise we'll default to using the start of the macro call
23 let cursor_pos = { 23 let cursor_pos = {
24 let file_range = ctx.frange.range; 24 let file_range = ctx.frange.range;
25 25
@@ -61,7 +61,7 @@ fn is_valid_macrocall(macro_call: &ast::MacroCall, macro_name: &str) -> Option<b
61 let path = macro_call.path()?; 61 let path = macro_call.path()?;
62 let name_ref = path.segment()?.name_ref()?; 62 let name_ref = path.segment()?.name_ref()?;
63 63
64 // Make sure it is actually a dbg-macrocall, dbg followed by ! 64 // Make sure it is actually a dbg-macro call, dbg followed by !
65 let excl = path.syntax().next_sibling()?; 65 let excl = path.syntax().next_sibling()?;
66 66
67 if name_ref.text() != macro_name || excl.kind() != EXCL { 67 if name_ref.text() != macro_name || excl.kind() != EXCL {
diff --git a/crates/ra_db/src/cancellation.rs b/crates/ra_db/src/cancellation.rs
index 439080075..7420a1976 100644
--- a/crates/ra_db/src/cancellation.rs
+++ b/crates/ra_db/src/cancellation.rs
@@ -15,7 +15,7 @@
15//! any background processing (this bit is handled by salsa, see the 15//! any background processing (this bit is handled by salsa, see the
16//! `BaseDatabase::check_canceled` method). 16//! `BaseDatabase::check_canceled` method).
17 17
18/// An "error" signifing that the operation was canceled. 18/// An "error" signifying that the operation was canceled.
19#[derive(Clone, PartialEq, Eq, Hash)] 19#[derive(Clone, PartialEq, Eq, Hash)]
20pub struct Canceled { 20pub struct Canceled {
21 _private: (), 21 _private: (),
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 94a08aa63..2ac05c836 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -134,7 +134,7 @@ impl Module {
134 134
135 /// Topmost parent of this module. Every module has a `crate_root`, but some 135 /// Topmost parent of this module. Every module has a `crate_root`, but some
136 /// might be missing `krate`. This can happen if a module's file is not included 136 /// might be missing `krate`. This can happen if a module's file is not included
137 /// in the module tree of any target in Cargo.toml. 137 /// in the module tree of any target in `Cargo.toml`.
138 pub fn crate_root(&self, db: &impl PersistentHirDatabase) -> Module { 138 pub fn crate_root(&self, db: &impl PersistentHirDatabase) -> Module {
139 self.crate_root_impl(db) 139 self.crate_root_impl(db)
140 } 140 }
@@ -351,7 +351,7 @@ impl Enum {
351 db.type_for_def((*self).into()) 351 db.type_for_def((*self).into())
352 } 352 }
353 353
354 // TODO move to a more general type 354 // TODO: move to a more general type
355 /// Builds a resolver for type references inside this struct. 355 /// Builds a resolver for type references inside this struct.
356 pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { 356 pub fn resolver(&self, db: &impl HirDatabase) -> Resolver {
357 // take the outer scope... 357 // take the outer scope...
@@ -495,7 +495,7 @@ impl Function {
495 db.generic_params((*self).into()) 495 db.generic_params((*self).into())
496 } 496 }
497 497
498 // TODO move to a more general type for 'body-having' items 498 // TODO: move to a more general type for 'body-having' items
499 /// Builds a resolver for code inside this item. 499 /// Builds a resolver for code inside this item.
500 pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { 500 pub fn resolver(&self, db: &impl HirDatabase) -> Resolver {
501 // take the outer scope... 501 // take the outer scope...
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs
index 44d5c2429..bb8d50db8 100644
--- a/crates/ra_hir/src/expr/scope.rs
+++ b/crates/ra_hir/src/expr/scope.rs
@@ -84,7 +84,7 @@ impl ExprScopes {
84 fn add_bindings(&mut self, body: &Body, scope: ScopeId, pat: PatId) { 84 fn add_bindings(&mut self, body: &Body, scope: ScopeId, pat: PatId) {
85 match &body[pat] { 85 match &body[pat] {
86 Pat::Bind { name, .. } => { 86 Pat::Bind { name, .. } => {
87 // bind can have a subpattern, but it's actually not allowed 87 // bind can have a sub pattern, but it's actually not allowed
88 // to bind to things in there 88 // to bind to things in there
89 let entry = ScopeEntry { name: name.clone(), pat }; 89 let entry = ScopeEntry { name: name.clone(), pat };
90 self.scopes[scope].entries.push(entry) 90 self.scopes[scope].entries.push(entry)
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index d3fa7d266..8d81d5ebf 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -46,24 +46,24 @@ impl HirInterner {
46/// This module defines a bunch of ids we are using. The most important ones are 46/// This module defines a bunch of ids we are using. The most important ones are
47/// probably `HirFileId` and `DefId`. 47/// probably `HirFileId` and `DefId`.
48 48
49/// Input to the analyzer is a set of files, where each file is indentified by 49/// Input to the analyzer is a set of files, where each file is identified by
50/// `FileId` and contains source code. However, another source of source code in 50/// `FileId` and contains source code. However, another source of source code in
51/// Rust are macros: each macro can be thought of as producing a "temporary 51/// Rust are macros: each macro can be thought of as producing a "temporary
52/// file". To assign an id to such a file, we use the id of the macro call that 52/// file". To assign an id to such a file, we use the id of the macro call that
53/// produced the file. So, a `HirFileId` is either a `FileId` (source code 53/// produced the file. So, a `HirFileId` is either a `FileId` (source code
54/// written by user), or a `MacroCallId` (source code produced by macro). 54/// written by user), or a `MacroCallId` (source code produced by macro).
55/// 55///
56/// What is a `MacroCallId`? Simplifying, it's a `HirFileId` of a file containin 56/// What is a `MacroCallId`? Simplifying, it's a `HirFileId` of a file
57/// the call plus the offset of the macro call in the file. Note that this is a 57/// containing the call plus the offset of the macro call in the file. Note that
58/// recursive definition! However, the size_of of `HirFileId` is finite 58/// this is a recursive definition! However, the size_of of `HirFileId` is
59/// (because everything bottoms out at the real `FileId`) and small 59/// finite (because everything bottoms out at the real `FileId`) and small
60/// (`MacroCallId` uses the location interner). 60/// (`MacroCallId` uses the location interner).
61#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 61#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
62pub struct HirFileId(HirFileIdRepr); 62pub struct HirFileId(HirFileIdRepr);
63 63
64impl HirFileId { 64impl HirFileId {
65 /// For macro-expansion files, returns the file original source file the 65 /// For macro-expansion files, returns the file original source file the
66 /// expansionoriginated from. 66 /// expansion originated from.
67 pub fn original_file(self, db: &impl PersistentHirDatabase) -> FileId { 67 pub fn original_file(self, db: &impl PersistentHirDatabase) -> FileId {
68 match self.0 { 68 match self.0 {
69 HirFileIdRepr::File(file_id) => file_id, 69 HirFileIdRepr::File(file_id) => file_id,
@@ -324,9 +324,9 @@ impl SourceFileItems {
324 324
325 fn init(&mut self, source_file: &SourceFile) { 325 fn init(&mut self, source_file: &SourceFile) {
326 // By walking the tree in bread-first order we make sure that parents 326 // By walking the tree in bread-first order we make sure that parents
327 // get lower ids then children. That is, addding a new child does not 327 // get lower ids then children. That is, adding a new child does not
328 // change parent's id. This means that, say, adding a new function to a 328 // change parent's id. This means that, say, adding a new function to a
329 // trait does not chage ids of top-level items, which helps caching. 329 // trait does not change ids of top-level items, which helps caching.
330 bfs(source_file.syntax(), |it| { 330 bfs(source_file.syntax(), |it| {
331 if let Some(module_item) = ast::ModuleItem::cast(it) { 331 if let Some(module_item) = ast::ModuleItem::cast(it) {
332 self.alloc(module_item.syntax()); 332 self.alloc(module_item.syntax());
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 261ebdf97..ffb20d564 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -490,7 +490,7 @@ impl ItemMap {
490 None => { 490 None => {
491 // we still have path segments left, but the path so far 491 // we still have path segments left, but the path so far
492 // didn't resolve in the types namespace => no resolution 492 // didn't resolve in the types namespace => no resolution
493 // (don't break here because curr_per_ns might contain 493 // (don't break here because `curr_per_ns` might contain
494 // something in the value namespace, and it would be wrong 494 // something in the value namespace, and it would be wrong
495 // to return that) 495 // to return that)
496 return (PerNs::none(), ReachedFixedPoint::No); 496 return (PerNs::none(), ReachedFixedPoint::No);
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs
index 7e9a3de2b..3cd496d7f 100644
--- a/crates/ra_hir/src/nameres/lower.rs
+++ b/crates/ra_hir/src/nameres/lower.rs
@@ -208,7 +208,7 @@ impl LoweredModule {
208 } 208 }
209 } 209 }
210 ast::ModuleItemKind::Module(_) => { 210 ast::ModuleItemKind::Module(_) => {
211 // modules are handled separately direclty by nameres 211 // modules are handled separately directly by name res
212 } 212 }
213 }; 213 };
214 } 214 }
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 6a24c8aa7..8ed54607a 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -97,7 +97,7 @@ impl Path {
97 return Some(q); 97 return Some(q);
98 } 98 }
99 // TODO: this bottom up traversal is not too precise. 99 // TODO: this bottom up traversal is not too precise.
100 // Should we handle do a top-down analysiss, recording results? 100 // Should we handle do a top-down analysis, recording results?
101 let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?; 101 let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?;
102 let use_tree = use_tree_list.parent_use_tree(); 102 let use_tree = use_tree_list.parent_use_tree();
103 use_tree.path() 103 use_tree.path()
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index 83c243944..2b94931c6 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -30,7 +30,7 @@ pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind,
30/// incomplete and can look really weird. 30/// incomplete and can look really weird.
31/// 31///
32/// Once the context is collected, we run a series of completion routines which 32/// Once the context is collected, we run a series of completion routines which
33/// look at the context and produce completion items. One subtelty about this 33/// look at the context and produce completion items. One subtlety about this
34/// phase is that completion engine should not filter by the substring which is 34/// phase is that completion engine should not filter by the substring which is
35/// already present, it should give all possible variants for the identifier at 35/// already present, it should give all possible variants for the identifier at
36/// the caret. In other words, for 36/// the caret. In other words, for
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index 43532226f..4d6416284 100644
--- a/crates/ra_ide_api/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
@@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
7 7
8use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem}; 8use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem};
9 9
10/// Complete repeated parametes, both name and type. For example, if all 10/// Complete repeated parameters, both name and type. For example, if all
11/// functions in a file have a `spam: &mut Spam` parameter, a completion with 11/// functions in a file have a `spam: &mut Spam` parameter, a completion with
12/// `spam: &mut Spam` insert text/label and `spam` lookup string will be 12/// `spam: &mut Spam` insert text/label and `spam` lookup string will be
13/// suggested. 13/// suggested.
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 413720960..96ed8c8e9 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -93,10 +93,10 @@ pub(crate) fn reference_definition(
93 return Exact(nav); 93 return Exact(nav);
94 } 94 }
95 Some(Resolution::GenericParam(..)) => { 95 Some(Resolution::GenericParam(..)) => {
96 // TODO go to the generic param def 96 // TODO: go to the generic param def
97 } 97 }
98 Some(Resolution::SelfType(_impl_block)) => { 98 Some(Resolution::SelfType(_impl_block)) => {
99 // TODO go to the implemented type 99 // TODO: go to the implemented type
100 } 100 }
101 None => {} 101 None => {}
102 } 102 }
@@ -133,8 +133,8 @@ mod tests {
133 133
134 use crate::mock_analysis::analysis_and_position; 134 use crate::mock_analysis::analysis_and_position;
135 135
136 fn check_goto(fixuture: &str, expected: &str) { 136 fn check_goto(fixture: &str, expected: &str) {
137 let (analysis, pos) = analysis_and_position(fixuture); 137 let (analysis, pos) = analysis_and_position(fixture);
138 138
139 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info; 139 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info;
140 assert_eq!(navs.len(), 1); 140 assert_eq!(navs.len(), 1);
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 60b81567c..0888ab6de 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -71,8 +71,8 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
71 } 71 }
72} 72}
73 73
74// FIXME: this should not really use navigation target. Rather, approximatelly 74// FIXME: this should not really use navigation target. Rather, approximately
75// resovled symbol should return a `DefId`. 75// resolved symbol should return a `DefId`.
76fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Option<String> { 76fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Option<String> {
77 match (nav.description(db), nav.docs(db)) { 77 match (nav.description(db), nav.docs(db)) {
78 (Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs), 78 (Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs),
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs
index 444c4aeb2..681bd808d 100644
--- a/crates/ra_ide_api/src/impls.rs
+++ b/crates/ra_ide_api/src/impls.rs
@@ -78,8 +78,8 @@ fn impls_for_trait(
78mod tests { 78mod tests {
79 use crate::mock_analysis::analysis_and_position; 79 use crate::mock_analysis::analysis_and_position;
80 80
81 fn check_goto(fixuture: &str, expected: &[&str]) { 81 fn check_goto(fixture: &str, expected: &[&str]) {
82 let (analysis, pos) = analysis_and_position(fixuture); 82 let (analysis, pos) = analysis_and_position(fixture);
83 83
84 let navs = analysis.goto_implementation(pos).unwrap().unwrap().info; 84 let navs = analysis.goto_implementation(pos).unwrap().unwrap().info;
85 assert_eq!(navs.len(), expected.len()); 85 assert_eq!(navs.len(), expected.len());
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 2d090d9b4..de3ec4e0a 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -7,7 +7,7 @@
7//! However, IDE specific bits of the analysis (most notably completion) happen 7//! However, IDE specific bits of the analysis (most notably completion) happen
8//! in this crate. 8//! in this crate.
9//! 9//!
10//! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality 10//! The sibling `ra_ide_api_light` handles those bits of IDE functionality
11//! which are restricted to a single file and need only syntax. 11//! which are restricted to a single file and need only syntax.
12 12
13// For proving that RootDatabase is RefUnwindSafe. 13// For proving that RootDatabase is RefUnwindSafe.
@@ -67,7 +67,7 @@ pub use ra_db::{
67pub use hir::Documentation; 67pub use hir::Documentation;
68 68
69// We use jemalloc mainly to get heap usage statistics, actual performance 69// We use jemalloc mainly to get heap usage statistics, actual performance
70// differnece is not measures. 70// difference is not measures.
71#[cfg(feature = "jemalloc")] 71#[cfg(feature = "jemalloc")]
72#[global_allocator] 72#[global_allocator]
73static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; 73static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
@@ -221,12 +221,12 @@ impl Analysis {
221 self.db.line_index(file_id) 221 self.db.line_index(file_id)
222 } 222 }
223 223
224 /// Selects the next syntactic nodes encopasing the range. 224 /// Selects the next syntactic nodes encompassing the range.
225 pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> { 225 pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> {
226 self.with_db(|db| extend_selection::extend_selection(db, frange)) 226 self.with_db(|db| extend_selection::extend_selection(db, frange))
227 } 227 }
228 228
229 /// Returns position of the mathcing brace (all types of braces are 229 /// Returns position of the matching brace (all types of braces are
230 /// supported). 230 /// supported).
231 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> { 231 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> {
232 let file = self.db.parse(position.file_id); 232 let file = self.db.parse(position.file_id);
@@ -316,7 +316,7 @@ impl Analysis {
316 self.with_db(|db| references::find_all_refs(db, position)) 316 self.with_db(|db| references::find_all_refs(db, position))
317 } 317 }
318 318
319 /// Returns a short text descrbing element at position. 319 /// Returns a short text describing element at position.
320 pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> { 320 pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> {
321 self.with_db(|db| hover::hover(db, position)) 321 self.with_db(|db| hover::hover(db, position))
322 } 322 }
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs
index 8d8603062..017ac5de3 100644
--- a/crates/ra_ide_api/src/mock_analysis.rs
+++ b/crates/ra_ide_api/src/mock_analysis.rs
@@ -18,7 +18,7 @@ impl MockAnalysis {
18 } 18 }
19 /// Creates `MockAnalysis` using a fixture data in the following format: 19 /// Creates `MockAnalysis` using a fixture data in the following format:
20 /// 20 ///
21 /// ```notrust 21 /// ```rust,ignore
22 /// //- /main.rs 22 /// //- /main.rs
23 /// mod foo; 23 /// mod foo;
24 /// fn main() {} 24 /// fn main() {}
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index 2cb1cc9be..ca145f3e4 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -295,17 +295,17 @@ mod tests {
295 fn test_rename(text: &str, new_name: &str, expected: &str) { 295 fn test_rename(text: &str, new_name: &str, expected: &str) {
296 let (analysis, position) = single_file_with_position(text); 296 let (analysis, position) = single_file_with_position(text);
297 let source_change = analysis.rename(position, new_name).unwrap(); 297 let source_change = analysis.rename(position, new_name).unwrap();
298 let mut text_edit_bulder = ra_text_edit::TextEditBuilder::default(); 298 let mut text_edit_builder = ra_text_edit::TextEditBuilder::default();
299 let mut file_id: Option<FileId> = None; 299 let mut file_id: Option<FileId> = None;
300 if let Some(change) = source_change { 300 if let Some(change) = source_change {
301 for edit in change.source_file_edits { 301 for edit in change.source_file_edits {
302 file_id = Some(edit.file_id); 302 file_id = Some(edit.file_id);
303 for atom in edit.edit.as_atoms() { 303 for atom in edit.edit.as_atoms() {
304 text_edit_bulder.replace(atom.delete, atom.insert.clone()); 304 text_edit_builder.replace(atom.delete, atom.insert.clone());
305 } 305 }
306 } 306 }
307 } 307 }
308 let result = text_edit_bulder.finish().apply(&*analysis.file_text(file_id.unwrap())); 308 let result = text_edit_builder.finish().apply(&*analysis.file_text(file_id.unwrap()));
309 assert_eq_text!(expected, &*result); 309 assert_eq_text!(expected, &*result);
310 } 310 }
311} 311}
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index de0f46134..15348124b 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -5,20 +5,20 @@
5//! symbols. The backbone of the index is the **awesome** `fst` crate by 5//! symbols. The backbone of the index is the **awesome** `fst` crate by
6//! @BurntSushi. 6//! @BurntSushi.
7//! 7//!
8//! In a nutshell, you give a set of strings to the `fst`, and it builds a 8//! In a nutshell, you give a set of strings to `fst`, and it builds a
9//! finite state machine describing this set of strings. The strings which 9//! finite state machine describing this set of strings. The strings which
10//! could fuzzy-match a pattern can also be described by a finite state machine. 10//! could fuzzy-match a pattern can also be described by a finite state machine.
11//! What is freakingly cool is that you can now traverse both state machines in 11//! What is freaking cool is that you can now traverse both state machines in
12//! lock-step to enumerate the strings which are both in the input set and 12//! lock-step to enumerate the strings which are both in the input set and
13//! fuzz-match the query. Or, more formally, given two languages described by 13//! fuzz-match the query. Or, more formally, given two languages described by
14//! fsts, one can build an product fst which describes the intersection of the 14//! FSTs, one can build a product FST which describes the intersection of the
15//! languages. 15//! languages.
16//! 16//!
17//! `fst` does not support cheap updating of the index, but it supports unioning 17//! `fst` does not support cheap updating of the index, but it supports unioning
18//! of state machines. So, to account for changing source code, we build an fst 18//! of state machines. So, to account for changing source code, we build an FST
19//! for each library (which is assumed to never change) and an fst for each rust 19//! for each library (which is assumed to never change) and an FST for each Rust
20//! file in the current workspace, and run a query against the union of all 20//! file in the current workspace, and run a query against the union of all
21//! those fsts. 21//! those FSTs.
22use std::{ 22use std::{
23 cmp::Ordering, 23 cmp::Ordering,
24 hash::{Hash, Hasher}, 24 hash::{Hash, Hasher},
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index ec2fd1eb5..cdca3cafb 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -109,7 +109,7 @@ mod tests {
109 109
110 use super::*; 110 use super::*;
111 111
112 // Good first issue (although a slightly chellegning one): 112 // Good first issue (although a slightly challenging one):
113 // 113 //
114 // * Pick a random test from here 114 // * Pick a random test from here
115 // https://github.com/intellij-rust/intellij-rust/blob/c4e9feee4ad46e7953b1948c112533360b6087bb/src/test/kotlin/org/rust/lang/core/macros/RsMacroExpansionTest.kt 115 // https://github.com/intellij-rust/intellij-rust/blob/c4e9feee4ad46e7953b1948c112533360b6087bb/src/test/kotlin/org/rust/lang/core/macros/RsMacroExpansionTest.kt
@@ -171,8 +171,8 @@ impl_froms!(TokenTree: Leaf, Subtree);
171 171
172 let (invocation_tt, _) = ast_to_token_tree(macro_invocation.token_tree().unwrap()).unwrap(); 172 let (invocation_tt, _) = ast_to_token_tree(macro_invocation.token_tree().unwrap()).unwrap();
173 173
174 let expaned = rules.expand(&invocation_tt).unwrap(); 174 let expanded = rules.expand(&invocation_tt).unwrap();
175 assert_eq!(expaned.to_string(), expansion); 175 assert_eq!(expanded.to_string(), expansion);
176 } 176 }
177 177
178 #[test] 178 #[test]
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index f6177f078..1acba86ea 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -58,7 +58,7 @@ fn expand_rule(rule: &crate::Rule, input: &tt::Subtree) -> Option<tt::Subtree> {
58/// 58///
59/// The other side of the puzzle is `expand_subtree`, where we use the bindings 59/// The other side of the puzzle is `expand_subtree`, where we use the bindings
60/// to substitute meta variables in the output template. When expanding, we 60/// to substitute meta variables in the output template. When expanding, we
61/// maintain a `nesteing` stack of indicies whihc tells us which occurence from 61/// maintain a `nesting` stack of indices which tells us which occurrence from
62/// the `Bindings` we should take. We push to the stack when we enter a 62/// the `Bindings` we should take. We push to the stack when we enter a
63/// repetition. 63/// repetition.
64/// 64///
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 8adf463a6..5866be519 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -12,7 +12,7 @@ use crate::Result;
12/// 12///
13/// Note that internally, rust analyzer uses a different structure: 13/// Note that internally, rust analyzer uses a different structure:
14/// `CrateGraph`. `CrateGraph` is lower-level: it knows only about the crates, 14/// `CrateGraph`. `CrateGraph` is lower-level: it knows only about the crates,
15/// while this knows about `Pacakges` & `Targets`: purely cargo-related 15/// while this knows about `Packages` & `Targets`: purely cargo-related
16/// concepts. 16/// concepts.
17#[derive(Debug, Clone)] 17#[derive(Debug, Clone)]
18pub struct CargoWorkspace { 18pub struct CargoWorkspace {
diff --git a/crates/ra_vfs/src/io.rs b/crates/ra_vfs/src/io.rs
index dc0b84d5a..3952b200b 100644
--- a/crates/ra_vfs/src/io.rs
+++ b/crates/ra_vfs/src/io.rs
@@ -169,7 +169,7 @@ fn convert_notify_event(event: DebouncedEvent, sender: &Sender<(PathBuf, ChangeK
169 // ignore 169 // ignore
170 } 170 }
171 DebouncedEvent::Rescan => { 171 DebouncedEvent::Rescan => {
172 // TODO rescan all roots 172 // TODO: rescan all roots
173 } 173 }
174 DebouncedEvent::Create(path) => { 174 DebouncedEvent::Create(path) => {
175 sender.send((path, ChangeKind::Create)).unwrap(); 175 sender.send((path, ChangeKind::Create)).unwrap();
@@ -185,7 +185,7 @@ fn convert_notify_event(event: DebouncedEvent, sender: &Sender<(PathBuf, ChangeK
185 sender.send((dst, ChangeKind::Create)).unwrap(); 185 sender.send((dst, ChangeKind::Create)).unwrap();
186 } 186 }
187 DebouncedEvent::Error(err, path) => { 187 DebouncedEvent::Error(err, path) => {
188 // TODO should we reload the file contents? 188 // TODO: should we reload the file contents?
189 log::warn!("watcher error \"{}\", {:?}", err, path); 189 log::warn!("watcher error \"{}\", {:?}", err, path);
190 } 190 }
191 } 191 }
diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs
index 5d98d905c..3dd05197e 100644
--- a/crates/ra_vfs/src/lib.rs
+++ b/crates/ra_vfs/src/lib.rs
@@ -7,8 +7,10 @@
7//! 7//!
8//! It is also responsible for watching the disk for changes, and for merging 8//! It is also responsible for watching the disk for changes, and for merging
9//! editor state (modified, unsaved files) with disk state. 9//! editor state (modified, unsaved files) with disk state.
10//! TODO: Some LSP clients support watching the disk, so this crate should 10//!
11//! to support custom watcher events (related to https://github.com/rust-analyzer/rust-analyzer/issues/131) 11//! TODO: Some LSP clients support watching the disk, so this crate should to
12//! support custom watcher events (related to
13//! <https://github.com/rust-analyzer/rust-analyzer/issues/131>)
12//! 14//!
13//! VFS is based on a concept of roots: a set of directories on the file system 15//! VFS is based on a concept of roots: a set of directories on the file system
14//! which are watched for changes. Typically, there will be a root for each 16//! which are watched for changes. Typically, there will be a root for each
@@ -212,12 +214,12 @@ impl Vfs {
212 let mut cur_files = Vec::new(); 214 let mut cur_files = Vec::new();
213 // While we were scanning the root in the background, a file might have 215 // While we were scanning the root in the background, a file might have
214 // been open in the editor, so we need to account for that. 216 // been open in the editor, so we need to account for that.
215 let exising = self.root2files[root] 217 let existing = self.root2files[root]
216 .iter() 218 .iter()
217 .map(|&file| (self.files[file].path.clone(), file)) 219 .map(|&file| (self.files[file].path.clone(), file))
218 .collect::<FxHashMap<_, _>>(); 220 .collect::<FxHashMap<_, _>>();
219 for (path, text) in files { 221 for (path, text) in files {
220 if let Some(&file) = exising.get(&path) { 222 if let Some(&file) = existing.get(&path) {
221 let text = Arc::clone(&self.files[file].text); 223 let text = Arc::clone(&self.files[file].text);
222 cur_files.push((file, path, text)); 224 cur_files.push((file, path, text));
223 continue; 225 continue;
@@ -322,7 +324,7 @@ impl Vfs {
322 mem::replace(&mut self.pending_changes, Vec::new()) 324 mem::replace(&mut self.pending_changes, Vec::new())
323 } 325 }
324 326
325 /// Sutdown the VFS and terminate the background watching thread. 327 /// Shutdown the VFS and terminate the background watching thread.
326 pub fn shutdown(self) -> thread::Result<()> { 328 pub fn shutdown(self) -> thread::Result<()> {
327 self.worker.shutdown() 329 self.worker.shutdown()
328 } 330 }
@@ -347,7 +349,7 @@ impl Vfs {
347 } 349 }
348 350
349 fn remove_file(&mut self, file: VfsFile) { 351 fn remove_file(&mut self, file: VfsFile) {
350 //FIXME: use arena with removal 352 // FIXME: use arena with removal
351 self.files[file].text = Default::default(); 353 self.files[file].text = Default::default();
352 self.files[file].path = Default::default(); 354 self.files[file].path = Default::default();
353 let root = self.files[file].root; 355 let root = self.files[file].root;
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 09fc2e659..4d83af00c 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -113,9 +113,9 @@ pub struct FixtureEntry {
113 pub text: String, 113 pub text: String,
114} 114}
115 115
116/// Parses text wich looks like this: 116/// Parses text which looks like this:
117/// 117///
118/// ```notrust 118/// ```rust,ignore
119/// //- some meta 119/// //- some meta
120/// line 1 120/// line 1
121/// line 2 121/// line 2
diff --git a/crates/test_utils/src/marks.rs b/crates/test_utils/src/marks.rs
index d2a84643c..107432926 100644
--- a/crates/test_utils/src/marks.rs
+++ b/crates/test_utils/src/marks.rs
@@ -1,10 +1,10 @@
1//! This module implements manually tracked test coverage, which useful for 1//! This module implements manually tracked test coverage, which useful for
2//! quickly finding a test responsible for testing a particular bit of code. 2//! quickly finding a test responsible for testing a particular bit of code.
3//! 3//!
4//! See https://matklad.github.io/2018/06/18/a-trick-for-test-maintenance.html 4//! See <https://matklad.github.io/2018/06/18/a-trick-for-test-maintenance.html>
5//! for details, but the TL;DR is that you write your test as 5//! for details, but the TL;DR is that you write your test as
6//! 6//!
7//! ```no-run 7//! ```rust,no_run
8//! #[test] 8//! #[test]
9//! fn test_foo() { 9//! fn test_foo() {
10//! covers!(test_foo); 10//! covers!(test_foo);
@@ -13,7 +13,9 @@
13//! 13//!
14//! and in the code under test you write 14//! and in the code under test you write
15//! 15//!
16//! ```no-run 16//! ```rust,no_run
17//! # use test_utils::tested_by;
18//! # fn some_condition() -> bool { true }
17//! fn foo() { 19//! fn foo() {
18//! if some_condition() { 20//! if some_condition() {
19//! tested_by!(test_foo); 21//! tested_by!(test_foo);
diff --git a/crates/thread_worker/src/lib.rs b/crates/thread_worker/src/lib.rs
index ca0aad136..a522a0843 100644
--- a/crates/thread_worker/src/lib.rs
+++ b/crates/thread_worker/src/lib.rs
@@ -65,7 +65,7 @@ impl WorkerHandle {
65 } 65 }
66} 66}
67 67
68/// Sets up worker channels in a deadlock-avoind way. 68/// Sets up worker channels in a deadlock-avoiding way.
69/// If one sets both input and output buffers to a fixed size, 69/// If one sets both input and output buffers to a fixed size,
70/// a worker might get stuck. 70/// a worker might get stuck.
71fn worker_chan<I, O>(buf: usize) -> (Worker<I, O>, Receiver<I>, Sender<O>) { 71fn worker_chan<I, O>(buf: usize) -> (Worker<I, O>, Receiver<I>, Sender<O>) {