Rename s to string in truncate
This commit is contained in:
parent
e05823a4d9
commit
195d5f0770
1 changed files with 6 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
@ -8,13 +8,13 @@ use std::fs::OpenOptions;
|
|||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn truncate(s: String, size: usize) -> String {
|
||||
if s.len() > size {
|
||||
let mut s = s;
|
||||
s.truncate(size - 3);
|
||||
format!("{}...", s)
|
||||
fn truncate(string: String, size: usize) -> String {
|
||||
if string.len() > size {
|
||||
let mut string = string;
|
||||
string.truncate(size - 3);
|
||||
format!("{}...", string)
|
||||
} else {
|
||||
s
|
||||
string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue