Skip to content

Apparent inconsistency in documented behavior of `is_not #1280

@Lucretiel

Description

@Lucretiel

The documentation for is_not includes this line:

It will return a Err::Error(("", ErrorKind::IsNot)) if the pattern wasn't met.

This seems to imply that, for is_not to succeed, the pattern must be present as a terminator. However, it also includes this example code:

assert_eq!(not_space("Nospace"), Ok(("", "Nospace")));
assert_eq!(not_space(""), Err(Err::Error(Error::new("", ErrorKind::IsNot))));

I'd expect the former case to fail the test, since there's no terminator present. It strikes me as a bit inconsistent that is_not will successfully match a non-empty string without the terminator, but will reject an empty string with the terminator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions