Rust can be not so boring languge as Some(may think)

⚓ Rust    📅 2025-09-14    👤 surdeus    👁️ 14      

surdeus

Warning

This post was published 128 days ago. The information described in this article may have changed.

Today is Saturday, so we can stop fighting with the borrow checker over the weekend and have a little laugh, because rustc is a humorous. Some trait in some crate got changed, so Rust compiler gave me an error but also gave me a help:

help: change the output type to match the trait
   |
12 -     fn main_load(&self) -> Result<String, String> {
12 +     fn main_load(&self) -> Result<String, Box<(dyn std::error::Error + 'static)>> {
   |

Oh, great, thank you Rust compiler, and applied the help:
But what???

warning: unnecessary parentheses around type
  --> rust/upload.rs:12:47
   |
12 |     fn main_load(&self) -> Result<String, Box<(dyn std::error::Error + 'static)>> {
   |                                               ^                               ^
   |
   = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
   |
12 -     fn main_load(&self) -> Result<String, Box<(dyn std::error::Error + 'static)>> {
12 +     fn main_load(&self) -> Result<String, Box<dyn std::error::Error + 'static>> {
   |

Did you check me on a knowledge of Rust syntax, or just a little joking?

1 post - 1 participant

Read full topic

🏷️ Rust_feed