format code in md

This commit is contained in:
likzn
2022-05-01 13:08:50 +08:00
parent dad4052485
commit e09080f88a
43 changed files with 405 additions and 124 deletions

View File

@ -1,4 +1,5 @@
1.
```rust
fn main() {
let decimal = 97.123_f32;
@ -13,6 +14,7 @@ fn main() {
```
2.
```rust
// Suppress all warnings from casts which overflow.
#![allow(overflowing_literals)]
@ -24,6 +26,7 @@ fn main() {
```
3.
```rust
fn main() {
assert_eq!(1000 as u16, 1000);
@ -58,6 +61,7 @@ fn main() {
```
4.
```rust
fn main() {
let mut values: [i32; 2] = [1, 2];
@ -75,6 +79,7 @@ fn main() {
```
5.
```rust
fn main() {
let arr :[u64; 13] = [0; 13];

View File

@ -1,4 +1,5 @@
1.
```rust
fn main() {
// impl From<bool> for i32
@ -28,6 +29,7 @@ fn main() {
```
2.
```rust
// From is now included in `std::prelude`, so there is no need to introduce it into the current scope
// use std::convert::From;
@ -56,6 +58,7 @@ fn main() {
```
3.
```rust
use std::fs;
use std::io;
@ -92,6 +95,7 @@ fn main() {
```
4.
```rust
fn main() {
let n: i16 = 256;
@ -111,6 +115,7 @@ fn main() {
```
5.
```rust,editable
#[derive(Debug, PartialEq)]
struct EvenNum(i32);

View File

@ -1,4 +1,5 @@
1
```rust
use std::fmt;
@ -23,6 +24,7 @@ fn main() {
```
2.
```rust
// To use `from_str` method, you needs to introduce this trait into the current scope.
use std::str::FromStr;
@ -38,6 +40,7 @@ fn main() {
```
3.
```rust
use std::str::FromStr;
use std::num::ParseIntError;