This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 269
String roundup part 1 #1732
Open
timotree3
wants to merge
28
commits into
holochain:develop
Choose a base branch
from
timotree3:string-roundup2
base: develop
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
String roundup part 1 #1732
Commits on Sep 7, 2019
-
Rewrite
&PathBuf
s in signatures to&Path
sTaking &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.
Configuration menu - View commit details
-
Copy full SHA for 4b63a9d - Browse repository at this point
Copy the full SHA 4b63a9dView commit details
Commits on Sep 8, 2019
-
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.
Configuration menu - View commit details
-
Copy full SHA for f5e4f84 - Browse repository at this point
Copy the full SHA f5e4f84View commit details -
Configuration menu - View commit details
-
Copy full SHA for bee46b6 - Browse repository at this point
Copy the full SHA bee46b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for c26d1c0 - Browse repository at this point
Copy the full SHA c26d1c0View commit details
Commits on Sep 9, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 172560f - Browse repository at this point
Copy the full SHA 172560fView commit details
Commits on Sep 27, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 2328ca4 - Browse repository at this point
Copy the full SHA 2328ca4View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 1e606e4 - Browse repository at this point
Copy the full SHA 1e606e4View commit details -
Note I only formatted the files I changed. Did not a run full format in the name of keeping diff small.
Configuration menu - View commit details
-
Copy full SHA for 045785c - Browse repository at this point
Copy the full SHA 045785cView commit details
Commits on Oct 2, 2019
-
Configuration menu - View commit details
-
Copy full SHA for b147183 - Browse repository at this point
Copy the full SHA b147183View commit details
Commits on Oct 7, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 7806da3 - Browse repository at this point
Copy the full SHA 7806da3View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb14ec9 - Browse repository at this point
Copy the full SHA eb14ec9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8da7285 - Browse repository at this point
Copy the full SHA 8da7285View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f51933 - Browse repository at this point
Copy the full SHA 2f51933View commit details
Commits on Oct 10, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 28b7df5 - Browse repository at this point
Copy the full SHA 28b7df5View commit details
Commits on Oct 14, 2019
-
Configuration menu - View commit details
-
Copy full SHA for e8df6c8 - Browse repository at this point
Copy the full SHA e8df6c8View commit details
Commits on Oct 19, 2019
-
Configuration menu - View commit details
-
Copy full SHA for d99bfc5 - Browse repository at this point
Copy the full SHA d99bfc5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e7a06c2 - Browse repository at this point
Copy the full SHA e7a06c2View commit details
Commits on Oct 20, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 06fd87d - Browse repository at this point
Copy the full SHA 06fd87dView commit details
Commits on Oct 21, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 4b362e7 - Browse repository at this point
Copy the full SHA 4b362e7View commit details -
Replace
&String
->&str
in argument types and struct fieldsSince 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.
Configuration menu - View commit details
-
Copy full SHA for 2788302 - Browse repository at this point
Copy the full SHA 2788302View commit details -
Configuration menu - View commit details
-
Copy full SHA for b1afed4 - Browse repository at this point
Copy the full SHA b1afed4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d043bc - Browse repository at this point
Copy the full SHA 7d043bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for a17a44a - Browse repository at this point
Copy the full SHA a17a44aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8b739ca - Browse repository at this point
Copy the full SHA 8b739caView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for e0aa8ec - Browse repository at this point
Copy the full SHA e0aa8ecView commit details -
Remove some extraneous
.to_string()
sHoly cow, there are so many occurences! I gave up after removing many.
Configuration menu - View commit details
-
Copy full SHA for eb018f0 - Browse repository at this point
Copy the full SHA eb018f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for eae08db - Browse repository at this point
Copy the full SHA eae08dbView commit details
Commits on Oct 23, 2019
-
Configuration menu - View commit details
-
Copy full SHA for be02f00 - Browse repository at this point
Copy the full SHA be02f00View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.