ariadne
ariadne copied to clipboard
Remove redundant setters in the report builder.
The ReportBuilder type has a bunch of duplicate setter functions that call their counterpart (set_message and with_message, set_note and with_note, etc).
It might be a good idea to remove these redundant setters as they needlessly complicate the interface of this type.
Hm... in general I understand why both versions exist, but on the other hand, I also agree that most people are probably using only one "creating-version" for the builder and I'd even say, that most people would use the building-pattern (I don't know the name of it) but I mean this one:
Report::build(...)
.with_message(...)
.with_note(...)
// and so on
I disagree that the functions are redundant. Creating a report inline and modifying an existing report are two conceptually distinct operations.
set_xxx() methods are quite useful for inline mutation of the builder, particularly within loops(including fold iterator).
let mut report_builder = Report::build(...);
for my_error in errors {
report_builder.add_label(Label::new(...));
}
report_builder.finish();
Yep, they're two different use-cases. I'll close this now.