mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 10:55:31 +03:00
clippy
This commit is contained in:
parent
75e996c445
commit
11cccde050
@ -387,7 +387,7 @@ pub fn cli_testing_dir(dir_name: &str) -> PathBuf {
|
||||
// Descend into examples/{dir_name}
|
||||
path.push("crates");
|
||||
path.push("cli_testing_examples");
|
||||
path.extend(dir_name.split("/")); // Make slashes cross-target
|
||||
path.extend(dir_name.split('/')); // Make slashes cross-target
|
||||
|
||||
path
|
||||
}
|
||||
@ -396,7 +396,7 @@ pub fn cli_testing_dir(dir_name: &str) -> PathBuf {
|
||||
pub fn dir_path_from_root(dir_name: &str) -> PathBuf {
|
||||
let mut path = root_dir();
|
||||
|
||||
path.extend(dir_name.split("/")); // Make slashes cross-target
|
||||
path.extend(dir_name.split('/')); // Make slashes cross-target
|
||||
|
||||
path
|
||||
}
|
||||
@ -419,7 +419,7 @@ pub fn fixtures_dir(dir_name: &str) -> PathBuf {
|
||||
path.push("cli");
|
||||
path.push("tests");
|
||||
path.push("fixtures");
|
||||
path.extend(dir_name.split("/")); // Make slashes cross-target
|
||||
path.extend(dir_name.split('/')); // Make slashes cross-target
|
||||
|
||||
path
|
||||
}
|
||||
|
@ -46,7 +46,14 @@ impl<K, V> RocDict<K, V> {
|
||||
}
|
||||
|
||||
impl<K: Hash, V> RocDict<K, V> {
|
||||
pub fn from_iter<I: Iterator<Item = (K, V)>>(src: I) -> Self {
|
||||
unsafe fn insert_unchecked(&mut self, _key: K, _val: V) {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: Hash, V> FromIterator<(K, V)> for RocDict<K, V> {
|
||||
fn from_iter<T: IntoIterator<Item = (K, V)>>(into_iter: T) -> Self {
|
||||
let src = into_iter.into_iter();
|
||||
let mut ret = Self::with_capacity(src.size_hint().0);
|
||||
|
||||
for (key, val) in src {
|
||||
@ -57,16 +64,6 @@ impl<K: Hash, V> RocDict<K, V> {
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
unsafe fn insert_unchecked(&mut self, _key: K, _val: V) {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K: Hash, V> FromIterator<(K, V)> for RocDict<K, V> {
|
||||
fn from_iter<T: IntoIterator<Item = (K, V)>>(into_iter: T) -> Self {
|
||||
RocDict::from_iter(into_iter.into_iter())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K, V> IntoIterator for &'a RocDict<K, V> {
|
||||
|
@ -151,7 +151,7 @@ impl<T> RocList<T> {
|
||||
/// bytes over - in other words, calling this `as_slice` method and then calling `to_vec`
|
||||
/// on that.
|
||||
pub fn as_slice(&self) -> &[T] {
|
||||
&*self
|
||||
self
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -27,10 +27,11 @@ impl<T> RocSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Hash> RocSet<T> {
|
||||
#[allow(unused)]
|
||||
pub fn from_iter<I: Iterator<Item = T>>(src: I) -> Self {
|
||||
Self(RocDict::from_iter(src.map(|elem| (elem, ()))))
|
||||
impl<T: Hash> FromIterator<T> for RocSet<T> {
|
||||
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self {
|
||||
Self(RocDict::from_iter(
|
||||
into_iter.into_iter().map(|elem| (elem, ())),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl RocStr {
|
||||
/// bytes over - in other words, calling this `as_str` method and then calling `to_string`
|
||||
/// on that.
|
||||
pub fn as_str(&self) -> &str {
|
||||
&*self
|
||||
self
|
||||
}
|
||||
|
||||
/// Create an empty RocStr with enough space preallocated to store
|
||||
@ -562,8 +562,8 @@ impl Deref for RocStr {
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
match self.as_enum_ref() {
|
||||
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(&*h) },
|
||||
RocStrInnerRef::SmallString(s) => &*s,
|
||||
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(h) },
|
||||
RocStrInnerRef::SmallString(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate pretty_assertions;
|
||||
extern crate quickcheck;
|
||||
|
Loading…
Reference in New Issue
Block a user