Fix new clippy warnings (#2760)

* Fix new clippy warnings

* Fork serde-hjson and bring in

* Fork serde-hjson and bring in

* Fix clippy lint again
This commit is contained in:
Jonathan Turner
2020-11-22 13:37:16 +13:00
committed by GitHub
parent 63d4df9810
commit 930f9f0063
36 changed files with 5176 additions and 952 deletions

View File

@ -845,8 +845,8 @@ fn rustyline_hinter(config: &dyn nu_data::config::Conf) -> Option<rustyline::hin
}
fn chomp_newline(s: &str) -> &str {
if s.ends_with('\n') {
&s[..s.len() - 1]
if let Some(s) = s.strip_suffix('\n') {
s
} else {
s
}
@ -863,8 +863,8 @@ pub enum LineResult {
}
pub async fn parse_and_eval(line: &str, ctx: &mut EvaluationContext) -> Result<String, ShellError> {
let line = if line.ends_with('\n') {
&line[..line.len() - 1]
let line = if let Some(s) = line.strip_suffix('\n') {
s
} else {
line
};