It deliberately deletes everything after the occurence of //. I imagine this is a very blunt workaround to prevent comments on the last line from shadowing the closing brackets });}. However, this is much better done by just putting the user input into their own lines:
This bug peculiarity just cost me about 10 minutes of headaches because I couldn't figure out why this snippet of code complained about lifetimes:
let strings = vec!["zone", "abigail", "theta", "form", "libe", "zas", "theta", "abigail"];
let k = 2;
strings
.windows(k)
.rev() // prefer first match instead of last
.max_by_key(|window| window.iter().map(|string| string.len()).sum::<usize>())
.unwrap()
.join("")
Also
On that note, might as well get the formatting correct once and for all. You could replace
Bug description
I thought this was a bug, but apparently it's a feature...?
https://github.com/ivandardi/RustbotPython/blob/25ecd0eaf663afc51307288f0072d18ed1688841/bot/cogs/playground.py#L76-L83
It deliberately deletes everything after the occurence of
//
. I imagine this is a very blunt workaround to prevent comments on the last line from shadowing the closing brackets});}
. However, this is much better done by just putting the user input into their own lines:Why fix this
This
bugpeculiarity just cost me about 10 minutes of headaches because I couldn't figure out why this snippet of code complained about lifetimes:Also
On that note, might as well get the formatting correct once and for all. You could replace
with
That way, error messages will have nicely formatted code (right) instead of the ugly minified code (left)