-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make instructions append and hints consistent #1851
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...e/accumulate/.docs/instructions.append.md → exercises/practice/accumulate/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## General | ||
|
||
[Slices](https://doc.rust-lang.org/book/2018-edition/ch04-03-slices.html) have additionally to | ||
the normal element access via indexing (slice[index]) many useful functions like | ||
[split_at](https://doc.rust-lang.org/std/primitive.slice.html#method.split_at) or [getting | ||
subslices](https://doc.rust-lang.org/std/primitive.slice.html#method.get) (slice[start..end]). | ||
|
||
You can solve this exercise by just using boring old element access via indexing, but maybe the | ||
other provided functions can make your code cleaner and safer. | ||
|
||
## For Bonus Points | ||
|
||
- To get your function working with all kind of elements which can be ordered, | ||
have a look at the [Ord Trait](https://doc.rust-lang.org/std/cmp/trait.Ord.html). | ||
- To get your function working directly on Vec and Array, you can use the | ||
[AsRef Trait](https://doc.rust-lang.org/std/convert/trait.AsRef.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## General | ||
|
||
- Instead of implementing arbitrary-precision arithmetic from scratch, consider building your type on top of the [num_bigint](https://crates.io/crates/num-bigint) crate. | ||
- You might be able to [derive](https://doc.rust-lang.org/book/2018-edition/appendix-03-derivable-traits.html) some of the required traits. | ||
- `Decimal` is assumed to be a signed type. You do not have to create a separate unsigned type, though you may do so as an implementation detail if you so choose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-linked-list/.docs/instructions.append.md → ...ractice/doubly-linked-list/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Instructions append | ||
|
||
Note the additional test case in `tests/alloc-attack.rs`. It tests against | ||
algorithmically inefficient implementations. Because of that, it usually times | ||
out online instead of outright failing, leading to a less helpful error message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# Instructions append | ||
|
||
In the Rust track, tests are run using the command `cargo test`. |
2 changes: 1 addition & 1 deletion
2
.../high-scores/.docs/instructions.append.md → ...cises/practice/high-scores/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Hints | ||
## General | ||
|
||
Consider retaining a reference to `scores` in the struct - copying is not | ||
necessary. You will require some lifetime annotations, though. |
2 changes: 1 addition & 1 deletion
2
...ries-product/.docs/instructions.append.md → ...ice/largest-series-product/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Largest Series Product in Rust | ||
## General | ||
|
||
These iterators may be useful, depending on your approach | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
exercises/practice/parallel-letter-frequency/.docs/instructions.append.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...actice/poker/.docs/instructions.append.md → exercises/practice/poker/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
exercises/practice/reverse-string/.docs/instructions.append.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
exercises/practice/rna-transcription/.docs/instructions.append.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-linked-list/.docs/instructions.append.md → ...ractice/simple-linked-list/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Triangle in Rust | ||
# Instructions append | ||
|
||
- [Result](https://doc.rust-lang.org/std/result/index.html) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use glob::glob; | ||
use utils::fs::cd_into_repo_root; | ||
|
||
// https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-hints-md | ||
#[test] | ||
fn hints_have_correct_heading() { | ||
cd_into_repo_root(); | ||
for entry in glob("exercises/practice/*/.docs/hints.md").unwrap() { | ||
let path = entry.unwrap(); | ||
let content = std::fs::read_to_string(&path).unwrap(); | ||
assert!( | ||
content.starts_with("## General"), | ||
"incorrect heading in {}", | ||
path.display() | ||
) | ||
} | ||
} | ||
|
||
// https://exercism.org/docs/building/tracks/practice-exercises#h-file-docs-introduction-append-md | ||
#[test] | ||
fn instructions_append_have_correct_heading() { | ||
cd_into_repo_root(); | ||
for entry in glob("exercises/*/*/.docs/instructions.append.md").unwrap() { | ||
let path = entry.unwrap(); | ||
let content = std::fs::read_to_string(&path).unwrap(); | ||
assert!( | ||
content.starts_with("# Instructions append"), | ||
"incorrect heading in {}", | ||
path.display() | ||
) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Piggyback: fix formatting of this number