Mercurial > python-compiler.rs
comparison src/ast_dump.rs @ 58:a0b23123901b
Replace "".to_string() and format!("") by String::new().
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Sun, 12 Jun 2016 18:52:43 +0200 |
parents | e5a808ec31c0 |
children | 407b3b217928 |
comparison
equal
deleted
inserted
replaced
57:e5a808ec31c0 | 58:a0b23123901b |
---|---|
225 stmt::For(target, iter, body, orelse) => format!("{}for {} in {}:\n{}", current_indent, target.to_string(), iter.to_string(), if_else_statements_to_string(indent, body, orelse)), | 225 stmt::For(target, iter, body, orelse) => format!("{}for {} in {}:\n{}", current_indent, target.to_string(), iter.to_string(), if_else_statements_to_string(indent, body, orelse)), |
226 stmt::Assign(targets, value) => format!("{}{} = {}", current_indent, vec_to_strings_vec(targets).join(", "), value.to_string()), | 226 stmt::Assign(targets, value) => format!("{}{} = {}", current_indent, vec_to_strings_vec(targets).join(", "), value.to_string()), |
227 stmt::AugAssign(target, op, value) => format!("{}{} {}= {}", current_indent, target.to_string(), op.to_string(), value.to_string()), | 227 stmt::AugAssign(target, op, value) => format!("{}{} {}= {}", current_indent, target.to_string(), op.to_string(), value.to_string()), |
228 stmt::Return(expr) => format!("{}return{}", current_indent, match expr { | 228 stmt::Return(expr) => format!("{}return{}", current_indent, match expr { |
229 Some(expr) => format!(" {}", expr.to_string()), | 229 Some(expr) => format!(" {}", expr.to_string()), |
230 None => "".to_string() | 230 None => String::new() |
231 }), | 231 }), |
232 stmt::ImportFrom(module, names, level) => { | 232 stmt::ImportFrom(module, names, level) => { |
233 format!("{}from {}{} import {}", | 233 format!("{}from {}{} import {}", |
234 current_indent, | 234 current_indent, |
235 { | 235 { |
271 current_indent, | 271 current_indent, |
272 test.to_string(), | 272 test.to_string(), |
273 { | 273 { |
274 match msg { | 274 match msg { |
275 Some(msg) => format!(", {}", msg.to_string()), | 275 Some(msg) => format!(", {}", msg.to_string()), |
276 None => format!("") | 276 None => String::new() |
277 } | 277 } |
278 } | 278 } |
279 ) | 279 ) |
280 } | 280 } |
281 } | 281 } |