Skip to content

Commit

Permalink
Clean up some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Feb 1, 2025
1 parent c86ccc1 commit 9b245d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
13 changes: 8 additions & 5 deletions src/ast/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,16 @@ void Path::print_pretty(::std::ostream& os, bool is_type_context, bool is_debug)
}
}
TU_ARMA(Absolute, ent) {
if( ent.crate == "" )
const char* cn = ent.crate.c_str();
if( !cn[0] ) {
os << "crate";
else if( ent.crate.c_str()[0] == '=' ) {
os << "::" << ent.crate.c_str()+1 << "";
}
else
os << "::\"" << ent.crate << "\"";
else if( cn[0] == '=' ) {
os << "::" << cn+1;
}
else {
os << "::\"" << cn << "\"";
}
for(const auto& n : ent.nodes)
{
os << "::";
Expand Down
1 change: 0 additions & 1 deletion src/hir_expand/lifetime_infer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,6 @@ namespace {
HIR::TypeRef tmp_ty;
const auto* cap_ty_p = &m_binding_types_ptr->at(cap.root_slot);
HIR::TypeRef deref_source;
bool found_borrow = false;
for(const auto& n : cap.fields) {
if( n == RcString() ) {
deref_source = cap_ty_p->clone();
Expand Down
1 change: 0 additions & 1 deletion src/trans/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ void Trans_Codegen(const ::std::string& outfile, CodegenOutput out_ty, const Tra
DEBUG("STATIC " << ent.first);
assert(ent.second->ptr);
const auto& stat = *ent.second->ptr;
const auto& pp = ent.second->pp;

if( stat.m_params.is_generic() )
{
Expand Down
6 changes: 1 addition & 5 deletions tools/common/toml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,9 @@ TomlToken TomlToken::lex_from_inner(::std::ifstream& is, unsigned& m_line)
is.putback(c);

int64_t val = 0;
bool is_all_digit;
bool is_all_digit = true;
if( str.size() > 2 && str[0] == '0' ) {
if(str[1] == 'x') {
is_all_digit = true;
for(size_t i = 2; i < str.size(); i ++) {
c = str[i];
if( !isxdigit(c) ) {
Expand All @@ -521,7 +520,6 @@ TomlToken TomlToken::lex_from_inner(::std::ifstream& is, unsigned& m_line)
}
}
else if(str[1] == 'o') {
is_all_digit = true;
for(size_t i = 2; i < str.size(); i ++) {
c = str[i];
if( !('0' <= c && c <= '7') ) {
Expand All @@ -533,7 +531,6 @@ TomlToken TomlToken::lex_from_inner(::std::ifstream& is, unsigned& m_line)
}
}
else if(str[1] == 'b') {
is_all_digit = true;
for(size_t i = 2; i < str.size(); i ++) {
c = str[i];
if( !('0' <= c && c <= '1') ) {
Expand All @@ -549,7 +546,6 @@ TomlToken TomlToken::lex_from_inner(::std::ifstream& is, unsigned& m_line)
}
}
else {
is_all_digit = true;
for(char c : str) {
if( !isdigit(c) ) {
is_all_digit = false;
Expand Down

0 comments on commit 9b245d1

Please sign in to comment.