Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path::normalize and // #3430

Closed
jesse99 opened this issue Sep 8, 2012 · 0 comments
Closed

path::normalize and // #3430

jesse99 opened this issue Sep 8, 2012 · 0 comments

Comments

@jesse99
Copy link
Contributor

jesse99 commented Sep 8, 2012

Posix pahs like "/foo//bar" should be normalized to "/foo/bar". (WIndows likely has similar issues). Here is a test case:

// rustc --test normalize.rs && ./normalize
use std;
use Path = path::Path;

macro_rules! assert_equal (($expected: expr, $actual: expr) => 
{
    let a = $actual;        // only evaluate the expressions once
    let e = $expected;
    if a != e
    {
        fail fmt!("Found '%?', but expected '%?'", a, e);
    }
})

// TODO: add a windows version of this
#[cfg(unix)]
fn root() -> Path
{
    path::from_str(~"/tmp/")
}

#[test]
fn tester()
{
    let path = root();
    let path = path.push("/hmm");
    let path = path.normalize();
    assert_equal!(~"/tmp/hmm", path.to_str());
}
flip1995 pushed a commit to flip1995/rust that referenced this issue May 17, 2020
identity_op: allow `1 << 0`

I went for accepting `1 << 0` verbatim instead of something more general as it seems to be what everyone in the issue thread needed.

changelog: identity_op: allow `1 << 0` as it's a common pattern in bit manipulation code.

Fixes rust-lang#3430
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
fix not to remove comment in the case of no arg
RalfJung pushed a commit to RalfJung/rust that referenced this issue Mar 31, 2024
make some doc comments not doc tests

`./miri test --doc` will run doctests even if we have them disabled (that's a cargo quirk: rust-lang/cargo#13668). This fixes that command to not fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants