Skip to content

Commit

Permalink
Rollup merge of #80016 - jyn514:imports, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Use imports instead of rewriting the type signature of `RustcOptGroup::stable`

This was an adventure; see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/'higher.20ranked.20subtype.20error'

r? `@GuillaumeGomez`
  • Loading branch information
GuillaumeGomez committed Dec 15, 2020
2 parents a2fcdc4 + 4c1addf commit 6990419
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,9 @@ fn get_args() -> Option<Vec<String>> {
.collect()
}

fn stable<F>(name: &'static str, f: F) -> RustcOptGroup
where
F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{
RustcOptGroup::stable(name, f)
}

fn unstable<F>(name: &'static str, f: F) -> RustcOptGroup
where
F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{
RustcOptGroup::unstable(name, f)
}

fn opts() -> Vec<RustcOptGroup> {
let stable: fn(_, fn(&mut getopts::Options) -> &mut _) -> _ = RustcOptGroup::stable;
let unstable: fn(_, fn(&mut getopts::Options) -> &mut _) -> _ = RustcOptGroup::unstable;
vec![
stable("h", |o| o.optflag("h", "help", "show this help message")),
stable("V", |o| o.optflag("V", "version", "print rustdoc's version")),
Expand Down

0 comments on commit 6990419

Please sign in to comment.