-
Notifications
You must be signed in to change notification settings - Fork 13.3k
A few cleanups and minor improvements to save_analysis #53927
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
Conversation
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -1608,8 +1605,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc | |||
} | |||
} | |||
ast::ExprKind::Closure(_, _, _, ref decl, ref body, _fn_decl_span) => { | |||
let mut id = String::from("$"); | |||
id.push_str(&ex.id.to_string()); | |||
let id = format!("${}", &ex.id); |
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.
the ampersand is unecessary
src/librustc_save_analysis/lib.rs
Outdated
@@ -210,7 +210,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { | |||
decl_id: None, | |||
docs: self.docs_for_attrs(&item.attrs), | |||
sig: sig::item_signature(item, self), | |||
attributes: lower_attributes(item.attrs.clone(), self), | |||
attributes: lower_attributes(item.attrs.to_owned(), 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.
seems weird to go from clone
to to_owned
. One wouldn't call to_owned
on a &String
, only on a &str
I think?
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.
Both variants are currently present in the file and I thought that to_owned()
would be preferable here, but I don't mind performing the change the other way around.
d14573d
to
9883dd7
Compare
Thanks for the review, comments addressed. |
@bors r+ rollup Thx for the quick fix |
📌 Commit 9883dd7 has been approved by |
A few cleanups and minor improvements to save_analysis - calculate the capacity of some `Vec`s - change`to_owned()` to `clone()` for the purposes of `lower_attributes` - remove a superfluous `clone()` - prefer `to_owned()` to `to_string()` - a few other minor improvements
☀️ Test successful - status-appveyor, status-travis |
Vec
sto_owned()
toclone()
for the purposes oflower_attributes
clone()
to_owned()
toto_string()