Skip to content

Commit b57b8ae

Browse files
A-Walrusthomasskk
authored andcommitted
Fix cargo doc warnings, and add GitHub action to ensure it (helix-editor#3650)
1 parent e8a6e21 commit b57b8ae

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ jobs:
103103
command: clippy
104104
args: --all-targets -- -D warnings
105105

106+
- name: Run cargo doc
107+
uses: actions-rs/cargo@v1
108+
with:
109+
command: doc
110+
args: --no-deps --workspace --document-private-items
111+
env:
112+
RUSTDOCFLAGS: -D warnings
113+
106114
docs:
107115
name: Docs
108116
runs-on: ubuntu-latest

helix-core/src/indent.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ fn get_first_in_line(mut node: Node, byte_pos: usize, new_line: bool) -> Vec<boo
230230
/// - Successively add indent captures to get the (added) indent from a single line
231231
/// - Successively add the indent results for each line
232232
#[derive(Default)]
233-
struct Indentation {
233+
pub struct Indentation {
234234
/// The total indent (the number of indent levels) is defined as max(0, indent-outdent).
235235
/// The string that this results in depends on the indent style (spaces or tabs, etc.)
236236
indent: usize,
237237
outdent: usize,
238238
}
239239
impl Indentation {
240-
/// Add some other [IndentResult] to this.
240+
/// Add some other [Indentation] to this.
241241
/// The added indent should be the total added indent from one line
242242
fn add_line(&mut self, added: &Indentation) {
243243
if added.indent > 0 && added.outdent == 0 {
@@ -433,17 +433,17 @@ fn query_indents(
433433
/// after pos were moved to a new line.
434434
///
435435
/// The indentation is determined by traversing all the tree-sitter nodes containing the position.
436-
/// Each of these nodes produces some [AddedIndent] for:
436+
/// Each of these nodes produces some [Indentation] for:
437437
///
438438
/// - The line of the (beginning of the) node. This is defined by the scope `all` if this is the first node on its line.
439439
/// - The line after the node. This is defined by:
440440
/// - The scope `tail`.
441441
/// - The scope `all` if this node is not the first node on its line.
442442
/// Intuitively, `all` applies to everything contained in this node while `tail` applies to everything except for the first line of the node.
443443
/// The indents from different nodes for the same line are then combined.
444-
/// The [IndentResult] is simply the sum of the [AddedIndent] for all lines.
444+
/// The result [Indentation] is simply the sum of the [Indentation] for all lines.
445445
///
446-
/// Specifying which line exactly an [AddedIndent] applies to is important because indents on the same line combine differently than indents on different lines:
446+
/// Specifying which line exactly an [Indentation] applies to is important because indents on the same line combine differently than indents on different lines:
447447
/// ```ignore
448448
/// some_function(|| {
449449
/// // Both the function parameters as well as the contained block should be indented.

helix-term/src/ui/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Prompt {
101101
}
102102

103103
/// Compute the cursor position after applying movement
104-
/// Taken from: https://github.com/wez/wezterm/blob/e0b62d07ca9bf8ce69a61e30a3c20e7abc48ce7e/termwiz/src/lineedit/mod.rs#L516-L611
104+
/// Taken from: <https://github.com/wez/wezterm/blob/e0b62d07ca9bf8ce69a61e30a3c20e7abc48ce7e/termwiz/src/lineedit/mod.rs#L516-L611>
105105
fn eval_movement(&self, movement: Movement) -> usize {
106106
match movement {
107107
Movement::BackwardChar(rep) => {

helix-view/src/tree.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,18 @@ impl Tree {
270270
})
271271
}
272272

273-
/// Get reference to a [`view`] by index.
273+
/// Get reference to a [View] by index.
274274
/// # Panics
275275
///
276-
/// Panics if `index` is not in self.nodes, or if the node's content is not [`Content::View`] . This can be checked with [`contains`]
276+
/// Panics if `index` is not in self.nodes, or if the node's content is not [Content::View]. This can be checked with [Self::contains].
277277
pub fn get(&self, index: ViewId) -> &View {
278278
self.try_get(index).unwrap()
279279
}
280280

281-
/// Try to get reference to a [`view`] by index. Returns `None` if node content is not a [`Content::View`]
281+
/// Try to get reference to a [View] by index. Returns `None` if node content is not a [Content::View]
282282
/// # Panics
283283
///
284-
/// Panics if `index` is not in self.nodes. This can be checked with [`Self::contains`]
284+
/// Panics if `index` is not in self.nodes. This can be checked with [Self::contains]
285285
pub fn try_get(&self, index: ViewId) -> Option<&View> {
286286
match &self.nodes[index] {
287287
Node {
@@ -292,10 +292,10 @@ impl Tree {
292292
}
293293
}
294294

295-
/// Get a mutable reference to a [`view`] by index.
295+
/// Get a mutable reference to a [View] by index.
296296
/// # Panics
297297
///
298-
/// Panics if `index` is not in self.nodes, or if the node's content is not [`Content::View`] . This can be checked with [`Self::contains`]
298+
/// Panics if `index` is not in self.nodes, or if the node's content is not [Content::View]. This can be checked with [Self::contains].
299299
pub fn get_mut(&mut self, index: ViewId) -> &mut View {
300300
match &mut self.nodes[index] {
301301
Node {
@@ -306,7 +306,7 @@ impl Tree {
306306
}
307307
}
308308

309-
/// Check if tree contains a [`Node`] with a given index.
309+
/// Check if tree contains a [Node] with a given index.
310310
pub fn contains(&self, index: ViewId) -> bool {
311311
self.nodes.contains_key(index)
312312
}

0 commit comments

Comments
 (0)