about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-11-06 20:29:41 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-11-06 20:29:41 +0100
commit9b1d4cc8abdd756f6a46e220a278c012846bb56a (patch)
treefc1ef378430afd0e08de576b84b7208d34dd7a01 /docs/dev
parent0d5be44b6e0ccd3e806697dcfc2337a2c0ed5914 (diff)
downloadrust-9b1d4cc8abdd756f6a46e220a278c012846bb56a.tar.gz
rust-9b1d4cc8abdd756f6a46e220a278c012846bb56a.zip
don\t indent tests
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/style.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index 8d57fc04983..1a952197fe1 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -89,6 +89,32 @@ There are many benefits to this:
 It also makes sense to format snippets more compactly (for example, by placing enum definitions like `enum E { Foo, Bar }` on a single line),
 as long as they are still readable.
 
+When using multiline fixtures, use unindented raw string literals:
+
+```rust
+    #[test]
+    fn inline_field_shorthand() {
+        check_assist(
+            inline_local_variable,
+            r"
+struct S { foo: i32}
+fn main() {
+    let <|>foo = 92;
+    S { foo }
+}
+",
+            r"
+struct S { foo: i32}
+fn main() {
+    S { foo: 92 }
+}
+",
+        );
+    }
+```
+
+That way, you can use your editor's "number of selected characters" feature to correlate offsets with test's source code.
+
 ## Preconditions
 
 Express function preconditions in types and force the caller to provide them (rather than checking in callee):