Skip to content

Commit

Permalink
vcf/reader/record: Remove error conversions into core::Error
Browse files Browse the repository at this point in the history
These are unused.
  • Loading branch information
zaeleus committed Dec 6, 2023
1 parent 8e2a7d4 commit 0e2aafc
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 127 deletions.
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ mod reference_bases;

use std::{error, fmt};

use noodles_core as core;

use self::{
alternate_bases::parse_alternate_bases, chromosome::parse_chromosome, filters::parse_filters,
genotypes::parse_genotypes, ids::parse_ids, info::parse_info, position::parse_position,
Expand Down Expand Up @@ -79,12 +77,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(crate) fn parse_record(
mut s: &str,
header: &Header,
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/alternate_bases.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::record::{alternate_bases::allele, AlternateBases};

/// An error when raw VCF record alternate bases fail to parse.
Expand Down Expand Up @@ -31,12 +29,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_alternate_bases(
s: &str,
alternate_bases: &mut AlternateBases,
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/chromosome.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::record::Chromosome;

/// An error when a raw VCF record chromosome fails to parse.
Expand All @@ -21,12 +19,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_chromosome(s: &str, chromosome: &mut Chromosome) -> Result<(), ParseError> {
// symbol
if let Some(t) = s.strip_prefix('<') {
Expand Down
7 changes: 0 additions & 7 deletions noodles-vcf/src/reader/record/filters.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{error, fmt, mem};

use indexmap::IndexSet;
use noodles_core as core;

use crate::record::Filters;

Expand All @@ -28,12 +27,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_filters(s: &str, filters: &mut Option<Filters>) -> Result<(), ParseError> {
const DELIMITER: char = ';';
const PASS: &str = "PASS";
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/genotypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ mod values;

use std::{error, fmt};

use noodles_core as core;

use self::{keys::parse_keys, values::parse_values};
use super::next_field;
use crate::{record::Genotypes, Header};
Expand Down Expand Up @@ -42,12 +40,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_genotypes(
header: &Header,
mut s: &str,
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/genotypes/keys.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::{
reader::record::MISSING,
record::genotypes::{
Expand Down Expand Up @@ -46,12 +44,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_keys(header: &Header, s: &str, keys: &mut Keys) -> Result<(), ParseError> {
const DELIMITER: char = ':';

Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/genotypes/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ mod value;

use std::{error, fmt};

use noodles_core as core;

use self::value::parse_value;
use crate::{
reader::record::MISSING,
Expand Down Expand Up @@ -43,12 +41,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_values(
header: &Header,
keys: &Keys,
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/genotypes/values/value.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt, num, str};

use noodles_core as core;

use crate::{
header::{record::value::map::format::Type, Number},
reader::record::MISSING,
Expand Down Expand Up @@ -54,12 +52,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_value(number: Number, ty: Type, s: &str) -> Result<Value, ParseError> {
match (number, ty) {
(Number::Count(0), _) => Err(ParseError::InvalidNumberForType(number, ty)),
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ mod id;

use std::{error, fmt};

use noodles_core as core;

use self::id::parse_id;
use crate::record::{ids::Id, Ids};

Expand Down Expand Up @@ -37,12 +35,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_ids(s: &str, ids: &mut Ids) -> Result<(), ParseError> {
const DELIMITER: char = ';';

Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/ids/id.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::record::ids::Id;

/// An error when a raw VCF record ID fails to parse.
Expand All @@ -24,12 +22,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_id(s: &str) -> Result<Id, ParseError> {
if s.is_empty() {
Err(ParseError::Empty)
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ mod field;

use std::{error, fmt};

use noodles_core as core;

use self::field::parse_field;
use crate::{
record::{info::field::Key, Info},
Expand Down Expand Up @@ -48,12 +46,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_info(header: &Header, s: &str, info: &mut Info) -> Result<(), ParseError> {
use indexmap::map::Entry;

Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/info/field/value.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt, num, str};

use noodles_core as core;

use crate::{
header::{record::value::map::info::Type, Number},
reader::record::MISSING,
Expand Down Expand Up @@ -57,12 +55,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_value(number: Number, ty: Type, s: &str) -> Result<Value, ParseError> {
match (number, ty) {
(Number::Count(0), Type::Flag) => parse_flag(s),
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/position.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt, num};

use noodles_core as core;

use crate::record::Position;

/// An error when a raw VCF record position fails to parse.
Expand Down Expand Up @@ -40,12 +38,6 @@ impl From<num::ParseIntError> for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_position(s: &str) -> Result<Position, ParseError> {
s.parse::<usize>().map(Position::from).map_err(|e| e.into())
}
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/quality_score.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::record::QualityScore;

/// An error when a raw VCF record quality score fails to parse.
Expand All @@ -26,12 +24,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_quality_score(s: &str) -> Result<QualityScore, ParseError> {
use crate::record::quality_score::TryFromFloatError;

Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/reference_bases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ mod base;

use std::{error, fmt};

use noodles_core as core;

use self::base::parse_base;
use crate::record::ReferenceBases;

Expand Down Expand Up @@ -34,12 +32,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_reference_bases(
s: &str,
reference_bases: &mut ReferenceBases,
Expand Down
8 changes: 0 additions & 8 deletions noodles-vcf/src/reader/record/reference_bases/base.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{error, fmt};

use noodles_core as core;

use crate::record::reference_bases::Base;

/// An error when a raw VCF record base fails to parse.
Expand All @@ -21,12 +19,6 @@ impl fmt::Display for ParseError {
}
}

impl From<ParseError> for core::Error {
fn from(e: ParseError) -> Self {
Self::new(core::error::Kind::Parse, e)
}
}

pub(super) fn parse_base(c: char) -> Result<Base, ParseError> {
match c.to_ascii_uppercase() {
'A' => Ok(Base::A),
Expand Down

0 comments on commit 0e2aafc

Please sign in to comment.