Skip to content

Commit

Permalink
take more general arg type (ptr_arg)
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-northlander committed Nov 11, 2024
1 parent 5cb36cb commit e18a104
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions python/src/word_info.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Works Applications Co., Ltd.
* Copyright (c) 2021-2024 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,9 +33,9 @@ pub struct PyWordInfo {
synonym_group_ids: Vec<u32>,
}

fn copy_if_empty(v1: String, v2: &String) -> String {
fn copy_if_empty(v1: String, v2: &str) -> String {
if v1.is_empty() {
v2.clone()
v2.to_owned()
} else {
v1
}
Expand Down
2 changes: 1 addition & 1 deletion sudachi-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use sudachi::config::Config;
use sudachi::dic::dictionary::JapaneseDictionary;
use sudachi::prelude::*;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum SentenceSplitMode {
/// Do both sentence splitting and analysis
#[default]
Expand Down
2 changes: 1 addition & 1 deletion sudachi/src/analysis/stateless_tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(super) fn split_path<T: DictionaryAccess + ?Sized>(
Ok(new_path)
}

pub(super) fn dump_path(path: &Vec<ResultNode>) {
pub(super) fn dump_path(path: &[ResultNode]) {
for (i, node) in path.iter().enumerate() {
println!("{}: {}", i, node);
}
Expand Down
2 changes: 1 addition & 1 deletion sudachi/src/dic/build/lexicon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl StrPosEntry {
Self { data: owned }
}

pub fn from_built_pos(data: &Vec<String>) -> Self {
pub fn from_built_pos(data: &[String]) -> Self {
let mut iter = data.iter().map(|x| x.as_str());
let p1 = Cow::Borrowed(iter.next().unwrap());
let p2 = Cow::Borrowed(iter.next().unwrap());
Expand Down
2 changes: 1 addition & 1 deletion sudachi/src/dic/lexicon_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl LexiconSet<'_> {
self.lexicons[dic_id].get_word_param(id.word())
}

fn update_dict_id(split: &mut Vec<WordId>, dict_id: u8) -> SudachiResult<()> {
fn update_dict_id(split: &mut [WordId], dict_id: u8) -> SudachiResult<()> {
for id in split.iter_mut() {
let cur_dict_id = id.dic();
if cur_dict_id > 0 {
Expand Down
6 changes: 3 additions & 3 deletions sudachi/src/input_text/buffer/edit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Works Applications Co., Ltd.
* Copyright (c) 2021-2024 Works Applications Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<'a> InputEditor<'a> {
// Current plugin implementations satisfy this criteria.
pub fn resolve_edits(
source: &str,
source_mapping: &Vec<usize>,
source_mapping: &[usize],
target: &mut String,
target_mapping: &mut Vec<usize>,
edits: &mut Vec<ReplaceOp>,
Expand Down Expand Up @@ -127,7 +127,7 @@ pub fn resolve_edits(
}

fn add_replace(
source_mapping: &Vec<usize>,
source_mapping: &[usize],
target: &mut String,
target_mapping: &mut Vec<usize>,
what: Range<usize>,
Expand Down

0 comments on commit e18a104

Please sign in to comment.