Skip to content

Missing impl<'a> PartialEq<&'a str> for OsString #49854

Closed
@Kixunil

Description

@Kixunil
Contributor

I've just got very surprised to find out that my_os_string == "foo" doesn't compile, but my_os_string == *"foo" does. After some investigation, I found that impl<'a> PartialEq<&'a str> for OsString is missing. Similar impl is present for String though.

I believe it'd be nice to implement it.

Activity

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
on Apr 11, 2018
csmoe

csmoe commented on Apr 13, 2018

@csmoe
Member

&OsStr is to OsString as &str is to String, so check out impl<'a, 'b> PartialEq<&'a OsStr> for OsString, this implementation might meet your needs.

Kixunil

Kixunil commented on Apr 19, 2018

@Kixunil
ContributorAuthor

@csmoe I've soled my problem immediately. I filed issue because I think we could help others by implementing the trait.

added
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
C-feature-acceptedCategory: A feature request that has been accepted pending implementation.
and removed
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
on May 27, 2018
added a commit that references this issue on Jun 30, 2018

Rollup merge of rust-lang#51178 - GabrielMajeri:os-str-compare, r=Sim…

12247fd
added a commit that references this issue on Jun 30, 2018

Auto merge of #51178 - GabrielMajeri:os-str-compare, r=SimonSapin

87ecf54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-acceptedCategory: A feature request that has been accepted pending implementation.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @Kixunil@pietroalbini@Mark-Simulacrum@csmoe

      Issue actions

        Missing `impl<'a> PartialEq<&'a str> for OsString` · Issue #49854 · rust-lang/rust