Skip to content

Conversation

alexcrichton
Copy link
Member

This also inverts the dependency between libserialize and libcollections.

cc #8784

This also inverts the dependency between libserialize and libcollections.

cc rust-lang#8784
bors added a commit that referenced this pull request Feb 24, 2014
This also inverts the dependency between libserialize and libcollections.

cc #8784
@bors bors closed this Feb 25, 2014
@bors bors merged commit 6485917 into rust-lang:master Feb 25, 2014
@alexcrichton alexcrichton deleted the move-json branch February 25, 2014 05:34
fn encode(&self, s: &mut S) {
let mut bits = 0;
for item in self.iter() {
bits |= item.to_uint();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should've been 1 << item.to_uint().

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…hed-type, r=Veykril

feat: fix inline variable produce mismatched type

wrap reference for RefExpr initializer to fix rust-lang#12453
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 4, 2024
accept `String` in `span_lint*` functions directly to avoid unnecessary clones

context: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Accepting.20.60Into.3C.7BSub.7DdiagMessage.3E.60.20in.20.60span_lint*.60.20functions/near/425703273

tldr: the `span_lint*` functions now accept both `String`s, which are then reused and not recloned like before, and also `&'static str`, in which case it [doesn't need to allocate](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_error_messages/lib.rs.html#359).
Previously, it accepted `&str` and would always call `.to_string()`, which is worse in any case: it allocates for `&'static str` and forces a clone even if the caller already has a `String`.

---------

This PR has a massive diff, but the only interesting change is in the first commit, which changes the message/help/note parameter in the `span_lint*` functions to not take a `&str`, but an `impl Into<DiagMessage>`.

The second commit changes all of the errors that now occur:
- `&format!(...)` cannot be passed to `span_lint` anymore. Instead, we now simply pass `format!()` directly.
- `Into<DiagMessage>` can be `&'static str`, but not any `&str`. So this requires changing a bunch of other `&str` to `&'static str` at call sites as well.
- Added [`Sugg::into_string`](https://github.com/y21/rust-clippy/blob/9fc88bc2851fbb287d89f65b78fb67af504f8362/clippy_utils/src/sugg.rs#L362), which, as opposed to `Sugg::to_string`, can take advantage of the fact that it takes ownership and is able to reuse the `String`

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants