Skip to content

Commit

Permalink
Bump all the deps and appease Clippy, 2022 edition.
Browse files Browse the repository at this point in the history
  • Loading branch information
bodil committed Jan 27, 2022
1 parent 9576477 commit e18d328
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion examples/dodrio/todomvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "dodrio-todomvc"
version = "0.1.0"

[dependencies]
cfg-if = "0.1.7"
cfg-if = "1"
dodrio = "0.2.0"
futures = "0.3"
js-sys = "0.3.15"
Expand Down
1 change: 1 addition & 0 deletions examples/dodrio/todomvc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![recursion_limit = "1024"]
#![deny(missing_docs)]
#![allow(unused_braces)]

pub mod controller;
pub mod keys;
Expand Down
4 changes: 2 additions & 2 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ keywords = ["jsx", "html", "wasm"]
proc-macro = true

[dependencies]
lalrpop-util = "0.18"
lalrpop-util = "0.19"
ansi_term = "0.12.0"
proc-macro2 = { version = "1.0.4", features = ["nightly"] }
quote = "1.0.2"

[build-dependencies]
lalrpop = "0.18"
lalrpop = "0.19"
version_check = "0.9.1"

[features]
Expand Down
4 changes: 2 additions & 2 deletions macros/src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Declare {

fn attr_type_name(&self) -> TokenTree {
Ident::new(
&format!("Attrs_{}", self.name.to_string()),
&format!("Attrs_{}", self.name),
self.name.span(),
)
.into()
Expand All @@ -53,7 +53,7 @@ impl Declare {
fn req_children(&self) -> impl Iterator<Item = (TokenTree, TokenTree, TokenTree)> + '_ {
self.req_children.iter().map(|child| {
let child_name: TokenTree =
Ident::new(&format!("child_{}", child.to_string()), child.span()).into();
Ident::new(&format!("child_{}", child), child.span()).into();
let child_type: TokenTree = Ident::new(&child.to_string(), child.span()).into();
let child_str = Literal::string(&child.to_string()).into();
(child_name, child_type, child_str)
Expand Down
13 changes: 5 additions & 8 deletions macros/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ fn extract_data_attrs(attrs: &mut StringyMap<Ident, TokenTree>) -> StringyMap<St
let keys: Vec<Ident> = attrs.keys().cloned().collect();
for key in keys {
let key_name = key.to_string();
let prefix = "data_";
if key_name.starts_with(prefix) {
if let Some(key_name) = key_name.strip_prefix("data_") {
let value = attrs.remove(&key).unwrap();
data.insert(key_name[prefix.len()..].to_string(), value);
data.insert(key_name.to_string(), value);
}
}
data
Expand All @@ -116,9 +115,7 @@ fn extract_event_handlers(
let keys: Vec<Ident> = attrs.keys().cloned().collect();
for key in keys {
let key_name = key.to_string();
let prefix = "on";
if key_name.starts_with(prefix) {
let event_name = &key_name[prefix.len()..];
if let Some(event_name) = key_name.strip_prefix("on") {
let value = attrs.remove(&key).unwrap();
events.insert(ident::new_raw(event_name, key.span()), value);
}
Expand Down Expand Up @@ -148,8 +145,8 @@ fn is_string_literal(literal: &Literal) -> bool {
#[allow(dead_code)]
fn stringify_ident(ident: &Ident) -> String {
let s = ident.to_string();
if s.starts_with("r#") {
s[2..].to_string()
if let Some(raw_s) = s.strip_prefix("r#") {
raw_s.to_string()
} else {
s
}
Expand Down
5 changes: 1 addition & 4 deletions macros/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ impl Token {
}

pub fn is_ident(&self) -> bool {
match self {
Token::Ident(_) => true,
_ => false,
}
matches!(self, Token::Ident(_))
}
}

Expand Down
8 changes: 4 additions & 4 deletions typed-html/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ maintenance = { status = "looking-for-maintainer" }
all-features = true

[dependencies]
typed-html-macros = "0.2.2"
strum = "0.18"
strum_macros = "0.18"
typed-html-macros = { path = "../macros" }
strum = "0.23"
strum_macros = "0.23"
mime = "0.3.13"
language-tags = "0.2.2"
language-tags = "0.3"
htmlescape = "0.3.1"
proc-macro-nested = "0.1.3"
stdweb = { version = "0.4.14", optional = true }
Expand Down
46 changes: 23 additions & 23 deletions typed-html/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub type Integrity = String;
pub type Nonce = String;
pub type Target = String;

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum AreaShape {
#[strum(to_string = "rect")]
Rectangle,
Expand All @@ -40,7 +40,7 @@ pub enum AreaShape {
Default,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum BoolOrDefault {
#[strum(to_string = "true")]
True,
Expand All @@ -50,7 +50,7 @@ pub enum BoolOrDefault {
False,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum ButtonType {
#[strum(to_string = "submit")]
Submit,
Expand All @@ -60,7 +60,7 @@ pub enum ButtonType {
Button,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Bool {
#[strum(to_string = "true")]
True,
Expand All @@ -78,15 +78,15 @@ impl From<bool> for Bool {
}
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum CrossOrigin {
#[strum(to_string = "anonymous")]
Anonymous,
#[strum(to_string = "use-credentials")]
UseCredentials,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum FormEncodingType {
#[strum(to_string = "application/x-www-form-urlencoded")]
UrlEncoded,
Expand All @@ -96,15 +96,15 @@ pub enum FormEncodingType {
Text,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum FormMethod {
#[strum(to_string = "post")]
Post,
#[strum(to_string = "get")]
Get,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum FormDialogMethod {
#[strum(to_string = "post")]
Post,
Expand All @@ -114,15 +114,15 @@ pub enum FormDialogMethod {
Dialog,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum HTTPEquiv {
#[strum(to_string = "content-security-policy")]
ContentSecurityPolicy,
#[strum(to_string = "refresh")]
Refresh,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum ImageDecoding {
#[strum(to_string = "sync")]
Sync,
Expand All @@ -132,7 +132,7 @@ pub enum ImageDecoding {
Auto,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum InputType {
#[strum(to_string = "button")]
Button,
Expand Down Expand Up @@ -180,7 +180,7 @@ pub enum InputType {
Week,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum LinkType {
#[strum(to_string = "alternate")]
Alternate,
Expand Down Expand Up @@ -228,7 +228,7 @@ pub enum LinkType {
Tag,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Metadata {
#[strum(to_string = "application-name")]
ApplicationName,
Expand All @@ -254,15 +254,15 @@ pub enum Metadata {
Viewport,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum OnOff {
#[strum(to_string = "on")]
On,
#[strum(to_string = "off")]
Off,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum OrderedListType {
#[strum(to_string = "a")]
LowerCaseLetters,
Expand All @@ -276,7 +276,7 @@ pub enum OrderedListType {
Numbers,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Preload {
#[strum(to_string = "none")]
None,
Expand All @@ -286,7 +286,7 @@ pub enum Preload {
Auto,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum ReferrerPolicy {
#[strum(to_string = "no-referrer")]
NoReferrer,
Expand All @@ -300,7 +300,7 @@ pub enum ReferrerPolicy {
UnsafeUrl,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Role {
#[strum(to_string = "any")]
Any,
Expand Down Expand Up @@ -440,7 +440,7 @@ pub enum Role {
TreeGrid,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Sandbox {
#[strum(to_string = "allow-forms")]
AllowForms,
Expand All @@ -466,7 +466,7 @@ pub enum Sandbox {
AllowTopNavigationByUserNavigation,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum TableHeaderScope {
#[strum(to_string = "row")]
Row,
Expand All @@ -480,15 +480,15 @@ pub enum TableHeaderScope {
Auto,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum TextDirection {
#[strum(to_string = "ltr")]
LeftToRight,
#[strum(to_string = "rtl")]
RightToLeft,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum VideoKind {
#[strum(to_string = "subtitles")]
Subtitles,
Expand All @@ -502,7 +502,7 @@ pub enum VideoKind {
Metadata,
}

#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, AsStaticStr)]
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
pub enum Wrap {
#[strum(to_string = "hard")]
Hard,
Expand Down
2 changes: 1 addition & 1 deletion ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "typed-html-tests"
path = "main.rs"

[dev-dependencies]
compiletest_rs = { version = "0.5", features = ["stable"] }
compiletest_rs = { version = "0.7", features = ["stable"] }
typed-html = { path = "../typed-html" }
typed-html-macros = { path = "../macros" }
version_check = "0.9.1"

0 comments on commit e18d328

Please sign in to comment.