mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 01:05:01 +02:00
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:
@ -3,7 +3,6 @@ use std::cmp::Ordering;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// A "Text" is like a string except that it can be cheaply cloned.
|
||||
/// You can also "extract" subtexts quite cheaply. You can also deref
|
||||
@ -12,7 +11,7 @@ use std::sync::Arc;
|
||||
/// Used to represent the value of an input file.
|
||||
#[derive(Clone)]
|
||||
pub struct Text {
|
||||
text: Arc<String>,
|
||||
text: String,
|
||||
start: usize,
|
||||
end: usize,
|
||||
}
|
||||
@ -39,11 +38,11 @@ impl Text {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Arc<String>> for Text {
|
||||
fn from(text: Arc<String>) -> Self {
|
||||
impl From<&str> for Text {
|
||||
fn from(text: &str) -> Self {
|
||||
let end = text.len();
|
||||
Self {
|
||||
text,
|
||||
text: text.to_string(),
|
||||
start: 0,
|
||||
end,
|
||||
}
|
||||
@ -58,19 +57,12 @@ impl AsRef<str> for Text {
|
||||
|
||||
impl From<String> for Text {
|
||||
fn from(text: String) -> Self {
|
||||
Text::from(Arc::new(text))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&String> for Text {
|
||||
fn from(text: &String) -> Self {
|
||||
Text::from(text.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for Text {
|
||||
fn from(text: &str) -> Self {
|
||||
Text::from(text.to_string())
|
||||
let end = text.len();
|
||||
Self {
|
||||
text,
|
||||
start: 0,
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user