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

Update Rust crate path-slash to 0.2 #74

Merged
merged 2 commits into from Dec 1, 2022
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 5, 2022

Mend Renovate

This PR contains the following updates:

Package Type Update Change
path-slash dependencies minor 0.1 -> 0.2
path-slash dev-dependencies minor 0.1 -> 0.2

Release Notes

rhysd/path-slash

v0.2.1

Compare Source

  • Added CowExt::to_slash and Cow::to_slash_lossy. PathExt is no longer necessary to convert Cow<'a, Path> paths into slash paths.
  • Clarified minimum supported Rust version. Rust 1.38 or later is supported. rust-version field in Cargo.toml was added so that cargo can check the MSRV is met.
  • Improved documents of trait methods. The documents were moved from implementations of the trait methods to definitions of them so that users can find out the documents more easily. Documents for implementations are folded by default, but definitions aren't.

[Changes][v0.2.1]

v0.2.0

Compare Source

  • BREAKING: to_slash and to_slash_lossy return Cow<'_, str> instead of String. Now heap allocation hapnens only when path separator is replaced. On Unix-like OS, almost all heap allocations can be removed by this change. Migrating from 0.1 to 0.2 is quite easy by adding Cow::into_owned call. If &str is sufficient for your use case, Cow::as_ref is better to avoid heap allocation. (#​9)
    use path_slash::PathExt as _;
    
    // 0.1
    let s: Option<String> = Path::new("/a/b").to_slash();
    let s: String = Path::new("/a/b").to_slash_lossy();
    // 0.2
    let s: Option<String> = Path::new("/a/b").to_slash().map(Cow::into_owned);
    let s: String = Path::new("/a/b").to_slash_lossy().into_owned();
    API changes are as follows:
    • 0.1.5
      • Path::to_slash(&self) -> Option<String>
      • Path::to_slash_lossy(&self) -> String
    • 0.2.0
      • Path::to_slash(&self) -> Option<Cow<'_, Path>>
      • Path::to_slash_lossy(&self) -> Cow<'_, Path>
  • BREAKING: Fix inconsistency on Windows and on Unix-like OS in terms of trailing slash in path. Now a trailing slash in path is always preserved. (#​10)
    // 0.1
    #[cfg(target_os = "windows")]
    assert_eq!(Path::new(r"\a\b\").to_slash_lossy(), "/a/b"); // Trailing slash is removed
    #[cfg(not(target_os = "windows"))]
    assert_eq!(Path::new("/a/b/").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
    
    // 0.2
    #[cfg(target_os = "windows")]
    assert_eq!(Path::new(r"\a\b\").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
    #[cfg(not(target_os = "windows"))]
    assert_eq!(Path::new("/a/b/").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
  • New API path_slash::CowExt is added to extend Cow<'_, Path>. Its methods convert slash paths into Cow<'_, Path>. It is useful to avoid heap allocations as much as possible compared with PathBufExt. See the API document for more details. (#​9)
    use path_slash::CowExt as _;
    let p = Cow::from_slash("foo/bar/piyo.txt"); // Heap allocation only happens on Windows
    
    #[cfg(target_os = "windows")]
    assert_eq!(p, Cow::Owned(PathBuf::from(r"foo\bar\piyo.txt")));
    #[cfg(not(target_os = "windows"))]
    assert_eq!(p, Cow::Borrowed(Path::new("foo/bar/piyo.txt")));
    All methods added by importing CowExt are as follows:
    • Cow::<Path>::from_slash(s: &str) -> Self
    • Cow::<Path>::from_slash_lossy(s: &OsStr) -> Self
    • Cow::<Path>::from_backslash(s: &str) -> Self
    • Cow::<Path>::from_backslash_lossy(s: &OsStr) -> Self
  • More tests are added. Now the line coverage is 100%.
    • UTF-16 test cases for native encoding on Windows
    • All error cases including broken UTF-8 and UTF-16 sequences

[Changes][v0.2.0]

v0.1.5

Compare Source

  • Add new APIs to convert backslash paths to PathBuf. (#​8, thanks @​picobyte)
    • PathBuf::from_backslash converts &str into PathBuf with replacing \ on non-Windows OS
    • PathBuf::from_backslash_lossy converts &OsStr into PathBuf with replacing \ on non-Windows OS

[Changes][v0.1.5]

v0.1.4

Compare Source

  • Fix a final letter of paths with some verbatim prefixes was removed (#​5)

[Changes][v0.1.4]

v0.1.3

Compare Source

  • Fix documentation (#​4)

[Changes][v0.1.3]

v0.1.2

Compare Source

  • Fix: Root path separator was doubled when the path contains Windows driver letter. For example, when C:/foo was given, to_slash converted it to C:\\foo. In this version it converts it to C:\foo correctly.
  • Improve: Remove a redundant allocation at calling to_slash() method.

Changes

v0.1.1

Compare Source


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the renovate Renovate bot label Jul 5, 2022
@renovate renovate bot force-pushed the renovate/path-slash-0.x branch 2 times, most recently from 70b589a to 3f6b19f Compare November 21, 2022 10:30
@renovate
Copy link
Contributor Author

renovate bot commented Nov 29, 2022

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.
You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Merging #74 (67167dd) into main (084352b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #74   +/-   ##
=======================================
  Coverage   84.42%   84.42%           
=======================================
  Files          81       81           
  Lines       14569    14570    +1     
=======================================
+ Hits        12300    12301    +1     
  Misses       2269     2269           
Impacted Files Coverage Δ
crates/ditto-make/src/build_ninja.rs 94.95% <100.00%> (ø)
crates/ditto-make/src/compile.rs 50.00% <100.00%> (+0.15%) ⬆️
crates/ditto-make/src/utils.rs 94.11% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jmackie jmackie merged commit 2d3921d into main Dec 1, 2022
@jmackie jmackie deleted the renovate/path-slash-0.x branch December 1, 2022 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
renovate Renovate bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant