Skip to content

Commit b0d87fa

Browse files
committed
replace "".to_string() with String::new()
1 parent 6763f32 commit b0d87fa

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/apps/desktop_entry.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ impl std::default::Default for DesktopEntry {
9090
DesktopEntry {
9191
entry_type: EntryType::Application,
9292
version: None,
93-
name: "".to_string(),
93+
name: String::new(),
9494
generic_name: None,
9595
comment: None,
9696
icon: None,
9797
only_show_in: Vec::new(),
9898
not_show_in: Vec::new(),
9999
try_exec: None,
100-
exec: "".to_string(),
100+
exec: String::new(),
101101
working_dir: None,
102102
terminal: false,
103103
action_list: Vec::new(),
@@ -322,14 +322,14 @@ impl From<DesktopEntry> for App {
322322

323323
log::trace!("arg is: {:#?}", arg);
324324

325-
if arg == vec!["".to_string()] {
325+
if arg == vec![String::new()] {
326326
log::trace!("ARGS LEN 0");
327327
arg.clear();
328328
}
329329

330330
(cmd.to_string(), arg)
331331
}
332-
None => (desktop_entry.exec, vec!["".to_string()]),
332+
None => (desktop_entry.exec, vec![String::new()]),
333333
};
334334

335335
let working_dir = desktop_entry.working_dir;
@@ -405,7 +405,7 @@ fn can_parse_string_list() {
405405

406406
fn parse_exec_key(input: &str, icon: Option<&str>, name: Option<&str>) -> String {
407407
// https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html
408-
let mut escaped_result = "".to_string();
408+
let mut escaped_result = String::new();
409409
let mut chars = input.chars().peekable();
410410

411411
// Lots of nesting here..

src/calculator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl Calc {
166166
let mut out = Vec::new();
167167
let chars = source.chars();
168168

169-
let mut number_buf: String = "".to_string();
169+
let mut number_buf: String = String::new();
170170

171171
let mut iter = chars.enumerate().peekable();
172172
while let Some((idx, c)) = iter.next() {

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ impl State {
4646

4747
modules.insert("!".to_string(), LazyCell::new(|| Box::new(Web::new())));
4848

49-
modules.insert("".to_string(), LazyCell::new(|| Box::new(AppModule::new())));
49+
modules.insert(String::new(), LazyCell::new(|| Box::new(AppModule::new())));
5050

5151
log::info!("Time to initialise modules: {:#?}", start.elapsed());
5252
State {
53-
text_value: "".to_string(),
53+
text_value: String::new(),
5454
text_id: widget::Id::new("text_entry"),
5555
window_id: None,
5656
has_user_typed: false,
@@ -63,7 +63,7 @@ impl State {
6363
let mut modules: HashMap<String, LazyCell<Box<dyn Module>>> = HashMap::new();
6464

6565
modules.insert(
66-
"".to_string(),
66+
String::new(),
6767
LazyCell::new(|| {
6868
let stdin = std::io::stdin();
6969
let mut lines = Vec::new();
@@ -80,7 +80,7 @@ impl State {
8080
start.finish();
8181

8282
State {
83-
text_value: "".to_string(),
83+
text_value: String::new(),
8484
text_id: widget::Id::new("text_entry"),
8585
window_id: None,
8686
has_user_typed: false,

0 commit comments

Comments
 (0)