mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00

This merely adds the crate to our repository. Some cosmetic changes are made to make it work in our repo and follow our conventions, such as changing the name to `ruff_annotate_snippets`. We retain the original license information. We do drop some things, such as benchmarks, but keep tests and examples.
68 lines
1.3 KiB
Rust
68 lines
1.3 KiB
Rust
use anstyle::Style;
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
pub(crate) struct Stylesheet {
|
|
pub(crate) error: Style,
|
|
pub(crate) warning: Style,
|
|
pub(crate) info: Style,
|
|
pub(crate) note: Style,
|
|
pub(crate) help: Style,
|
|
pub(crate) line_no: Style,
|
|
pub(crate) emphasis: Style,
|
|
pub(crate) none: Style,
|
|
}
|
|
|
|
impl Default for Stylesheet {
|
|
fn default() -> Self {
|
|
Self::plain()
|
|
}
|
|
}
|
|
|
|
impl Stylesheet {
|
|
pub(crate) const fn plain() -> Self {
|
|
Self {
|
|
error: Style::new(),
|
|
warning: Style::new(),
|
|
info: Style::new(),
|
|
note: Style::new(),
|
|
help: Style::new(),
|
|
line_no: Style::new(),
|
|
emphasis: Style::new(),
|
|
none: Style::new(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Stylesheet {
|
|
pub(crate) fn error(&self) -> &Style {
|
|
&self.error
|
|
}
|
|
|
|
pub(crate) fn warning(&self) -> &Style {
|
|
&self.warning
|
|
}
|
|
|
|
pub(crate) fn info(&self) -> &Style {
|
|
&self.info
|
|
}
|
|
|
|
pub(crate) fn note(&self) -> &Style {
|
|
&self.note
|
|
}
|
|
|
|
pub(crate) fn help(&self) -> &Style {
|
|
&self.help
|
|
}
|
|
|
|
pub(crate) fn line_no(&self) -> &Style {
|
|
&self.line_no
|
|
}
|
|
|
|
pub(crate) fn emphasis(&self) -> &Style {
|
|
&self.emphasis
|
|
}
|
|
|
|
pub(crate) fn none(&self) -> &Style {
|
|
&self.none
|
|
}
|
|
}
|