mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
remove unnecessary space
This commit is contained in:
@ -20,7 +20,7 @@ fn main() {
|
||||
|
||||
// 使用至少两种方法来修复错误
|
||||
fn main() {
|
||||
let s: Box<str> = "hello, world".into();
|
||||
let s: Box<str> = "hello, world".into();
|
||||
greetings(s)
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ fn main() {
|
||||
|
||||
// 修复所有错误,并且不要新增代码行
|
||||
fn main() {
|
||||
let s = String::from("hello");
|
||||
let s = String::from("hello");
|
||||
s.push(',');
|
||||
s.push(" world");
|
||||
s += "!".to_string();
|
||||
@ -98,7 +98,7 @@ fn main() {
|
||||
|
||||
// 使用至少两种方法来修复错误
|
||||
fn main() {
|
||||
let s = "hello, world";
|
||||
let s = "hello, world";
|
||||
greetings(s)
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ fn greetings(s: String) {
|
||||
|
||||
// 使用两种方法来解决错误,不要新增代码行
|
||||
fn main() {
|
||||
let s = "hello, world".to_string();
|
||||
let s = "hello, world".to_string();
|
||||
let s1: &str = s;
|
||||
}
|
||||
```
|
||||
|
@ -18,7 +18,7 @@ fn main() {
|
||||
|
||||
// 完形填空,让代码编译
|
||||
fn main() {
|
||||
let __ = 1;
|
||||
let __ = 1;
|
||||
__ += 2;
|
||||
|
||||
println!("x = {}", x);
|
||||
@ -69,7 +69,7 @@ fn main() {
|
||||
|
||||
assert_eq!(x, 12);
|
||||
|
||||
let x = 42;
|
||||
let x = 42;
|
||||
println!("{}", x); // 输出 "42".
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user