Skip to content

Commit

Permalink
removed dead code (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudny authored Jan 31, 2023
1 parent 5cd6888 commit e961e9e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 21 deletions.
12 changes: 1 addition & 11 deletions src/environment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![allow(dead_code)]

use std::collections::btree_map::{Iter, IterMut};
use std::collections::btree_map::IterMut;
use std::collections::BTreeMap;

use anyhow::bail;
Expand Down Expand Up @@ -39,10 +37,6 @@ impl Identifier {
id.chars().all(|c| c.is_alphanumeric() || c == '_')
&& id.starts_with(|c: char| c.is_alphabetic() || c == '_')
}

pub fn get(&self) -> &str {
&self.id
}
}

impl ToString for Identifier {
Expand Down Expand Up @@ -131,10 +125,6 @@ impl<T: MatrixNumber> Environment<T> {
self.env.get(id)
}

pub fn iter(&self) -> Iter<'_, Identifier, Type<T>> {
self.env.iter()
}

pub fn iter_mut(&mut self) -> IterMut<'_, Identifier, Type<T>> {
self.env.iter_mut()
}
Expand Down
3 changes: 0 additions & 3 deletions src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use lazy_static::lazy_static;
use std::collections::HashMap;
use std::fmt::Display;

#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Language {
English,
Expand Down Expand Up @@ -31,7 +30,6 @@ impl Language {
}
}

#[allow(dead_code)]
pub struct Locale {
language: Language,
translation_map: &'static HashMap<String, String>,
Expand Down Expand Up @@ -64,7 +62,6 @@ impl Locale {
Self::unwrap_or_default(self.translation_map.get(s), s)
}

#[allow(dead_code)]
pub fn get_translated_from(&self, s: String) -> String {
self.get_translated(&s)
}
Expand Down
6 changes: 2 additions & 4 deletions src/matrices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ impl<T: MatrixNumber> Matrix<T> {
/// // | 3 4 |
/// // | 5 6 |
/// ```
#[allow(dead_code)]
pub fn reshape(&self, (rows, cols): (usize, usize)) -> anyhow::Result<Self> {
let (h, w) = self.get_shape();
if h * w != rows * cols {
Expand Down Expand Up @@ -233,7 +232,6 @@ impl<T: MatrixNumber> Matrix<T> {
/// // | 1 1 1 |
/// // | 1 1 1 |
/// ```
#[allow(dead_code)] // TODO: Remove this when used
pub fn ones((h, w): (usize, usize)) -> Self {
Self::filled((h, w), |_, _| T::one())
}
Expand Down Expand Up @@ -598,7 +596,7 @@ impl<T: MatrixNumber> Matrix<T> {
pub fn concat(mut self, other: Self) -> anyhow::Result<Self> {
let (rows, columns) = self.get_shape();
if rows != other.get_shape().0 {
anyhow::bail!("Cannot concatenate matrices with different number of rows!");
bail!("Cannot concatenate matrices with different number of rows!");
}

std::iter::zip(self.data.iter_mut(), other.data.into_iter())
Expand All @@ -622,7 +620,7 @@ impl<T: MatrixNumber> Matrix<T> {
pub fn split(mut self, column: usize) -> anyhow::Result<(Self, Self)> {
let (_, columns) = self.get_shape();
if column > columns {
anyhow::bail!("Cannot split matrix at column {}!", column);
bail!("Cannot split matrix at column {}!", column);
}

let right = Self::new_unsafe(
Expand Down
1 change: 0 additions & 1 deletion src/matrix_algorithms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub struct Aftermath<T: MatrixNumber> {
pub steps: Vec<String>,
}

#[allow(dead_code)]
impl<T: MatrixNumber> Matrix<T> {
/// Returns a copy of the matrix which is in the row echelon form along
/// with all steps represented in human-friendly LaTeX notation.
Expand Down
2 changes: 0 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use std::collections::VecDeque;
use std::fmt::{Display, Formatter};

Expand Down

0 comments on commit e961e9e

Please sign in to comment.