Skip to content

Improve typography #1070

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

Merged
merged 3 commits into from
Apr 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ useful features to improve code quality and developer velocity! These include
- Awareness of benchmarks

This chapter will go through some quick basics, but you can find the
comprehensive docs [here](http://doc.crates.io/index.html).
comprehensive docs in [The Cargo Book](https://doc.rust-lang.org/cargo/).
7 changes: 4 additions & 3 deletions src/cargo/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ To tell `cargo` to compile or run this binary as opposed to the default or other
binaries, we just pass `cargo` the `--bin my_other_bin` flag, where `my_other_bin`
is the name of the binary we want to work with.

In addition to extra binaries, there is support for benchmarks, tests, and
examples. The full capabilities are documented
[here](http://doc.crates.io/book/guide/project-layout.html).
In addition to extra binaries, `cargo` supports [more features] such as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing link to more features?

benchmarks, tests, and examples.

In the next chapter, we will look more closely at tests.

[more features]: https://doc.rust-lang.org/cargo/guide/project-layout.html
16 changes: 10 additions & 6 deletions src/cargo/deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ authors = ["mark"]
[dependencies]
```

You can read more extensively about all of the available configuration options
[here](http://doc.crates.io/manifest.html).

The `name` field under `package` determines the name of the project. This is
used by `crates.io` if you publish the crate (more later). It is also the name
of the output binary when you compile.
Expand All @@ -63,9 +60,8 @@ add a dependency to our program, we can simply add the following to our
crate clap` in `main.rs`, just like normal. And that's it! You can start using
`clap` in your program.

`cargo` also supports other types of dependencies. Here is just a small
sampling. You can find out more
[here](http://doc.crates.io/specifying-dependencies.html).
`cargo` also supports [other types of dependencies][dependencies]. Here is just
a small sampling:

```toml
[package]
Expand All @@ -79,10 +75,18 @@ rand = { git = "https://github.com/rust-lang-nursery/rand" } # from online repo
bar = { path = "../bar" } # from a path in the local filesystem
```

`cargo` is more than a dependency manager. All of the available
configuration options are listed in the [format specification][manifest] of
`Cargo.toml`.

To build our project we can execute `cargo build` anywhere in the project
directory (including subdirectories!). We can also do `cargo run` to build and
run. Notice that these commands will resolve all dependencies, download crates
if needed, and build everything, including your crate. (Note that it only
rebuilds what it has not already built, similar to `make`).

Voila! That's all there is to it!


[manifest]: https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
5 changes: 1 addition & 4 deletions src/trait/iter.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Iterators

The `Iterator` trait is used to implement iterators over collections such as arrays.
The [`Iterator`][iter] trait is used to implement iterators over collections such as arrays.

The trait requires only a method to be defined for the `next` element,
which may be manually defined in an `impl` block or automatically
Expand All @@ -9,9 +9,6 @@ defined (as in arrays and ranges).
As a point of convenience for common situations, the `for` construct
turns some collections into iterators using the [`.into_iterator()`][intoiter] method.

Methods that can be accessed using the `Iterator` trait in addition
to those shown in the example below can be found [here][iter].

```rust,editable
struct Fibonacci {
curr: u32,
Expand Down
2 changes: 1 addition & 1 deletion src/trait/ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ because operators are syntactic sugar for method calls. For example, the `+` ope
`a + b` calls the `add` method (as in `a.add(b)`). This `add` method is part of the `Add`
trait. Hence, the `+` operator can be used by any implementor of the `Add` trait.

A list of the traits, such as `Add`, that overload operators is available [here][ops].
A list of the traits, such as `Add`, that overload operators can be found in [`core::ops`][ops].

```rust,editable
use std::ops;
Expand Down