repo_path: remove RepoPathComponent::string(), use as_str() instead

There are only two callers, and one does further conversion to BString.
This commit is contained in:
Yuya Nishihara 2023-11-25 16:58:33 +09:00
parent 4f2503cbce
commit d7df2516c5
3 changed files with 3 additions and 7 deletions

View file

@ -777,7 +777,7 @@ impl Backend for GitBackend {
let entries = contents
.entries()
.map(|entry| {
let name = entry.name().string();
let name = entry.name().as_str();
match entry.value() {
TreeValue::File {
id,
@ -812,7 +812,7 @@ impl Backend for GitBackend {
},
TreeValue::Conflict(id) => gix::objs::tree::Entry {
mode: gix::object::tree::EntryMode::Blob,
filename: (name + CONFLICT_SUFFIX).into(),
filename: (name.to_owned() + CONFLICT_SUFFIX).into(),
oid: id.as_bytes().into(),
},
}

View file

@ -357,7 +357,7 @@ fn tree_to_proto(tree: &Tree) -> crate::protos::local_store::Tree {
let mut proto = crate::protos::local_store::Tree::default();
for entry in tree.entries() {
proto.entries.push(crate::protos::local_store::tree::Entry {
name: entry.name().string(),
name: entry.name().as_str().to_owned(),
value: Some(tree_value_to_proto(entry.value())),
});
}

View file

@ -33,10 +33,6 @@ impl RepoPathComponent {
pub fn as_str(&self) -> &str {
&self.value
}
pub fn string(&self) -> String {
self.value.to_string()
}
}
impl From<&str> for RepoPathComponent {