]> git.lizzy.rs Git - rust.git/blobdiff - Contributing.md
Move Indent and Shape to shape.rs from lib.rs
[rust.git] / Contributing.md
index 50b489cc1300d402f370f742518f2419b6c7444f..730cefdca45490bdbc12d1dc01d330d23ee883f0 100644 (file)
@@ -44,17 +44,23 @@ colourised diff will be printed so that the offending line(s) can quickly be
 identified.
 
 Without explicit settings, the tests will be run using rustfmt's default
-configuration. It is possible to run a test using non-default settings by
-including configuration parameters in comments at the top of the file. For
-example: to use 3 spaces per tab, start your test with
+configuration. It is possible to run a test using non-default settings in several 
+ways. Firstly, you can include configuration parameters in comments at the top
+of the file. For example: to use 3 spaces per tab, start your test with
 `// rustfmt-tab_spaces: 3`. Just remember that the comment is part of the input,
 so include in both the source and target files! It is also possible to
 explicitly specify the name of the expected output file in the target directory.
-Use `// rustfmt-target: filename.rs` for this. Finally, you can use a custom
+Use `// rustfmt-target: filename.rs` for this. You can also specify a custom
 configuration by using the `rustfmt-config` directive. Rustfmt will then use
 that toml file located in `./tests/config/` for its configuration. Including
 `// rustfmt-config: small_tabs.toml` will run your test with the configuration
-file found at `./tests/config/small_tabs.toml`.
+file found at `./tests/config/small_tabs.toml`. The final option is used when the
+test source file contains no configuration parameter comments. In this case, the
+test harness looks for a configuration file with the same filename as the test
+file in the `./tests/config/` directory, so a test source file named `test-indent.rs`
+would need a configuration file named `test-indent.toml` in that directory. As an
+example, the `issue-1111.rs` test file is configured by the file
+`./tests/config/issue-1111.toml`.
 
 
 ## Hack!
@@ -201,6 +207,6 @@ handling of configuration options is done in [src/config.rs](src/config.rs). Loo
 `create_config!` macro at the end of the file for all the options. The rest of
 the file defines a bunch of enums used for options, and the machinery to produce
 the config struct and parse a config file, etc. Checking an option is done by
-accessing the correct field on the config struct, e.g., `config.max_width`. Most
+accessing the correct field on the config struct, e.g., `config.max_width()`. Most
 functions have a `Config`, or one can be accessed via a visitor or context of
 some kind.