fix: remove unexpected translations on code blocks#4
Open
chimes-of-freedom wants to merge 74 commits into
Open
fix: remove unexpected translations on code blocks#4chimes-of-freedom wants to merge 74 commits into
chimes-of-freedom wants to merge 74 commits into
Conversation
I'm not sure what that meant to be initially, but this looks more useful now.
Make code more idiomatic. A person learning Rust for the first time seeing `use crate::Role::*` gets spun into a rabbit hole of: - understanding what "crate::" means here - is a single file a crate? (look it up in the docs) - do even enums local to the file have to be specified with an absolute path from crate root? Besides, `use crate:: ...` is taught in the example for use later on, which is linked to at the bottom of this document. Using this document to only teach about unpacking enums into the name space, and then using the other document to introduce `use crate::`, means less things need to be learned all at once, reducing confusion.
Corrected a typo in the comment regarding non-tail recursion.
Fix typo in linked list length calculation comment
…atch-binding Add an example showing pattern binding when matching several values in a match arm
Include a link to The Rust Reference in flow_control/match/destructuring
Remove weird extra spaces in code
Update enum_use.md
…-clarification add clarification on overflowing_literals lint
Fix typos in flow_control/match/binding
Updated the description of the `Path` type to clarify its usage across platforms and simplified the language. I updated src/std_misc/path.md to remove references to separate posix::Path/windows::Path and reflect that there’s a single std::path::Path. I also simplified the closing guidance to point users to Path methods and Metadata.
I added a runtime check in the language picker so unavailable locales are hidden, preventing 404s like the Spanish URL on doc.rust-lang.org. This keeps working languages (ja/zh) visible and avoids broken links when a locale isn’t deployed. To verify locally - English-only build: run mdbook serve and confirm the menu hides ja/zh/es. - Japanese build: MDBOOK_BOOK__LANGUAGE=ja mdbook serve and confirm only ja (and any other deployed locales) remain. - Spanish build: MDBOOK_BOOK__LANGUAGE=es mdbook serve and confirm es remains and others hide.
Revise `Path` type documentation for clarity
Clarify the description of the `any` function parameters.
use AND search instead of OR, which is default
I have not seen manual scoping used elsewhere before
…`-behavior-in-Iteratorany-trait-example Update documentation for `any` function in iter_any.md
make search less surprising
enum_use.md: avoid an uncommon term
link the _tuple_ page instead "TupleStruct"
Use `From::from` fn pointer to convert to boxed errors
Update to mdbook 0.5
… 1000" in HOF.md The algorithm to "Find the sum of all the numbers with odd squares under 1000" is wrong. It was calculating the sum of odd squares under 1000.
phoneNumber number is not in use and it generates a working
Previously, this example wasn't compiling because of the deprecated `thread_rng` and `fill` functions. Upon making the changes the compiler suggests and swapping `usize` for `u64`, the example compiles properly. Here are the compile errors:
```sh
Compiling playground v0.0.1 (/playground)
warning: unused import: `rand::Fill`
--> src/main.rs:2:5
|
2 | use rand::Fill;
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
warning: use of deprecated function `rand::thread_rng`: Renamed to `rng`
--> src/main.rs:5:25
|
5 | let mut rng = rand::thread_rng();
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
error[E0599]: no method named `try_fill` found for struct `Box<[{integer}; 100]>` in the current scope
--> src/main.rs:7:11
|
7 | boxed.try_fill(&mut rng).unwrap();
| ^^^^^^^^
|
help: there is a method `fill` with a similar name
|
7 - boxed.try_fill(&mut rng).unwrap();
7 + boxed.fill(&mut rng).unwrap();
|
For more information about this error, try `rustc --explain E0599`.
warning: `playground` (bin "playground") generated 2 warnings
error: could not compile `playground` (bin "playground") due to 1 previous error; 2 warnings emitted
```
Expanded the documentation on the Clone and Copy traits, detailing their behaviors and requirements. Added examples to illustrate implicit copying and explicit cloning.
Improve Clone and Copy traits documentation
Update deprecated functions in `Box::leak` example
Update question_mark.md
Update supertraits.md
From context and from the [previous PR](rust-lang@7da5b73) (which removed the space after the operator), we can see this is a typo. 😉
1.2.2 Display: Fix typo in bonus instructions (before -> after)
not needed as std::fmt::Display and std::fit::Debug are the same for u32 and bool
Show how a module can re-export an item with pub use so the use declaration chapter covers that common pattern directly. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…xample-1234 Add a pub use example
The into_iter() example previously used `println!("names: {:?}", names)`
after the collection was consumed, causing a compilation error. Commented
out the offending line with an explanation and removed the `ignore` flag
so the example is now compilable and runnable.
…t-lang#1925) The comments incorrectly stated that File's drop runs before the custom drop implementation. In Rust, the custom drop method runs first, and then fields are dropped afterwards. Updated comments to reflect the actual destruction order.
…e-time-fallacy fix: replace year-to-days conversion with miles-to-km in newtype example
…ind-comments fix: correct iter/into_iter type comments in iter_find example
…se-list-comment fix: clarify comment about tuple struct field access in testcase_list
…display-error-comment fix: clarify misleading 'Error' comment in print_display example
…ted-print-module-wording fix: replace confusing 'module' with 'item' in formatted print docs
…estruction-order fix: correct destruction order comments in Drop TempFile example
…ter-compile-error fix: correct into_iter() example to compile properly
I recently discovered the issue for myself, that you can write the following code:
for i in 10..1{
println!("Hello World");
}
This code does nothing, but you dont get a compiler warning and nothing and this isnt described in the rust handbook either.
I dont think I can be the only beginner stumbling over this, so theres a possible solution. I dont know if the way I wrote it fits in with the writing style of the book, but just adjust it as needed :)
…ch-1 Update for.md
remove debug printing for the u32 and bool in variable_bindings.md
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
panic = "abort"insrc/error/abort_unwind.mdneed not be translated intopanic = "中止". Reverted them to English.