You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to Rust, so it's possible I'm doing something wrong, but I can't get std::getopt::opts_str to work for any argument but the first one given (I'm running Rust 0.6). I've tried some other permutations, but here's a minimal test case:
extern mod std;
use std::getopts::*;
fn main() {
let args = os::args();
let opts = ~[
optopt("a"), optopt("arg")
];
let matches = match getopts(vec::tail(args), opts) {
result::Ok(m) => { m }
result::Err(f) => { io::println(fail_str(f)); return }
};
if opts_present(&matches, [~"a", ~"arg"]) {
io::println(fmt!("Argument `%s`", opts_str(&matches, [~"a", ~"arg"])));
return;
}
}
and here's the output of some invocations (the expected result would be for the second line to output the same as first):
% rustc test.rs
% ./test -a foo
Argument `foo`
% ./test --arg foo
rust: task failed at 'index out of bounds: the len is 0 but the index is 0', /home/aaron/Downloads/rust-0.6/src/libstd/getopts.rs:360
The text was updated successfully, but these errors were encountered:
Add Clippy version to Clippy's lint list
Hey, hey, the semester is finally over, and I wanted to get back into hacking on Clippy. It has also been some time since our metadata collection monster has been feed. So, this PR adds a new attribute `clippy::version` to document which version a lint was stabilized. I considered using `git blame` but that would be very hacky and probably not accurate.
I'm also thinking that this attribute can be used to have a `clippy::nightly` lint group which is allow-by-default that delays setting the actual lint group until the defined version is reached. Just something to consider regarding rust-lang#6623 🙃
This PR only adds the version to 4 lints to keep it reviewable. I'll do a followup PR to add the version to other lints if the implementation is accepted 🙃

Also, mobile approved xD

---
r? `@flip1995`
cc: rust-lang#7172closes: rust-lang#6492
changelog: [Clippy's lint list](https://rust-lang.github.io/rust-clippy/master/index.html) now displays the version a lint was added. 🎉
---
Example lint declaration after this update:
```rs
declare_clippy_lint! {
/// [...]
///
/// ### Example
/// ```rust
/// // Bad
/// let x = 3.14;
/// // Good
/// let x = std::f32::consts::PI;
/// ```
#[clippy::version = "pre 1.29.0"]
pub APPROX_CONSTANT,
correctness,
"the approximate of a known float constant (in `std::fXX::consts`)"
}
```
I'm new to Rust, so it's possible I'm doing something wrong, but I can't get std::getopt::opts_str to work for any argument but the first one given (I'm running Rust 0.6). I've tried some other permutations, but here's a minimal test case:
and here's the output of some invocations (the expected result would be for the second line to output the same as first):
The text was updated successfully, but these errors were encountered: