You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+14-28Lines changed: 14 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,16 +55,6 @@ Thank you! We'll try to respond as quickly as possible.
55
55
1. Install Rust using [rustup], which allows you to easily switch between Rust
56
56
versions. Diesel currently supports Rust Stable, Nightly, Rust Beta.
57
57
58
-
To run Diesel's test suite with _all_ supported features (extra
59
-
lints and compiletest), you should use the same nightly version as Diesel's
60
-
continuous integration. Find it by looking for a line like
61
-
`rust: nightly-2017-06-06` in the `.travis.yml` file. You can install and
62
-
set a custom nightly version for a project using
63
-
64
-
```
65
-
rustup override add nightly-2017-09-20
66
-
```
67
-
68
58
2. Install the system libraries needed to interface with the database systems
69
59
you wish to use.
70
60
@@ -113,38 +103,34 @@ Thank you! We'll try to respond as quickly as possible.
113
103
by executing `bin/test`. (Initially, this will take a while to compile
114
104
everything.)
115
105
116
-
- One thing to note is that this script runs Clippy checks by default.
117
-
Since this requires the nightly compiler, you can run the tests on stable with
118
-
the following:
119
-
```bash
120
-
bin/test
121
-
```
122
-
123
106
[rustup]: https://www.rustup.rs
124
107
125
108
### Coding Style
126
109
127
110
We follow the [Rust Style Guide](https://github.com/rust-lang-nursery/fmt-rfcs/blob/master/guide/guide.md), enforced using [rustfmt](https://github.com/rust-lang-nursery/rustfmt).
128
111
To run rustfmt tests locally:
129
112
130
-
1. Use rustup to set rust toolchain
131
-
to the nightly version specified in Diesel's [.travis.yml](./.travis.yml)
132
-
(see above).
113
+
1. Use rustup to set rust toolchain to the version specified in the
114
+
[rust-toolchain file](./rust-toolchain).
133
115
134
-
2. Install the nightly version of rustfmt used in
135
-
Diesel's continuous integration.
136
-
Look for and run the line from [.travis.yml](./.travis.yml) that looks like
116
+
2. Install the rustfmt and clippy by running
117
+
```
118
+
rustup component add rustfmt-preview
119
+
rustup component add clippy-preview
120
+
```
137
121
122
+
3. Run clippy using cargo from the root of your diesel repo.
138
123
```
139
-
cargo install rustfmt-nightly --vers x.x.x
124
+
cargo clippy
140
125
```
126
+
Each PR needs to compile without warning.
127
+
128
+
4. Run rustfmt using cargo from the root of your diesel repo.
141
129
142
-
3. Run rustfmt using cargo from the root of your diesel repo.
143
-
144
130
To see changes that need to be made, run
145
131
146
132
```
147
-
cargo fmt --all -- --write-mode=diff
133
+
cargo fmt --all -- --check
148
134
```
149
135
150
136
If all code is properly formatted (e.g. if you have not made any changes),
@@ -153,7 +139,7 @@ To run rustfmt tests locally:
153
139
you will see a diff between your code and properly formatted code.
154
140
If you see code here that you didn't make any changes to
155
141
then you are probably running the wrong version of rustfmt.
156
-
Once you are ready to apply the formatting changes, run
142
+
Once you are ready to apply the formatting changes, run
0 commit comments