diff options
Diffstat (limited to 'src/tools/clippy/src/docs/result_large_err.txt')
-rw-r--r-- | src/tools/clippy/src/docs/result_large_err.txt | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/tools/clippy/src/docs/result_large_err.txt b/src/tools/clippy/src/docs/result_large_err.txt deleted file mode 100644 index e5fab3c5c..000000000 --- a/src/tools/clippy/src/docs/result_large_err.txt +++ /dev/null @@ -1,36 +0,0 @@ -### What it does -Checks for functions that return `Result` with an unusually large -`Err`-variant. - -### Why is this bad? -A `Result` is at least as large as the `Err`-variant. While we -expect that variant to be seldomly used, the compiler needs to reserve -and move that much memory every single time. - -### Known problems -The size determined by Clippy is platform-dependent. - -### Examples -``` -pub enum ParseError { - UnparsedBytes([u8; 512]), - UnexpectedEof, -} - -// The `Result` has at least 512 bytes, even in the `Ok`-case -pub fn parse() -> Result<(), ParseError> { - Ok(()) -} -``` -should be -``` -pub enum ParseError { - UnparsedBytes(Box<[u8; 512]>), - UnexpectedEof, -} - -// The `Result` is slightly larger than a pointer -pub fn parse() -> Result<(), ParseError> { - Ok(()) -} -```
\ No newline at end of file |