]> git.lizzy.rs Git - rust.git/blobdiff - Contributing.md
Remove various feature flags
[rust.git] / Contributing.md
index 527041ab73748ddf41006da91fc490766d822dd3..bbd736ec98f5aed7a0e672ad5c878473fb6b3386 100644 (file)
@@ -64,6 +64,9 @@ would need a configuration file named `test-indent.toml` in that directory. As a
 example, the `issue-1111.rs` test file is configured by the file
 `./tests/config/issue-1111.toml`.
 
+## Debugging
+
+Some `rewrite_*` methods use the `debug!` macro for printing useful information. These messages can be printed by using the environment variable `RUST_LOG=rustfmt=DEBUG`. These traces can be helpful in understanding which part of the code was used and get a better grasp on the execution flow.
 
 ## Hack!
 
@@ -153,6 +156,8 @@ which is how much we are currently indented from the lhs of the page. We also
 take a context which contains information used for parsing, the current block
 indent, and a configuration (see below).
 
+##### Rewrite and Indent
+
 To understand the indents, consider
 
 ```
@@ -195,6 +200,8 @@ checked subtraction: `available_space = budget.checked_sub(overhead)?`.
 `checked_sub` returns an `Option`, and if we would underflow `?` returns
 `None`, otherwise we proceed with the computed space.
 
+##### Rewrite of list-like expressions
+
 Much syntax in Rust is lists: lists of arguments, lists of fields, lists of
 array elements, etc. We have some generic code to handle lists, including how to
 space them in horizontal and vertical space, indentation, comments between
@@ -203,9 +210,11 @@ code is a bit complex. Look in [src/lists.rs](src/lists.rs). `write_list` is the
 and `ListFormatting` the key structure for configuration. You'll need to make a
 `ListItems` for input, this is usually done using `itemize_list`.
 
+##### Configuration
+
 Rustfmt strives to be highly configurable. Often the first part of a patch is
 creating a configuration option for the feature you are implementing. All
-handling of configuration options is done in [src/config.rs](src/config.rs). Look for the
+handling of configuration options is done in [src/config/mod.rs](src/config/mod.rs). Look for the
 `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