Code style refinements.

This commit is contained in:
Stephen Chung
2021-05-29 18:33:29 +08:00
parent 5f36f1a28c
commit 76bd48d0a6
12 changed files with 157 additions and 196 deletions

View File

@@ -110,7 +110,7 @@ mod string_functions {
pub fn index_of_char_starting_from(string: &str, character: char, start: INT) -> INT {
let start = if start < 0 {
if let Some(n) = start.checked_abs() {
let chars = string.chars().collect::<Vec<_>>();
let chars: Vec<_> = string.chars().collect();
let num_chars = chars.len();
if n as usize > num_chars {
0