mirror of https://github.com/helix-editor/helix
chore: Use `&[T]` instead of `&Vec<T>`
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>pull/12759/head
parent
6e52d9439f
commit
bdd953e5b1
|
@ -17,7 +17,7 @@ pub fn get_line_comment_token(
|
|||
loader: &syntax::Loader,
|
||||
syntax: Option<&Syntax>,
|
||||
text: RopeSlice,
|
||||
doc_default_tokens: Option<&Vec<String>>,
|
||||
doc_default_tokens: Option<&[String]>,
|
||||
line_num: usize,
|
||||
) -> Option<String> {
|
||||
let line = text.line(line_num);
|
||||
|
@ -210,7 +210,7 @@ pub enum CommentChange {
|
|||
pub fn find_block_comments(
|
||||
tokens: &[BlockCommentToken],
|
||||
text: RopeSlice,
|
||||
ranges: &Vec<Range>,
|
||||
ranges: &[Range],
|
||||
) -> (bool, Vec<CommentChange>) {
|
||||
let mut was_commented = true;
|
||||
let mut only_whitespace = true;
|
||||
|
@ -361,7 +361,7 @@ pub fn create_block_comment_transaction(
|
|||
#[must_use]
|
||||
pub fn toggle_block_comments(
|
||||
doc: &Rope,
|
||||
ranges: &Vec<Range>,
|
||||
ranges: &[Range],
|
||||
tokens: &[BlockCommentToken],
|
||||
selections: &mut SmallVec<[Range; 1]>,
|
||||
added_chars: &mut usize,
|
||||
|
@ -542,7 +542,7 @@ mod test {
|
|||
|
||||
let text = doc.slice(..);
|
||||
|
||||
let res = find_block_comments(&[BlockCommentToken::default()], text, &vec![range]);
|
||||
let res = find_block_comments(&[BlockCommentToken::default()], text, &[range]);
|
||||
|
||||
assert_eq!(
|
||||
res,
|
||||
|
@ -561,7 +561,7 @@ mod test {
|
|||
// comment
|
||||
let changes = toggle_block_comments(
|
||||
&doc,
|
||||
&vec![range],
|
||||
&[range],
|
||||
&[BlockCommentToken::default()],
|
||||
&mut SmallVec::new(),
|
||||
&mut 0,
|
||||
|
@ -576,7 +576,7 @@ mod test {
|
|||
let range = Range::new(0, doc.len_chars());
|
||||
let changes = toggle_block_comments(
|
||||
&doc,
|
||||
&vec![range],
|
||||
&[range],
|
||||
&[BlockCommentToken::default()],
|
||||
&mut SmallVec::new(),
|
||||
&mut 0,
|
||||
|
@ -591,7 +591,7 @@ mod test {
|
|||
let range = Range::new(0, doc.len_chars());
|
||||
let changes = toggle_block_comments(
|
||||
&doc,
|
||||
&vec![range],
|
||||
&[range],
|
||||
&[BlockCommentToken::default()],
|
||||
&mut SmallVec::new(),
|
||||
&mut 0,
|
||||
|
|
|
@ -3654,7 +3654,7 @@ fn open(cx: &mut Context, open: Open, comment_continuation: CommentContinuation)
|
|||
|
||||
let doc_default_tokens = doc
|
||||
.language_config()
|
||||
.and_then(|config| config.comment_tokens.as_ref());
|
||||
.and_then(|config| config.comment_tokens.as_deref());
|
||||
|
||||
let syntax = doc.syntax();
|
||||
|
||||
|
@ -4214,7 +4214,7 @@ pub mod insert {
|
|||
|
||||
let doc_default_comment_token = doc
|
||||
.language_config()
|
||||
.and_then(|config| config.comment_tokens.as_ref());
|
||||
.and_then(|config| config.comment_tokens.as_deref());
|
||||
|
||||
let syntax = doc.syntax();
|
||||
|
||||
|
@ -5272,7 +5272,7 @@ fn toggle_comments(cx: &mut Context) {
|
|||
let (block_commented, comment_changes) = comment::find_block_comments(
|
||||
block_comment_tokens,
|
||||
rope.slice(..),
|
||||
&vec![*range],
|
||||
&[*range],
|
||||
);
|
||||
|
||||
if block_commented {
|
||||
|
|
Loading…
Reference in New Issue