From 6a16ec52aa0d91945577c99cdf421b303b59301e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 4 May 2021 14:10:49 +0300 Subject: internal: use API stabilized in 1.52 --- crates/test_utils/src/fixture.rs | 10 +++++----- crates/test_utils/src/lib.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 099baeca2..d0bddf7d8 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -62,7 +62,7 @@ //! ``` use rustc_hash::FxHashMap; -use stdx::{lines_with_ends, split_once, trim_indent}; +use stdx::trim_indent; #[derive(Debug, Eq, PartialEq)] pub struct Fixture { @@ -93,7 +93,7 @@ impl Fixture { let default = if ra_fixture.contains("//-") { None } else { Some("//- /main.rs") }; - for (ix, line) in default.into_iter().chain(lines_with_ends(&fixture)).enumerate() { + for (ix, line) in default.into_iter().chain(fixture.split_inclusive('\n')).enumerate() { if line.contains("//-") { assert!( line.starts_with("//-"), @@ -133,14 +133,14 @@ impl Fixture { let mut env = FxHashMap::default(); let mut introduce_new_source_root = false; for component in components[1..].iter() { - let (key, value) = split_once(component, ':').unwrap(); + let (key, value) = component.split_once(':').unwrap(); match key { "crate" => krate = Some(value.to_string()), "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), "edition" => edition = Some(value.to_string()), "cfg" => { for entry in value.split(',') { - match split_once(entry, '=') { + match entry.split_once('=') { Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), None => cfg_atoms.push(entry.to_string()), } @@ -148,7 +148,7 @@ impl Fixture { } "env" => { for key in value.split(',') { - if let Some((k, v)) = split_once(key, '=') { + if let Some((k, v)) = key.split_once('=') { env.insert(k.into(), v.into()); } } diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 72466c957..fce4fd6bf 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -17,7 +17,7 @@ use std::{ }; use profile::StopWatch; -use stdx::{is_ci, lines_with_ends}; +use stdx::is_ci; use text_size::{TextRange, TextSize}; pub use dissimilar::diff as __diff; @@ -181,7 +181,7 @@ pub fn extract_annotations(text: &str) -> Vec<(TextRange, String)> { let mut prev_line_start: Option = None; let mut line_start: TextSize = 0.into(); let mut prev_line_annotations: Vec<(TextSize, usize)> = Vec::new(); - for line in lines_with_ends(text) { + for line in text.split_inclusive('\n') { let mut this_line_annotations = Vec::new(); if let Some(idx) = line.find("//") { let annotation_offset = TextSize::of(&line[..idx + "//".len()]); -- cgit v1.2.3