From e8a206737541562d2b15406d8698195dc2fbf930 Mon Sep 17 00:00:00 2001 From: smehringer Date: Thu, 15 Oct 2020 16:05:05 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: rrahn --- include/seqan3/io/alignment_file/format_sam_base.hpp | 3 +-- test/unit/io/alignment_file/format_sam_test.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/seqan3/io/alignment_file/format_sam_base.hpp b/include/seqan3/io/alignment_file/format_sam_base.hpp index 690eb1dbf3e..8547da2e4ac 100644 --- a/include/seqan3/io/alignment_file/format_sam_base.hpp +++ b/include/seqan3/io/alignment_file/format_sam_base.hpp @@ -379,9 +379,8 @@ inline void format_sam_base::read_field(stream_view_type && stream_view, target_ // and in that case might read `past-the-end` on a second call of std::ranges::begin. if (auto it = std::ranges::begin(stream_view); it != std::ranges::end(stream_view)) { - char c = *it; // Write to target if field does not represent an empty string, denoted as single '*' character. - if (!(++it == std::ranges::end(stream_view) && c == '*')) + if (char c = *it; !(++it == std::ranges::end(stream_view) && c == '*')) { target.push_back(seqan3::assign_char_to(c, target_range_value_t{})); std::ranges::copy(std::ranges::subrange{it, std::ranges::end(stream_view)} diff --git a/test/unit/io/alignment_file/format_sam_test.cpp b/test/unit/io/alignment_file/format_sam_test.cpp index 03077f2cdd5..3820057a398 100644 --- a/test/unit/io/alignment_file/format_sam_test.cpp +++ b/test/unit/io/alignment_file/format_sam_test.cpp @@ -338,14 +338,8 @@ TEST_F(sam_format, issue2195) }; seqan3::alignment_file_input fin{istream, seqan3::format_sam{}}; - std::vector expected_quality - { - seqan3::assign_char_to('*', seqan3::phred42{}), - seqan3::assign_char_to('9', seqan3::phred42{}), - seqan3::assign_char_to('<', seqan3::phred42{}), - seqan3::assign_char_to('9', seqan3::phred42{}), - seqan3::assign_char_to(';', seqan3::phred42{}) - }; + using seqan3::operator""_phred42; + std::vector expected_quality = "*9<9;"_phred42; EXPECT_RANGE_EQ(seqan3::get(*fin.begin()), std::string{"*r1"}); EXPECT_RANGE_EQ(seqan3::get(*fin.begin()), expected_quality);