-
Notifications
You must be signed in to change notification settings - Fork 26
Further simplify and explain crate id mapping #103
Conversation
c15b24a to
8a802c8
Compare
nrc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from one of the Clippy changes
src/analysis.rs
Outdated
| pub fn new() -> Analysis { | ||
| Analysis { | ||
| pub fn new() -> Self { | ||
| Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change - it adds an annoying level of indirection for the reader
src/lib.rs
Outdated
| SymbolResult { | ||
| id: id, | ||
| fn new(id: Id, def: &Def) -> Self { | ||
| Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/lib.rs
Outdated
| pub fn new(target: Target) -> AnalysisHost { | ||
| AnalysisHost { | ||
| pub fn new(target: Target) -> Self { | ||
| Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here and below...
8a802c8 to
6c28fe8
Compare
| impl<L: AnalysisLoader> AnalysisHost<L> { | ||
| pub fn new_with_loader(l: L) -> AnalysisHost<L> { | ||
| AnalysisHost { | ||
| pub fn new_with_loader(loader: L) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this Self okay here? In case of generic types I think it is less noisy and quickly allows to see that the returned generic type is the same as ours
|
Updated, let me know if anything else also needs changing |
This addresses some Clippy lints, simplifies a bit, but most importantly, explains more the local -> global crate id mapping, which I couldn't understand at first. I hope this makes it a bit more easy to understand.