Skip to content
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
8 changes: 4 additions & 4 deletions src/doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ Building the book requires [mdBook]. To get it:

[mdBook]: https://github.com/azerupi/mdBook

```shell
```console
$ cargo install mdbook
```

### Building

To build the book:

```shell
```console
$ mdbook build
```

The output will be in the `book` subdirectory. To check it out, open it in
your web browser.

_Firefox:_
```shell
```console
$ firefox book/index.html # Linux
$ open -a "Firefox" book/index.html # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
$ start firefox.exe .\book\index.html # Windows (Cmd)
```

_Chrome:_
```shell
```console
$ google-chrome book/index.html # Linux
$ open -a "Google Chrome" book/index.html # OS X
$ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell)
Expand Down
10 changes: 5 additions & 5 deletions src/doc/src/getting-started/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To start a new project with Cargo, use `cargo new`:

```shell
```console
$ cargo new hello_world --bin
```

Expand All @@ -11,7 +11,7 @@ were making a library, we’d leave it off.

Let’s check out what Cargo has generated for us:

```shell
```console
$ cd hello_world
$ tree .
.
Expand Down Expand Up @@ -44,21 +44,21 @@ fn main() {

Cargo generated a “hello world” for us. Let’s compile it:

```shell
```console
$ cargo build
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
```

And then run it:

```shell
```console
$ ./target/debug/hello_world
Hello, world!
```

We can also use `cargo run` to compile and then run it, all in one step:

```shell
```console
$ cargo run
Fresh hello_world v0.1.0 (file:///path/to/project/hello_world)
Running `target/hello_world`
Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The easiest way to get Cargo is to get the current stable release of [Rust] by
using the `rustup` script:

```shell
```console
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
```

Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/guide/cargo-toml-vs-cargo-lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ they’ll use the exact same SHA, even though we didn’t specify it in our
When we’re ready to opt in to a new version of the library, Cargo can
re-calculate the dependencies and update things for us:

```shell
```console
$ cargo update # updates all dependencies
$ cargo update -p rand # updates just “rand”
```
Expand Down
12 changes: 6 additions & 6 deletions src/doc/src/guide/creating-a-new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To start a new project with Cargo, use `cargo new`:

```shell
```console
$ cargo new hello_world --bin
```

Expand All @@ -12,7 +12,7 @@ repository by default. If you don't want it to do that, pass `--vcs none`.

Let’s check out what Cargo has generated for us:

```shell
```console
$ cd hello_world
$ tree .
.
Expand Down Expand Up @@ -47,14 +47,14 @@ fn main() {

Cargo generated a “hello world” for us. Let’s compile it:

```shell
```console
$ cargo build
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
```

And then run it:

```shell
```console
$ ./target/debug/hello_world
Hello, world!
```
Expand All @@ -63,7 +63,7 @@ We can also use `cargo run` to compile and then run it, all in one step (You
won't see the `Compiling` line if you have not made any changes since you last
compiled):

```shell
```console
$ cargo run
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
Running `target/debug/hello_world`
Expand All @@ -76,7 +76,7 @@ dependencies. Since we don’t have any yet, it’s not very interesting.
Once you’re ready for release, you can use `cargo build --release` to compile
your files with optimizations turned on:

```shell
```console
$ cargo build --release
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
```
Expand Down
4 changes: 2 additions & 2 deletions src/doc/src/guide/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ regex = "0.1.41"
Re-run `cargo build`, and Cargo will fetch the new dependencies and all of
their dependencies, compile them all, and update the `Cargo.lock`:

```shell
```console
$ cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading memchr v0.1.5
Expand Down Expand Up @@ -83,7 +83,7 @@ fn main() {

Running it will show:

```shell
```console
$ cargo run
Running `target/hello_world`
Did our date match? true
Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/guide/project-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Cargo uses conventions for file placement to make it easy to dive into a new
Cargo project:

```shell
```
.
├── Cargo.lock
├── Cargo.toml
Expand Down
4 changes: 2 additions & 2 deletions src/doc/src/guide/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ the files in `tests`.
Here's an example of running `cargo test` in our project, which currently has
no tests:

```shell
```console
$ cargo test
Compiling rand v0.1.0 (https://github.com/rust-lang-nursery/rand.git#9f35b8e)
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
Expand All @@ -25,7 +25,7 @@ tests.

You can also run a specific test by passing a filter:

```shell
```console
$ cargo test foo
```

Expand Down
4 changes: 2 additions & 2 deletions src/doc/src/guide/working-on-an-existing-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ to get going.
First, get the project from somewhere. In this example, we’ll use `rand`
cloned from its repository on GitHub:

```shell
```console
$ git clone https://github.com/rust-lang-nursery/rand.git
$ cd rand
```

To build, use `cargo build`:

```shell
```console
$ cargo build
Compiling rand v0.1.0 (file:///path/to/project/rand)
```
Expand Down
6 changes: 3 additions & 3 deletions src/doc/src/reference/build-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if you want to ensure that output is always displayed on your terminal.
Any line that starts with `cargo:` is interpreted directly by Cargo.
This line must be of the form `cargo:key=value`, like the examples below:

```shell
```
# specially recognized by Cargo
cargo:rustc-link-lib=static=foo
cargo:rustc-link-search=native=/path/to/foo
Expand Down Expand Up @@ -219,7 +219,7 @@ library call as part of the build script.

First, let’s take a look at the directory structure of this package:

```shell
```
.
├── Cargo.toml
├── build.rs
Expand Down Expand Up @@ -305,7 +305,7 @@ a Rust library which calls into C to print “Hello, World!”.

Like above, let’s first take a look at the project layout:

```shell
```
.
├── Cargo.toml
├── build.rs
Expand Down
4 changes: 2 additions & 2 deletions src/doc/src/reference/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ features that people can enable or disable when they build it.
In that case, Servo will describe features in its `Cargo.toml` and they can be
enabled using command-line flags:

```shell
```console
$ cargo build --release --features "shumway pdf"
```

Expand Down Expand Up @@ -575,7 +575,7 @@ Your project can optionally contain folders named `examples`, `tests`, and
integration tests, and benchmarks respectively. Analogous to `bin` targets, they
may be composed of single files or directories with a `main.rs` file.

```shell
```
▾ src/ # directory containing source files
lib.rs # the main entry point for libraries and packages
main.rs # the main entry point for projects producing executables
Expand Down
10 changes: 5 additions & 5 deletions src/doc/src/reference/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ account (required for now). After this, visit your [Account
Settings](https://crates.io/me) page and run the `cargo login` command
specified.

```shell
```console
$ cargo login abcdefghijklmnopqrstuvwxyz012345
```

Expand All @@ -37,7 +37,7 @@ The next step is to package up your crate into a format that can be uploaded to
our entire crate and package it all up into a `*.crate` file in the
`target/package` directory.

```shell
```console
$ cargo package
```

Expand Down Expand Up @@ -87,7 +87,7 @@ Now that we’ve got a `*.crate` file ready to go, it can be uploaded to
[crates.io] with the `cargo publish` command. And that’s it, you’ve now published
your first crate!

```shell
```console
$ cargo publish
```

Expand Down Expand Up @@ -119,7 +119,7 @@ being broken for one reason or another (syntax error, forgot to include a file,
etc.). For situations such as this, Cargo supports a “yank” of a version of a
crate.

```shell
```console
$ cargo yank --vers 1.0.1
$ cargo yank --vers 1.0.1 --undo
```
Expand All @@ -142,7 +142,7 @@ A crate is often developed by more than one person, or the primary maintainer
may change over time! The owner of a crate is the only person allowed to publish
new versions of the crate, but an owner may designate additional owners.

```shell
```console
$ cargo owner --add my-buddy
$ cargo owner --remove my-buddy
$ cargo owner --add github:rust-lang:owners
Expand Down
6 changes: 3 additions & 3 deletions src/doc/src/reference/specifying-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ split out a separate crate for others to use. To do this Cargo supports **path
dependencies** which are typically sub-crates that live within one repository.
Let’s start off by making a new crate inside of our `hello_world` project:

```shell
```console
# inside of hello_world/
$ cargo new hello_utils
```
Expand Down Expand Up @@ -216,7 +216,7 @@ uuid = "1.0"
First thing we'll do is to clone the [`uuid` repository][uuid-repository]
locally via:

```shell
```console
$ git clone https://github.com/rust-lang-nursery/uuid
```

Expand Down Expand Up @@ -247,7 +247,7 @@ important to keep this in mind!

In any case, typically all you need to do now is:

```shell
```console
$ cargo build
Compiling uuid v1.0.0 (file://.../uuid)
Compiling my-library v0.1.0 (file://.../my-library)
Expand Down