diff options
Diffstat (limited to 'src/docs/box_default.txt')
| -rw-r--r-- | src/docs/box_default.txt | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/docs/box_default.txt b/src/docs/box_default.txt deleted file mode 100644 index 1c670c77333..00000000000 --- a/src/docs/box_default.txt +++ /dev/null @@ -1,17 +0,0 @@ -### What it does -checks for `Box::new(T::default())`, which is better written as -`Box::<T>::default()`. - -### Why is this bad? -First, it's more complex, involving two calls instead of one. -Second, `Box::default()` can be faster -[in certain cases](https://nnethercote.github.io/perf-book/standard-library-types.html#box). - -### Example -``` -let x: Box<String> = Box::new(Default::default()); -``` -Use instead: -``` -let x: Box<String> = Box::default(); -``` \ No newline at end of file |
