Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

String roundup part 1 #1732

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open

Commits on Sep 7, 2019

  1. Rewrite &PathBufs in signatures to &Paths

    Taking &PathBufs is like taking &Strings, if you can't extend it because
    it's not mutable, there's no use making sure it's on the heap. Taking
    &Paths or &strs is simply more flexible to the caller without losing
    anything for the procedure.
    
    In the standard library, all code that wants to take an &Path takes
    an impl AsRef<Path> instead, this way Strings and &strs can be passed
    ergonomically. This commit uses &Path generally, because it may not be
    worth the increase in binary size to add a generic. The author has no
    preference one way or another and is open to rewriting to use the
    alternative approach.
    timotree3 committed Sep 7, 2019
    Configuration menu
    Copy the full SHA
    4b63a9d View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2019

  1. Convert String and &str to PathBuf and &Path when applicable

    Resolves holochain#660
    
    This change is valuable because you may obtain a path that
    contains non-utf8 data and try to use it with these APIs,
    but if these APIs take Strings, you have to lossily convert it
    and you can't operate on those files.
    
    The main non-obvious change as a result of this effort are changes like:
    
    ```
    format!("using path: \'{}\'", some_string_path)
    ```
    to
    ```
    format!("using path: {:?}", some_pathbuf)
    ```
    
    these result in a change from single quotes to double quotes.
    
    The alternative substition is
    
    ```
    format!("using path: \'{}\'", some_pathbuf.to_string_lossy())
    ```
    this has the advantage of preserving single-quotes, but has the
    disadvantage of requiring an extra allocation over the more
    efficient Debug-impl of PathBuf.
    
    There are existing instances in the code where the later approach is
    used, it may be worth changing all instances to use the same choice.
    timotree3 committed Sep 8, 2019
    Configuration menu
    Copy the full SHA
    f5e4f84 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bee46b6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c26d1c0 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2019

  1. Configuration menu
    Copy the full SHA
    172560f View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2019

  1. Configuration menu
    Copy the full SHA
    2328ca4 View commit details
    Browse the repository at this point in the history
  2. Round up calls to .to_str() on paths

    I'm not sure how much of this was since last roundup and
    how much I missed last time.
    timotree3 committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    1e606e4 View commit details
    Browse the repository at this point in the history
  3. Cargo fmt

    Note I only formatted the files I changed.
    Did not a run full format in the name of keeping diff small.
    timotree3 committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    045785c View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2019

  1. Configuration menu
    Copy the full SHA
    b147183 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2019

  1. Configuration menu
    Copy the full SHA
    7806da3 View commit details
    Browse the repository at this point in the history
  2. fmt

    willemolding committed Oct 7, 2019
    Configuration menu
    Copy the full SHA
    eb14ec9 View commit details
    Browse the repository at this point in the history
  3. clippify

    willemolding committed Oct 7, 2019
    Configuration menu
    Copy the full SHA
    8da7285 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2f51933 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2019

  1. Configuration menu
    Copy the full SHA
    28b7df5 View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2019

  1. Configuration menu
    Copy the full SHA
    e8df6c8 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2019

  1. Configuration menu
    Copy the full SHA
    d99bfc5 View commit details
    Browse the repository at this point in the history
  2. Cargo fmt

    timotree3 committed Oct 19, 2019
    Configuration menu
    Copy the full SHA
    e7a06c2 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2019

  1. Cargo fmt

    timotree3 committed Oct 20, 2019
    Configuration menu
    Copy the full SHA
    06fd87d View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2019

  1. Configuration menu
    Copy the full SHA
    4b362e7 View commit details
    Browse the repository at this point in the history
  2. Replace &String -> &str in argument types and struct fields

    Since an `&String` can be converted into an `&str` at zero-cost,
    the reverse does not apply, and
    having an `&String` gives you access to no more APIs than an `&str`,
    this is an indisputable improvment.
    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    2788302 View commit details
    Browse the repository at this point in the history
  3. Cargo fmt

    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    b1afed4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7d043bc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a17a44a View commit details
    Browse the repository at this point in the history
  6. Cargo fmt

    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    8b739ca View commit details
    Browse the repository at this point in the history
  7. Rewrite &String::default() -> ""

    At this point the only remaining occurences of `&String`
    are to do with either `JsonString` or `EntryType`.
    In a later PR I intend to address these warts.
    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    e0aa8ec View commit details
    Browse the repository at this point in the history
  8. Remove some extraneous .to_string()s

    Holy cow, there are so many occurences!
    I gave up after removing many.
    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    eb018f0 View commit details
    Browse the repository at this point in the history
  9. Cargo fmt

    timotree3 committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    eae08db View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2019

  1. Configuration menu
    Copy the full SHA
    be02f00 View commit details
    Browse the repository at this point in the history