Skip to content

Commit 87559ea

Browse files
committed
refactor: rename to warn
Signed-off-by: hi-rustin <[email protected]>
1 parent d161904 commit 87559ea

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,12 @@ Options:
210210
211211
[env: RUST_LOG=]
212212
213-
--linters <LINTERS>...
214-
Enable or disable specific linters.
213+
-W, --warn <WARNS>...
214+
Enable lint warnings.
215215
216-
This is a comma-separated list of linters to enable or
217-
disable.
216+
This is a comma-separated list of warnings to enable.
218217
219-
Each linter is specified by its name, which is one of:
218+
Each warning is specified by its name, which is one of:
220219
221220
* `self-wakes` -- Warns when a task wakes itself more than a
222221
certain percentage of its total wakeups.

tokio-console/console.example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_target_addr = 'http://127.0.0.1:6669/'
22
log = 'off'
3-
linters = [
3+
warns = [
44
'self-wakes',
55
'lost-waker',
66
'never-yielded',

tokio-console/src/config.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,25 @@ pub struct Config {
5050
#[clap(long = "log", env = "RUST_LOG")]
5151
log_filter: Option<LogFilter>,
5252

53-
/// Enable or disable specific linters.
53+
/// Enable lint warnings.
5454
///
55-
/// This is a comma-separated list of linters to enable or disable.
55+
/// This is a comma-separated list of warnings to enable.
5656
///
57-
/// Each linter is specified by its name, which is one of:
57+
/// Each warning is specified by its name, which is one of:
5858
///
5959
/// * `self-wakes` -- Warns when a task wakes itself more than a certain percentage of its total wakeups.
6060
///
6161
/// * `lost-waker` -- Warns when a task is dropped without being woken.
6262
///
6363
/// * `never-yielded` -- Warns when a task has never yielded.
6464
///
65-
#[clap(long = "linters", value_delimiter = ',', num_args = 1..)]
65+
#[clap(long = "warn", short = 'W', value_delimiter = ',', num_args = 1..)]
6666
#[clap(default_values_t = vec![
6767
KnownWarnings::SelfWakes,
6868
KnownWarnings::LostWaker,
6969
KnownWarnings::NeverYielded
7070
])]
71-
pub(crate) linters: Vec<KnownWarnings>,
71+
pub(crate) warns: Vec<KnownWarnings>,
7272

7373
/// Path to a directory to write the console's internal logs to.
7474
///
@@ -291,7 +291,7 @@ impl FromStr for LogFilter {
291291
struct ConfigFile {
292292
default_target_addr: Option<String>,
293293
log: Option<String>,
294-
linters: Vec<KnownWarnings>,
294+
warns: Vec<KnownWarnings>,
295295
log_directory: Option<PathBuf>,
296296
retention: Option<RetainFor>,
297297
charset: Option<CharsetConfig>,
@@ -480,12 +480,12 @@ impl Config {
480480
log_directory: other.log_directory.or(self.log_directory),
481481
target_addr: other.target_addr.or(self.target_addr),
482482
log_filter: other.log_filter.or(self.log_filter),
483-
linters: {
484-
let mut linters = other.linters;
485-
linters.extend(self.linters);
486-
linters.sort_unstable();
487-
linters.dedup();
488-
linters
483+
warns: {
484+
let mut warns: Vec<KnownWarnings> = other.warns;
485+
warns.extend(self.warns);
486+
warns.sort_unstable();
487+
warns.dedup();
488+
warns
489489
},
490490
retain_for: other.retain_for.or(self.retain_for),
491491
view_options: self.view_options.merge_with(other.view_options),
@@ -501,7 +501,7 @@ impl Default for Config {
501501
log_filter: Some(LogFilter(
502502
filter::Targets::new().with_default(filter::LevelFilter::OFF),
503503
)),
504-
linters: vec![
504+
warns: vec![
505505
KnownWarnings::SelfWakes,
506506
KnownWarnings::LostWaker,
507507
KnownWarnings::NeverYielded,
@@ -741,7 +741,7 @@ impl From<Config> for ConfigFile {
741741
default_target_addr: config.target_addr.map(|addr| addr.to_string()),
742742
log: config.log_filter.map(|filter| filter.to_string()),
743743
log_directory: config.log_directory,
744-
linters: config.linters,
744+
warns: config.warns,
745745
retention: config.retain_for,
746746
charset: Some(CharsetConfig {
747747
lang: config.view_options.lang,
@@ -764,7 +764,7 @@ impl TryFrom<ConfigFile> for Config {
764764
Ok(Config {
765765
target_addr: value.target_addr()?,
766766
log_filter: value.log_filter()?,
767-
linters: value.linters.clone(),
767+
warns: value.warns.clone(),
768768
log_directory: value.log_directory.take(),
769769
retain_for: value.retain_for(),
770770
view_options: ViewOptions {

tokio-console/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async fn main() -> color_eyre::Result<()> {
6666
let (details_tx, mut details_rx) = mpsc::channel::<TaskDetails>(2);
6767

6868
let mut state = State::default()
69-
.with_task_linters(args.linters.iter().map(|lint| lint.into()))
69+
.with_task_linters(args.warns.iter().map(|lint| lint.into()))
7070
.with_retain_for(retain_for);
7171
let mut input = Box::pin(input::EventStream::new().try_filter(|event| {
7272
future::ready(!matches!(

tokio-console/tests/cli-ui.stdout

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ Options:
3939

4040
[env: RUST_LOG=]
4141

42-
--linters <LINTERS>...
43-
Enable or disable specific linters.
42+
-W, --warn <WARNS>...
43+
Enable lint warnings.
4444

45-
This is a comma-separated list of linters to enable or
46-
disable.
45+
This is a comma-separated list of warnings to enable.
4746

48-
Each linter is specified by its name, which is one of:
47+
Each warning is specified by its name, which is one of:
4948

5049
* `self-wakes` -- Warns when a task wakes itself more than a
5150
certain percentage of its total wakeups.

0 commit comments

Comments
 (0)