-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into summary-feature
- Loading branch information
Showing
10 changed files
with
99 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ mod token_kind; | |
mod use_color; | ||
mod variables; | ||
mod verbosity; | ||
mod warning; | ||
|
||
pub use crate::run::run; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use crate::common::*; | ||
use crate::misc::write_message_context; | ||
|
||
use Warning::*; | ||
|
||
#[derive(Debug)] | ||
pub(crate) enum Warning<'a> { | ||
DeprecatedEquals { equals: Token<'a> }, | ||
} | ||
|
||
impl Warning<'_> { | ||
fn context(&self) -> Option<&Token> { | ||
match self { | ||
DeprecatedEquals { equals } => Some(equals), | ||
} | ||
} | ||
} | ||
|
||
impl Display for Warning<'_> { | ||
fn fmt(&self, f: &mut Formatter) -> fmt::Result { | ||
let warning = Color::fmt(f).warning(); | ||
let message = Color::fmt(f).message(); | ||
|
||
write!(f, "{} {}", warning.paint("warning:"), message.prefix())?; | ||
|
||
match self { | ||
DeprecatedEquals { .. } => { | ||
writeln!( | ||
f, | ||
"`=` in assignments, exports, and aliases is being phased out on favor of `:=`" | ||
)?; | ||
write!( | ||
f, | ||
"Please see this issue for more details: https://github.com/casey/just/issues/379" | ||
)?; | ||
} | ||
} | ||
|
||
write!(f, "{}", message.suffix())?; | ||
|
||
if let Some(token) = self.context() { | ||
writeln!(f)?; | ||
write_message_context( | ||
f, | ||
Color::fmt(f).warning(), | ||
token.text, | ||
token.offset, | ||
token.line, | ||
token.column, | ||
token.lexeme().len(), | ||
)?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters