forked from extern/nushell
Deref &String
arguments to &str
where appropriate (#10321)
# Description This generally makes for nicer APIs, as you are not forced to use an existing allocation covering the full `String`. Some exceptions remain where the underlying type requirements favor it. # User-Facing Changes None
This commit is contained in:
committed by
GitHub
parent
e90b099622
commit
6e9b6f22c9
@ -136,7 +136,7 @@ impl NuCompleter {
|
||||
for (flat_idx, flat) in flattened.iter().enumerate() {
|
||||
let is_passthrough_command = spans
|
||||
.first()
|
||||
.filter(|content| *content == &String::from("sudo"))
|
||||
.filter(|content| content.as_str() == "sudo")
|
||||
.is_some();
|
||||
// Read the current spam to string
|
||||
let current_span = working_set.get_span_contents(flat.0).to_vec();
|
||||
|
@ -116,9 +116,8 @@ pub fn evaluate_file(
|
||||
if block.signature.name == "main" {
|
||||
block.signature.name = source_filename.to_string_lossy().to_string();
|
||||
} else if block.signature.name.starts_with("main ") {
|
||||
block.signature.name = source_filename.to_string_lossy().to_string()
|
||||
+ " "
|
||||
+ &String::from_utf8_lossy(&block.signature.name.as_bytes()[5..]);
|
||||
block.signature.name =
|
||||
source_filename.to_string_lossy().to_string() + " " + &block.signature.name[5..];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user