]> git.lizzy.rs Git - rust.git/blobdiff - Contributing.md
Remove various feature flags
[rust.git] / Contributing.md
index 4bc3aa7ce8dc665ccaa12bf82e97f25be08934b7..bbd736ec98f5aed7a0e672ad5c878473fb6b3386 100644 (file)
@@ -6,6 +6,8 @@ contributing or need help with anything, please ping nrc on irc, #rust-dev-tools
 on irc.mozilla.org is probably the best channel. Feel free to also ask questions
 on issues, or file new issues specifically to get help.
 
+All contributors are expected to follow our [Code of
+Conduct](CODE_OF_CONDUCT.md).
 
 ## Test and file issues
 
@@ -62,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!
 
@@ -106,7 +111,7 @@ format.
 There are different nodes for every kind of item and expression in Rust. For
 more details see the source code in the compiler -
 [ast.rs](https://dxr.mozilla.org/rust/source/src/libsyntax/ast.rs) - and/or the
-[docs](http://manishearth.github.io/rust-internals-docs/syntax/ast/index.html).
+[docs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast/index.html).
 
 Many nodes in the AST (but not all, annoyingly) have a `Span`. A `Span` is a
 range in the source code, it can easily be converted to a snippet of source
@@ -151,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
 
 ```
@@ -193,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
@@ -201,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