rust-lang/rust-clippy

Lint `set_*` and `get_*` methods that do nothing but access the field

Open

#1,673 建立於 2017年4月12日

在 GitHub 查看
 (18 留言) (3 反應) (0 負責人)Rust (10,406 star) (1,391 fork)batch import
A-lintL-styleT-middlegood first issue

描述

It is not idiomatic in Rust to have setters and getters. Make the field public instead.

If the type only has a get_foo method but not a set_foo method, suggest naming it foo instead.

貢獻者指南

Lint `set_*` and `get_*` methods that do nothing but access the field · rust-lang/rust-clippy#1673 | Good First Issue