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
Make some changes to the migration guide recommendations (#18794)
# Objective
- I've worked on the migration guide in the past, so I've written down
some of the conventions and styles I've used.
## Solution
Please read through the descriptions of each commit, which justify the
change! In summary:
- Remove headings from migration guide template by moving style guide to
`migration_guides.md`
- Use parentheses to signal method and function names (`my_func()`
instead of `my_func`)
- Change the guidelines on using bullet points so they're not used for
every single migration guide.
- Remove suggestion to use diff blocks, as they don't syntax-highlight
Rust code.
---------
Co-authored-by: Rob Parrett <[email protected]>
Co-authored-by: Miles Silberling-Cook <[email protected]>
Co-authored-by: Alice Cecile <[email protected]>
Copy file name to clipboardExpand all lines: release-content/migration_guides.md
+45Lines changed: 45 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -55,3 +55,48 @@ However, it's not always possible to use this attribute, and Bevy does not consi
55
55
#[deprecated(since ="0.17.0", note ="This message will appear in the deprecation warning.")]
56
56
structMyStruct;
57
57
```
58
+
59
+
## Style Guide
60
+
61
+
Keep it short and sweet:
62
+
63
+
- What, then why, then how to migrate.
64
+
- Some helpful standardized phrases:
65
+
-`OldType` is now `NewType`. Replace all references and imports.
66
+
- The `Struct::method` method now requires an additional `magnitude: f32` argument.
67
+
-`Enum` has a new variant, `Enum::NewVariant`, which must be handled during `match` statements.
68
+
- The `Type::method` method has been removed. Use `Type::other_method` instead.
69
+
- The `crate::old_module` module is now `crate::new_module`. Update your imports.
70
+
-`function` now returns `Option<String>` instead of `String`.
71
+
- Make sure it's searchable by directly naming the types and methods involved.
72
+
- Use backticks for types, methods, and modules (e.g. `Vec<T>` or `core::mem::swap`).
73
+
- Use bullet points when listing affected types / functions of a breaking change, or when the listing several complex steps for migrating. Avoid bullets for simple migrations, however.
74
+
- Avoid headings. If you must, use only level-two (`##`) headings.
75
+
- It's often useful to give a code example explaining what a migration may look like.
76
+
77
+
```rust
78
+
// 0.15
79
+
fnmy_system(world:&mutWorld) {
80
+
world.old_method();
81
+
}
82
+
83
+
// 0.16
84
+
fnmy_system(world:&mutWorld) {
85
+
// Use `new_method()` instead.
86
+
world.new_method();
87
+
}
88
+
```
89
+
90
+
Often you will want to give two examples of the same piece of code, one for the old version and one for the new. You can designate which is which using comments, such as `// 0.15` and `// 0.16`. Avoid code diffs if possible, as they do not syntax highlight Rust code.
91
+
92
+
- Make sure to reference the currently published version of a crate when writing a migration guide.
93
+
See [docs.rs](https://docs.rs/) for a quick reference to the existing public API.
94
+
- When moving items to a new module or crate, consider a simple table listing
95
+
the moved items and the before and after paths.
96
+
For example, "`Foo` has been moved from `bar::foo` to `baz`" could be written:
0 commit comments