-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Suggest removing Box::new instead of unboxing it #146259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
vec![ | ||
(expr.span.until(arg.span), "".to_string()), | ||
( | ||
expr.span.with_lo(expr.span.hi() - BytePos(1)), |
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.
Does your code crash on this?
fn main() {
let _: String = Box::new(String::new()❩;
}
I've replaced the final )
(U+0028) with ❩
(U+2769). CC #128790.
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.
Hmm, I didn't want to use the argument span since it could be a parent or child expansion...
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.
If you want to keep basing things off of expr.span
, consider using one of SourceMap::{start,end,next}_point
or similar.
Otherwise, shouldn't you be able to use things like find_ancestor_inside{,_same_ctxt}
?
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.
Fixed
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.
Oh I saw your next comment after a refresh. end_point
is good!
Otherwise, shouldn't you be able to use things like
find_ancestor_inside{,_same_ctxt}
?
That would work if the arg is a child expansion, but not if it's a parent. -- Box::new($x)
dc5423d
to
be71edc
Compare
be71edc
to
09dca95
Compare
No description provided.