Peter Jaszkowiak

Results 312 comments of Peter Jaszkowiak

Just concerning implementation: Should it not instead shrink to the smallest possible power of two capacity? I think "shrink to `len.next_power_of_two()`" is a much easier and less arbitrary algorithm. It...

Agreed, can someone produce an example case where this would become accidentally quadratic?

But in that case, it's not quadratic overall - the shrinking would happen once at most, the rest of the time the "capacity double length" condition is not met for...

I don't disagree. To be clear, I would propose something like this ```rust if (cap - len) > cmp::max(len, MIN_NON_ZERO_CAP) { self.shrink_to(len.next_power_of_two()); } ```

Yeah calling these all permissions feels wrong. `readonly` feels a lot more like a permission than those other two attributes. What about a `std::os::windows::fs::FileExt`? ```rust trait FileExt { fn attributes(&mut...

You can use `rustc_allow_incoherent_impl` to add those inherent functions in std.

Generally you'd give it a feature name with "internal" in there somewhere and not provide an issue number. Like this: https://github.com/rust-lang/rust/blob/334e509912d82323ff0fca016a2e69dbbee559fd/library/core/src/panicking.rs#L25

Should probably take `this: &Self` instead, like `force`, in order to entirely avoid deref conflicts. That's how `Lock::get` works. Some other name options: - `try_deref` - `try_as_ref` - `try_ref` -...