Skip to content

Commit 2104b1f

Browse files
authored
chore: minor improvement for docs (#9017)
Signed-off-by: changgesi <[email protected]>
1 parent 0081111 commit 2104b1f

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

crates/cairo-lang-doc/src/db.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub trait DocGroup: Database {
2020
get_item_documentation(self.as_dyn_database(), (), item_id)
2121
}
2222

23-
/// Gets the documentation of a certain as a vector of continuous tokens.
23+
/// Gets the documentation of an item as a vector of continuous tokens.
2424
fn get_item_documentation_as_tokens<'db>(
2525
&'db self,
2626
item_id: DocumentableItemId<'db>,
@@ -34,7 +34,7 @@ pub trait DocGroup: Database {
3434
}
3535

3636
/// Gets the signature of an item and a list of [`LocationLink`]s to enable mapping
37-
/// signature slices on documentable items.
37+
/// signature slices to documentable items.
3838
fn get_item_signature_with_links<'db>(
3939
&'db self,
4040
item_id: DocumentableItemId<'db>,
@@ -124,7 +124,7 @@ fn get_crate_root_module_documentation<'db>(
124124
extract_item_module_level_documentation_from_file(db, module_id)
125125
}
126126

127-
/// Gets the "//!" inner comment of the item (if only item supports inner comments).
127+
/// Gets the "//!" inner comment of the item (only if the item supports inner comments).
128128
fn extract_item_inner_documentation<'db>(
129129
db: &'db dyn Database,
130130
item_id: DocumentableItemId<'db>,
@@ -147,7 +147,7 @@ fn extract_item_inner_documentation<'db>(
147147
}
148148
}
149149

150-
/// Only gets the doc comments above the item.
150+
/// Gets only the doc comments above the item.
151151
fn extract_item_outer_documentation<'db>(
152152
db: &'db dyn Database,
153153
item_id: DocumentableItemId<'db>,
@@ -166,7 +166,7 @@ fn extract_item_outer_documentation<'db>(
166166
)
167167
}
168168

169-
/// Gets the module level comments of the item.
169+
/// Gets the module-level comments of the item.
170170
fn extract_item_module_level_documentation<'db>(
171171
db: &'db dyn Database,
172172
item_id: DocumentableItemId<'db>,
@@ -185,7 +185,7 @@ fn extract_item_module_level_documentation<'db>(
185185
}
186186
}
187187

188-
/// Only gets the comments inside the item.
188+
/// Gets only the comments inside the item.
189189
fn extract_item_inner_documentation_from_raw_text(raw_text: String) -> String {
190190
raw_text
191191
.lines()
@@ -195,7 +195,7 @@ fn extract_item_inner_documentation_from_raw_text(raw_text: String) -> String {
195195
.join("\n")
196196
}
197197

198-
/// Gets the module level comments of certain file.
198+
/// Gets the module-level comments of a file.
199199
fn extract_item_module_level_documentation_from_file<'db>(
200200
db: &'db dyn Database,
201201
file_id: FileId<'db>,
@@ -211,7 +211,7 @@ fn extract_item_module_level_documentation_from_file<'db>(
211211
)
212212
}
213213

214-
/// This function does 3 things to the line of comment:
214+
/// This function does 3 things to a comment line:
215215
/// 1. Removes indentation
216216
/// 2. If it starts with one of the passed prefixes, removes the given prefixes (including the space
217217
/// after the prefix).
@@ -236,7 +236,7 @@ fn extract_comment_from_code_line(line: &str, comment_markers: &[&'static str])
236236
None
237237
}
238238

239-
/// Check whether the code line is a comment line.
239+
/// Checks whether the code line is a comment line.
240240
fn is_comment_line(line: &str) -> bool {
241241
line.trim_start().starts_with("//")
242242
}

crates/cairo-lang-doc/src/parser.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub struct CommentLinkToken<'db> {
3535
pub resolved_item: Option<DocumentableItemId<'db>>,
3636
}
3737

38-
/// Generic type for a comment token. It's either a plain content or a link.
39-
/// Notice that the Content type of token can store much more than just one word.
38+
/// Generic type for a comment token. It's either plain content or a link.
39+
/// Notice that the Content token type can store much more than just one word.
4040
#[derive(Debug, PartialEq, Clone, Eq, salsa::Update)]
4141
pub enum DocumentationCommentToken<'db> {
4242
/// Token with plain documentation content.
@@ -57,9 +57,9 @@ impl DocumentationCommentToken<'_> {
5757

5858
/// Helper struct for formatting possibly nested Markdown lists.
5959
struct DocCommentListItem {
60-
/// Order list item separator
60+
/// Ordered list item separator
6161
delimiter: Option<u64>,
62-
/// Flag for a list with order elements
62+
/// Flag for an ordered list
6363
is_ordered_list: bool,
6464
}
6565

@@ -73,10 +73,10 @@ impl<'db> DocumentationCommentParser<'db> {
7373
Self { db }
7474
}
7575

76-
/// Parses documentation comment content into vector of [DocumentationCommentToken]s, keeping
76+
/// Parses documentation comment content into a vector of [DocumentationCommentToken]s, keeping
7777
/// the order in which they were present in the content.
7878
///
79-
/// We look for 3 types of patterns when it comes to link (ignore the backslash):
79+
/// We look for 3 link patterns (ignore the backslash):
8080
/// "\[label\](path)", "\[path\]" or "\[`path`\]".
8181
pub fn parse_documentation_comment(
8282
&self,
@@ -484,7 +484,7 @@ impl<'db> DebugWithDb<'db> for CommentLinkToken<'db> {
484484
}
485485
}
486486

487-
/// Maps `HeadingLevel` to correct markdown marker.
487+
/// Maps `HeadingLevel` to the correct markdown marker.
488488
fn heading_level_to_markdown(heading_level: HeadingLevel) -> String {
489489
let heading_char: String = String::from("#");
490490
match heading_level {
@@ -497,7 +497,7 @@ fn heading_level_to_markdown(heading_level: HeadingLevel) -> String {
497497
}
498498
}
499499

500-
/// Maps [`Alignment`] to correct markdown markers.
500+
/// Maps [`Alignment`] to the correct markdown markers.
501501
fn get_alignment_markers(alignment: &Alignment) -> (String, String) {
502502
let (left, right) = match alignment {
503503
Alignment::None => ("", ""),

0 commit comments

Comments
 (0)