Stream: rustdoc

Topic: Best typo of the night


view this post on Zulip Joshua Nelson (Dec 14 2020 at 23:32):

    // The trailing space after each tag is to space it properly against the rest of the docs.
    if let Some(depr) = &item.deprecation {
        let since = match derp.since { ... };

view this post on Zulip Joshua Nelson (Dec 14 2020 at 23:33):

also, someone please tell me there's a simpler way to get Option<&str> from Option<Symbol>

        let symbol;
        let since = match depr.since {
            Some(s) => {
                symbol = s.as_str();
                Some(&*symbol)
            }
            None => None,
        };

view this post on Zulip Noah Lev (Dec 15 2020 at 02:55):

Does this work? It's a bit better:

        let symbol;
        let since = depr.since.map(|s| { symbol = s.as_str(); Some(&*symbol) })

view this post on Zulip Joshua Nelson (Dec 15 2020 at 03:01):

no, but this does :)

        if !stability::deprecation_in_effect(
            depr.is_since_rustc_version,
            depr.since.map(|s| s.as_str()).as_deref(),
        ) {

Last updated: Oct 11 2021 at 22:34 UTC