actix / actix/actix-web

ResponseError requires Debug + Display, but it seems unnecessary

Aperta
#3,866 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
24.8k
Fork
1.9k
Merge medio
23h 10m
PR unite (30g)
26

Descrizione

Currently ResponseError is defined as:

```
// TODO: flesh out documentation
pub trait ResponseError: fmt::Debug + fmt::Display {
```

However I see no real reason why it requires Display, or even Debug.

The default implementation indeed requires Display:

```
let _ = write!(helpers::MutWriter(&mut buf), "{}", self);
```

However this means that we cannot implement ResponseError for any types that don't implement Display and Debug, which is cumbersome, because sometimes I just want to return a static string without relying on whether the type implements Debug or Display, and even if it does, I don't really intend to use it.

Not sure what the correct way would be to leave the default implementation as is, but also allow non-display, non-debug types to implement it.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.