« first day (834 days earlier)      last day (2641 days later) » 

12:27 AM
0
Q: Allow unused named arguments in Rust's format!() family

набиячлэвэлиFor example, given: format!("{red}{}{reset}", "text", red = "RED", blue = "BLUE", reset = "RESET"); rustc exits with an error: error: named argument never used --> example.rs:1:47 | 30 | format!("{red}{}{reset}", "text", red = "RED", blue = "BLUE", reset = "RESET"); | ...

 
12:54 AM
According to the docs:
> Like with positional parameters, it is not valid to provide named parameters that are unused by the format string.
 
1:29 AM
Another "I don't care if this is a duplicate, I can't copy-paste the code"
sigh
I thought that OP was better
 
> >OP
> >better
 
 
14 hours later…
3:11 PM
@Shepmaster link?
 
0
Q: How to add code only for specific Rust version?

antoyoI use a method that appeared in Rust 1.10 for my tests but I want my crate to also work with version 1.7. Is there a way (something like attribute #[cfg(min_version="1.10")]) to specify code that should only run in Rust 1.10 or newer?

 
@Shepmaster Thanks :)
 
3:49 PM
Sometimes, I wish I could just add two answers to a question:
> Yes
> No
And see which one gets upvoted more.
 
I totally enjoy seeing those. :D
 
4:11 PM
Hmm, I though you couldn't have something Sync + !Send.
 
5:04 PM
Trust @Shepmaster to make my answer look silly by removing stuff instead of adding!
 
@ChrisEmerson <3
> Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away
 
@Shepmaster I totally agree; my most favourite bug fixes remove more code than they add.
But I also don't yet understand why your version isn't equivalent to the OP's.
 
 
1 hour later…
6:32 PM
@ChrisEmerson I tried to reply to your comment stackoverflow.com/a/41854380/155423
 
7:04 PM
Thanks.
Are you sure about that "extra lifetime"? My theory about the elision rules would also explain that (ie tied to the closure's implicit &self parameter).
It sounds to me like it's to do with the magic closure inference rules (which I think (a) are more magical than for functions and (b) something I need to understand more),
I may not have got exactly the right answerm but I've learned stuff already, which makes me happy!
 

« first day (834 days earlier)      last day (2641 days later) »