Skip to content

Commit

Permalink
Enable readability-redundant-access-specifiers (CleverRaven#59460)
Browse files Browse the repository at this point in the history
This clang-tidy check looks for access specifiers (public, private,
etc.) that are redundant, because they match the previous one in the
struct/class definition.

Enable the check and remove all the examples it finds.
  • Loading branch information
jbytheway authored Jul 22, 2022
1 parent 3900164 commit f6ddee9
Show file tree
Hide file tree
Showing 20 changed files with 2 additions and 26 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ readability-*,\
-readability-magic-numbers,\
-readability-make-member-function-const,\
-readability-named-parameter,\
-readability-redundant-access-specifiers,\
-readability-use-anyofallof,\
"
WarningsAsErrors: '*'
Expand Down
3 changes: 0 additions & 3 deletions src/ammo_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct ammo_effect {
void finalize();
void check() const;

public:
field_type_id aoe_field_type = fd_null.id_or( INVALID_FIELD_TYPE_ID );
/** used during JSON loading only */
std::string aoe_field_type_name = "fd_null";
Expand All @@ -47,13 +46,11 @@ struct ammo_effect {
int trail_intensity_max = 0;
int trail_chance = 100;

public:
// Used by generic_factory
string_id<ammo_effect> id;
std::vector<std::pair<string_id<ammo_effect>, mod_id>> src;
bool was_loaded = false;

public:
static size_t count();
};

Expand Down
3 changes: 0 additions & 3 deletions src/auto_note.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,13 @@ class auto_note_settings

bool was_discovered( const map_extra_id &mapExtId ) const;

public:
cata::optional<custom_symbol> get_custom_symbol( const map_extra_id &mapExtId ) const;

void set_custom_symbol( const map_extra_id &mapExtId, const custom_symbol &symbol,
bool bCharacter );

void clear_all_custom_symbols( bool bCharacter );

public:
void load( bool bCharacter );

bool save( bool bCharacter );
Expand All @@ -139,7 +137,6 @@ class auto_note_settings
/// Build string containing path to the auto notes save file for the active player.
std::string build_save_path() const;

private:
/// This set contains the ID strings of all map extras that have auto note enabled for a character.
std::unordered_set<map_extra_id> character_autoNoteEnabled;

Expand Down
1 change: 0 additions & 1 deletion src/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ class time_point
// TODO: make private
explicit constexpr time_point( const int t ) : turn_( t ) { }

public:
// TODO: remove this, nobody should need it, one should use a constant `time_point`
// (representing turn 0) and a `time_duration` instead.
static constexpr time_point from_turn( const int t ) {
Expand Down
2 changes: 1 addition & 1 deletion src/cata_tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ class cata_tiles
void void_monster_override();

bool has_draw_override( const tripoint &p ) const;
public:

/**
* Initialize the current tileset (load tile images, load mapping), using the current
* tileset as it is set in the options.
Expand Down
1 change: 0 additions & 1 deletion src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -3445,7 +3445,6 @@ class Character : public Creature, public visitable
/** Processes human-specific effects of an effect. */
void process_one_effect( effect &it, bool is_new ) override;

public:
/**
* Map body parts to their total exposure, from 0.0 (fully covered) to 1.0 (buck naked).
* Clothing layers are multiplied, ex. two layers of 50% coverage will leave only 25% exposed.
Expand Down
1 change: 0 additions & 1 deletion src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,6 @@ class Creature : public viewer
Creature &operator=( const Creature & );
Creature &operator=( Creature && ) noexcept;

protected:
virtual void on_stat_change( const std::string &, int ) {}
virtual void on_effect_int_change( const efftype_id &, int, const bodypart_id & ) {}
virtual void on_damage_of_type( int, damage_type, const bodypart_id & ) {}
Expand Down
1 change: 0 additions & 1 deletion src/enum_bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class enum_bitset
return static_cast<size_t>( static_cast<typename std::underlying_type<E>::type>( e ) );
}

private:
std::bitset<enum_bitset<E>::size()> bits;
};

Expand Down
1 change: 0 additions & 1 deletion src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,6 @@ class game
void move_save_to_graveyard();
bool save_player_data();
// ########################## DATA ################################
private:
// May be a bit hacky, but it's probably better than the header spaghetti
pimpl<map> map_ptr; // NOLINT(cata-serialize)
pimpl<avatar> u_ptr; // NOLINT(cata-serialize)
Expand Down
1 change: 0 additions & 1 deletion src/generic_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,6 @@ class typed_flag_reader : public generic_typed_reader<typed_flag_reader<T>>
private:
using map_t = std::unordered_map<std::string, T>;

private:
const map_t &flag_map;
const std::string flag_type;

Expand Down
1 change: 0 additions & 1 deletion src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,6 @@ class map
void mirror( bool mirror_horizontal, bool mirror_vertical );

// Monster spawning:
public:
/**
* Spawn monsters from submap spawn points and from the overmap.
* @param ignore_sight If true, monsters may spawn in the view of the player
Expand Down
1 change: 0 additions & 1 deletion src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ struct map_data_common_t {
return !( curtain_transform.is_empty() || curtain_transform.is_null() );
}

public:
std::string name() const;

/*
Expand Down
1 change: 0 additions & 1 deletion src/monster.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ class monster : public Creature
void process_trigger( mon_trigger trig, int amount );
void process_trigger( mon_trigger trig, const std::function<int()> &amount_func );

private:
int hp = 0;
std::map<std::string, mon_special_attack> special_attacks;
cata::optional<tripoint_abs_ms> goal;
Expand Down
1 change: 0 additions & 1 deletion src/omdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ struct oter_type_t {
public:
static const oter_type_t null_type;

public:
string_id<oter_type_t> id;
std::vector<std::pair<string_id<oter_type_t>, mod_id>> src;
translation name;
Expand Down
3 changes: 0 additions & 3 deletions src/overmap_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class overmap_connection
public:
enum class flag : int { orthogonal };

public:
string_id<oter_type_t> terrain;

int basic_cost = 0;
Expand All @@ -46,15 +45,13 @@ class overmap_connection
std::set<flag> flags;
};

public:
const subtype *pick_subtype_for( const int_id<oter_t> &ground ) const;
bool has( const int_id<oter_t> &oter ) const;

void load( const JsonObject &jo, const std::string &src );
void check() const;
void finalize();

public:
string_id<overmap_connection> id;
std::vector<std::pair<string_id<overmap_connection>, mod_id>> src;
bool was_loaded = false;
Expand Down
1 change: 0 additions & 1 deletion src/pixel_minimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class pixel_minimap

std::unique_ptr<pixel_minimap_projector> create_projector( const SDL_Rect &max_screen_rect ) const;

private:
const SDL_Renderer_Ptr &renderer;
const GeometryRenderer_Ptr &geometry;

Expand Down
1 change: 0 additions & 1 deletion src/recipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ class recipe
void incorporate_build_reqs();
void add_requirements( const std::vector<std::pair<requirement_id, int>> &reqs );

private:
recipe_id ident_ = recipe_id::NULL_ID();

/** Abstract recipes can be inherited from but are themselves disposed of at finalization */
Expand Down
1 change: 0 additions & 1 deletion src/ret_val.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ret_val : public ret_val_common
struct default_success;
struct default_failure;

public:
ret_val() = delete;

static ret_val make_success( T val = default_success::value ) {
Expand Down
2 changes: 1 addition & 1 deletion src/sdl_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Font
int fontheight,
const palette_array &palette,
bool fontblending );
public:

// the width of the font, background is always this size.
int width;
// the height of the font, background is always this size.
Expand Down
1 change: 0 additions & 1 deletion src/trap.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ struct trap {
fake_spell spell_data;
int comfort = 0;
int floor_bedding_warmth = 0;
public:
vehicle_handle_trap_data vehicle_data;
std::string name() const;
/**
Expand Down

0 comments on commit f6ddee9

Please sign in to comment.