Skip to content

Commit 30dc730

Browse files
Merge #460
460: Doc comment standardization r=bidoubiwa a=IsaacCloos # Pull Request This work addresses a slew of inconsistencies I've noticed in this projects documentation. These were found while trying to establish a basis to abide to for new doc comments coming soon to resolve #372 ## Related issue Partially addresses #372 ## What does this PR do? - hide client instantiation from `example` view. It was 50/50 throughout the project so I push the 'hide' strategy. I personally believe it cleans up the method examples, but if you'd like to have it visible everywhere instead I can totally make that change 😄. I just think it would be beneficial to have some consistency here for users. (making the docs more predictable and all) - removed a few ```` ```rust ```` annotations (not the code!!). Per the [docs](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#documentation-tests) stating `rust` is the default language. - made assertions visible where possible in the docs. This was 50/50 throughout and I believe that rounding out an example with a `print` or `assert` command is a better user experience. - implemented clippy recommendations in every existing doc comment in the project. Not **ALL** suggestions, but most. Lots of tab corrections, which I think make the comments much nicer to read. - fixed spacing inconsistencies in assert(s). E.g. `.len()>0` changed to `.len() > 0` - bolded `Default` declarations (a trend I've noticed in other libraries). - did my best to split up paragraphs of text where I believe the intention was for the text to be separated but markdown puts new lines together if they are just one line return apart. Some were using the backtick method, but I changed them all to be double returns. - added a handful of missing references: [Key], [Index], ext - hid additional references making examples more concise - hid certain missed comments and closures that resulted in jarring or inaccurate examples ## PR checklist Please check if your PR fulfills the following requirements: - [X] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [X] Have you read the contributing guidelines? - [X] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! # Criticism Welcome I thought being a little opinionated about this first pass at a general "clean up" could prove fruitful if it sparked discussions about what YOU want to see in this project. I'd be more than happy to make any necessary changes to get this the way you'd like. If you have any questions about decisions I made, please let me know! I'm new to Rust and always trying to understand the dos and don'ts better 😄 Thanks for the feedback! p.s. I am aware that this PR is everything BUT what the linked ticket is requesting 😅. I call it 'Preliminary work' 😆 Co-authored-by: Isaac Cloos <[email protected]>
2 parents 94b25ea + 2bed778 commit 30dc730

File tree

13 files changed

+604
-534
lines changed

13 files changed

+604
-534
lines changed

examples/cli-app/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ async fn build_index() {
6767
// serialize the string to clothes objects
6868
let clothes: Vec<Clothes> = serde_json::from_str(content).unwrap();
6969

70-
//create displayed attributes
70+
// create displayed attributes
7171
let displayed_attributes = ["article", "cost", "size", "pattern"];
7272

7373
// Create ranking rules
7474
let ranking_rules = ["words", "typo", "attribute", "exactness", "cost:asc"];
7575

76-
//create searchable attributes
76+
// create searchable attributes
7777
let searchable_attributes = ["seaon", "article", "size", "pattern"];
7878

7979
// create the synonyms hashmap
@@ -82,14 +82,14 @@ async fn build_index() {
8282
synonyms.insert("sweat pants", vec!["joggers", "gym pants"]);
8383
synonyms.insert("t-shirt", vec!["tees", "tshirt"]);
8484

85-
//create the settings struct
85+
// create the settings struct
8686
let settings = Settings::new()
8787
.with_ranking_rules(ranking_rules)
8888
.with_searchable_attributes(searchable_attributes)
8989
.with_displayed_attributes(displayed_attributes)
9090
.with_synonyms(synonyms);
9191

92-
//add the settings to the index
92+
// add the settings to the index
9393
let result = CLIENT
9494
.index("clothes")
9595
.set_settings(&settings)

examples/web_app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build your front-end page in Rust with WebAssembly
22

33
> **Note**
4-
> It is not possible to run Meilisearch in the browser without a server. This demo uses the Rust SDK in a browser using WASM, and communicate with a Meilisearch instance that is running on a remote server.
4+
> It is not possible to run Meilisearch in the browser without a server. This demo uses the Rust SDK in a browser using WASM, and communicates with a Meilisearch instance that is running on a remote server.
55
66
This example is a clone of [crates.meilisearch.com](https://crates.meilisearch.com), but the front-end is written in Rust!
77
The Rust source files are compiled into WebAssembly and so can be readable by the browsers.

0 commit comments

Comments
 (0)