Skip to content

Commit fe42236

Browse files
committed
Fix clippy warnings
1 parent 068167a commit fe42236

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/translator/graph.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ pub struct Graph {
3838

3939
impl Graph {
4040
pub fn new() -> Graph {
41-
let mut nodes = Vec::new();
42-
nodes.push(Node::default());
41+
let nodes = vec![Node::default()];
4342
let edges = HashMap::new();
4443
Graph { nodes, edges }
4544
}
@@ -141,7 +140,7 @@ impl Graph {
141140
let next_node = self.add_node();
142141
for c in chars {
143142
match self.edges.get(&(current_node, Transition::Character(*c))) {
144-
Some(node) => {}
143+
Some(_) => (),
145144
None => {
146145
self.add_edge(current_node, Transition::Character(*c), next_node);
147146
}
@@ -201,7 +200,7 @@ impl Graph {
201200
let next_node = self.add_node();
202201
for c in chars {
203202
match self.edges.get(&(current_node, Transition::Character(*c))) {
204-
Some(node) => {}
203+
Some(_) => (),
205204
None => {
206205
self.add_edge(current_node, Transition::Character(*c), next_node);
207206
}
@@ -279,7 +278,7 @@ impl Graph {
279278
if let Some(node_id) = self.edges.get(&(node_id, Transition::Start(Boundary::Word))) {
280279
if word_start(prev, c) {
281280
matching_rules.extend(self.find_translations_from_node(
282-
&input[..],
281+
input,
283282
prev,
284283
*node_id,
285284
match_length,
@@ -290,7 +289,7 @@ impl Graph {
290289
if let Some(node_id) = self.edges.get(&(node_id, Transition::Start(Boundary::NotWord))) {
291290
if !word_start(prev, c) {
292291
matching_rules.extend(self.find_translations_from_node(
293-
&input[..],
292+
input,
294293
prev,
295294
*node_id,
296295
match_length,
@@ -301,7 +300,7 @@ impl Graph {
301300
if let Some(node_id) = self.edges.get(&(node_id, Transition::End(Boundary::Word))) {
302301
if word_end(prev, c) {
303302
matching_rules.extend(self.find_translations_from_node(
304-
&input[..],
303+
input,
305304
prev,
306305
*node_id,
307306
match_length,
@@ -312,7 +311,7 @@ impl Graph {
312311
if let Some(node_id) = self.edges.get(&(node_id, Transition::End(Boundary::NotWord))) {
313312
if !word_end(prev, c) {
314313
matching_rules.extend(self.find_translations_from_node(
315-
&input[..],
314+
input,
316315
prev,
317316
*node_id,
318317
match_length,
@@ -323,7 +322,7 @@ impl Graph {
323322
if let Some(node_id) = self.edges.get(&(node_id, Transition::End(Boundary::WordNumber))) {
324323
if word_number(prev, c) {
325324
matching_rules.extend(self.find_translations_from_node(
326-
&input[..],
325+
input,
327326
prev,
328327
*node_id,
329328
match_length,
@@ -334,7 +333,7 @@ impl Graph {
334333
if let Some(node_id) = self.edges.get(&(node_id, Transition::Start(Boundary::NumberWord))) {
335334
if number_word(prev, c) {
336335
matching_rules.extend(self.find_translations_from_node(
337-
&input[..],
336+
input,
338337
prev,
339338
*node_id,
340339
match_length,
@@ -344,7 +343,7 @@ impl Graph {
344343
}
345344
if let Some(node_id) = self.edges.get(&(node_id, Transition::End(Boundary::PrePattern))) {
346345
matching_rules.extend(self.find_translations_from_node(
347-
&input[..],
346+
input,
348347
prev,
349348
*node_id,
350349
match_length,

src/yaml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct YAMLParser<'a> {
5555
events: Peekable<ParserIter<'a>>,
5656
}
5757

58-
impl<'a> YAMLParser<'a> {
58+
impl YAMLParser<'_> {
5959
pub fn new(reader: File) -> Result<Self, ParseError> {
6060
let parser = Parser::new(reader)?;
6161
Ok(Self {

0 commit comments

Comments
 (0)