Rename s to string in truncate

This commit is contained in:
Sijmen 2019-10-28 01:44:35 +01:00
parent e05823a4d9
commit 195d5f0770

View file

@ -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
}
}