hello-algo icon indicating copy to clipboard operation
hello-algo copied to clipboard

Refine some details and coding style for Rust codes

Open coderonion opened this issue 2 years ago • 3 comments

If this PR is related to coding or code translation, please read the contribution guideline, fill out the checklist, and paste the console outputs to the PR.

  • [x] I've tested the code and ensured the outputs are the same as the outputs of reference codes.
  • [x] I've checked the codes (formatting, comments, indentation, file header, etc) carefully.
  • [x] The code does not rely on a particular environment or IDE and can be executed on a standard system (Win, macOS, Ubuntu).

coderonion avatar Feb 06 '23 14:02 coderonion

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
hello-algo ⬜️ Ignored (Inspect) Feb 7, 2023 at 2:10PM (UTC)

vercel[bot] avatar Feb 06 '23 14:02 vercel[bot]

Thank @sjinzh for the great improvement!

I recommend keeping the comment format of /* ... */ for the class and function headers.

This book follow this rule of comment formatting.

/* 标题注释,用于标注函数、类、测试样例等 */

// 内容注释,用于详解代码

/**
 * 多行
 * 注释
 */

More details at 关于本书

@krahets OK. It had better follow the rule for rust codes as shown below.

/* 标题注释,用于标注函数、类、测试样例等 */

// 内容注释,用于详解代码

/*
 * 多行
 * 注释
 */

coderonion avatar Feb 07 '23 10:02 coderonion

Two more comments, please.

@krahets The below comment style in the rust file header would result in rustdoc warning with the following include!() macro.

/**
 * 多行
 * 注释
 */

01

So, It had better follow the comment style in the rust file header as shown below, and this is OK.

/*
 * 多行
 * 注释
 */

02

coderonion avatar Feb 07 '23 14:02 coderonion