Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Nov 9, 2017
1 parent d350b3f commit 23dce74
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 136 deletions.
120 changes: 59 additions & 61 deletions src/exec.rs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub fn print(args: &[Arc<Any>]) -> Result<Arc<Any>, String> {
let mut no_space = true;
let mut s = String::new();
for val in vals {
if let &Value::String(ref v) = val {
if let Value::String(ref v) = *val {
no_space = true;
s.push_str(v);
} else {
Expand Down Expand Up @@ -222,14 +222,14 @@ pub fn println(args: &[Arc<Any>]) -> Result<Arc<Any>, String> {
Some(first_elt) => {
let (lower, _) = iter.size_hint();
let mut result = String::with_capacity(lower + 1);
if let &&Value::String(ref v) = first_elt {
if let Value::String(ref v) = *(*first_elt) {
result.push_str(v);
} else {
write!(&mut result, "{}", first_elt).unwrap();
}
for elt in iter {
result.push_str(" ");
if let &&Value::String(ref v) = elt {
if let Value::String(ref v) = *(*elt) {
result.push_str(v);
} else {
write!(&mut result, "{}", elt).unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/lexer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(unused_imports)] // for clippy
use std::ascii::AsciiExt;
use std::collections::HashMap;
use std::fmt;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ pub use gtmpl_value::Value;
pub fn template<T: Into<Value>>(template_str: &str, context: T) -> Result<String, String> {
let mut tmpl = Template::default();
tmpl.parse(template_str)?;
tmpl.render(Context::from(context)?)
tmpl.render(&Context::from(context)?)
}
8 changes: 4 additions & 4 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ node!(
);

impl VariableNode {
pub fn new(tr: TreeId, pos: Pos, ident: String) -> VariableNode {
pub fn new(tr: TreeId, pos: Pos, ident: &str) -> VariableNode {
VariableNode {
typ: NodeType::Variable,
tr,
Expand Down Expand Up @@ -404,7 +404,7 @@ node!(
);

impl FieldNode {
pub fn new(tr: TreeId, pos: Pos, ident: String) -> FieldNode {
pub fn new(tr: TreeId, pos: Pos, ident: &str) -> FieldNode {
FieldNode {
typ: NodeType::Field,
tr,
Expand Down Expand Up @@ -517,9 +517,9 @@ impl NumberNode {
tr: TreeId,
pos: Pos,
text: String,
item_typ: ItemType,
item_typ: &ItemType,
) -> Result<NumberNode, Error> {
match item_typ {
match *item_typ {
ItemType::ItemCharConstant => {
unquote_char(&text, '\'')
.and_then(|c| {
Expand Down
Loading

0 comments on commit 23dce74

Please sign in to comment.